Archive for the 'Linux' Category

Wicd template for eduroam at the University of Waterloo

Waterloo’s jumping aboard the eduroam bandwagon and is phasing out their uw-secure network on November 1st, 2010. Here’s the wicd template that you need connect to eduroam, just place it in the /etc/wicd/encryption/templates/ on Arch Linux and add your template to the active file in the same directory:

name = Eduroam UW
author = Steven She
version = 1
require username *Username password *Password
-----
ctrl_interface=/var/run/wpa_supplicant
network={
    ssid="$_ESSID"
    scan_ssid="$_SCAN"
    proto=RSN
    key_mgmt=WPA-EAP
    pairwise=CCMP
    group=CCMP
    eap=PEAP
    identity="$_USERNAME"
    password="$_PASSWORD"
    ca_cert="/usr/share/ca-certificates/mozilla/GlobalSign_Root_CA.crt"
    phase2="auth=MSCHAPV2"
}

Generating LKC Parser

A quick hint for compiling the LKC parser. The kbuild system requires that bison 2.3 is used. Newer versions (in my case, 2.4) generate code that throw a compilation error.

Wicd Template for University of Leipzig

Here’s a wicd template for the EAP-TTLS + PAP setup at the University of Leipzig. This was just a small customization of the template from Shawn MacLean, so all credit goes to him. Create the file /etc/wicd/encryption/templates/eap-ttls containing:

name = EAP-TTLS with PAP
author = Shawn MacLean
version = 1
require identity *Identity password *Password ca_cert *Path_to_CA_Cert
-----
network={
    ssid="$_ESSID"
    scan_ssid="$_SCAN"
    proto=WPA
    key_mgmt=WPA-EAP
    pairwise=TKIP
    group=TKIP
    eap=TTLS
    ca_cert="$_CA_CERT"
    identity="$_IDENTITY"
    password="$_PASSWORD"
    phase2="auth=PAP"
}

Add eap-ttls to /etc/wicd/encryption/templates/active, restart the GUI and the settings should now appear in the dropdown menu.

Adobe Acrobat.com

It seems that Adobe doesn’t want to be left out of the Web 2.0 office application fad with it’s Acrobat.com. It provides document writing, desktop sharing, PDF creation, and a neat online PDF reader. All of this was made possible by employing the formerly Macromedia’s Flash technology. I was initially excited about the online Acrobat reader since the Linux reader is quite slow, and the other online solutions, such as Scribd are less than impressive. However, the Flash plug-in for Linux isn’t very impressive either. Well, in any case, Adobe seems to have gotten the right idea, by starting work on an open-source Flash and certifying PDF as an ISO standard.

Distributed Source Control using Mercurial

I’ve recently started to experiment with distributed source control systems for my personal repository. I had been using Subversion previously, but it had several issues with directories that bothered me. In addition, since my primary computer was a laptop, I also wanted to have full commit and change tracking when I was offline.

So distributed source control systems seemed to fit the bill. I looked at two systems in particular, Mercurial and git. Mercurial caught my eye because of its simplicity, and similarity with the traditional, centralized SCMs such as CVS and Subversion. However, I actually started using git first. The reason was that many open source projects had switched to git and I needed to compile several bleeding edge packages. So, I had no choice but to learn to use git. However, I couldn’t really wrap my head around it. While git is no doubt, a very powerful SCM, it was also a very complicated SCM. I took me a good hour or so before I understood how to track branches.

So, I settled for Mercurial. While I was worried that Mercurial was too immature, the fact that the Mozilla projects are also using Mercurial was very comforting.

Continue reading ‘Distributed Source Control using Mercurial’

Beamer, PDFTeX and XeTeX

I’ve recently started using the beamer class to create slides for my presentation. Up till now, I’ve been using powerdot, and found it more than sufficient. I initially thought beamer to be far more complex than necessary. However, one feature convinced me to switch: PDFTeX and XeTeX support.

Both PDFTeX and XeTeX create a PDF directly from the LaTeX source. XeTeX is built on PDFTeX, and is of particular interest since it has added support for TrueType and OpenType fonts. For beamer presentations, this was great, since it opens up a huge selection of fonts for use in presentations. To change the default font in the document with XeTeX, use the fontspec package. The xunicode package provides additional mapping between LaTeX accents and the selected font. A third package, xltxtra provides some fixes relating to fonts.

\documentclass[xetex,mathserif,serif]{beamer}
 
\usepackage{fontspec}
\usepackage{xunicode} %Unicode extras!
\usepackage{xltxtra}  %Fixes
\setmainfont{Calibri}
\setmonofont[Scale=0.86]{Andale Mono}

Of course, you should replace Calibri and Andale Mono with a font of your choice.

Another nice package to use with PDFTeX, is the microtype package, which provides better font output. Enable the package with this line:

\usepackage[final,expansion=true,protrusion=true,spacing=true,kerning=true]{microtype}

XeTeX and PGF / TiKZ

PGF / TiKZ is a TeX library for drawing graphics using the PDFTeX and XeTeX drivers. However, you may encounter the following error message when attempting to compile a presentation with PGF / TiKZ pictures in your Beamer slides:

Package pgf Warning: Your graphic driver pgfsys-dvipdfm.def does not supported marking the current position.

Unfortunately, the included TiKZ library in the TeXLive 2007 distribution does not support XeTeX. This causes cross-picture coordinates to break, which can be used to draw arrows between various TiKZ pictures in a Beamer frame.

While we wait for TeXLive 2008, you can install the new version of PGF from the CTAN which adds support for the XeTeX driver. Simply download the package, and copy the files to your local ~/texmf/tex/ directory and execute texhash to update the TeX listings.

XeTeX and Wide Pages

Although I haven’t had much time to investigate the issue, but it seems that the pgfpages package that is used with beamer, is not entirely compatible with XeTeX. In particular, the commands:

\usepackage{pgfpages}
\setbeameroption{show notes on second screen}        %beamer
\pgfpagesuselayout{two screens with optional second} %pgfpages

is enough to have pdflatex generate notes to the right of the slide, but on xelatex it doesn’t have any effect. This post by Tomáš Janoušek to the XeTeX mailing list noted that the problem was due to a bug in the pgfpages package. Adding the following snippet fixes the probblem:

\renewcommand\pgfsetupphysicalpagesizes{%
    \pdfpagewidth\pgfphysicalwidth\pdfpageheight\pgfphysicalheight%
}

Script to Connect to UW-Wireless Automatically Using Lynx

The uw-wireless authentication web page that shows up when connected to a UW network started to get on my nerves, so I wrote a little script using the lynx text browser to automatically authenticate when connecting to the network. It also performs a simple check to see if the first two numbers of your IP belong to UW.

#!/bin/sh
IP=$(ifconfig eth0 | grep 'inet addr' | awk '{print $2;}' | cut -d: -f 2)
TOP2=$(echo $IP | cut -d. -f 1-2)
if [[ $TOP2 = '129.97' ]]; then
    echo 'Connected to UW Network...'
    lynx -dump -accept_all_cookies -post_data https://uw-wireless.uwaterloo.ca/login/index.php < ~/.uwwireless | grep 'Successfully Connected' | awk '{print $5;}'
else
    echo 'Not connected to UW Network...'
fi

Create the file ~/.uwwireless and place the following in the file, replacing the YOUR_USERID and YOUR_PASSWORD with your own:

userid=YOUR_USERID&password=YOUR_PASSWORD&mode=Connect

Depending on your version of Lynx, the script may fail if the SSL certificate from uw-wireless.uwaterloo.ca is not recognized. I don’t know of a better solution than simply removing the check. Make the following change in /etc/lynx.cfg (or wherever your lynx.cfg may reside) to remove the SSL certificate prompt:

FORCE_SSL_PROMPT:=yes

TPTP Agent Controller on Arch Linux

Installing Eclipse TPTP using the Update Manager creates several problems under Linux.

  • First, the permissions are missing for the native Integrated Agent Controller code. Symbolic links were also not created for the Integrated Agent Controller libraries, resulting in a “File too short” error message when running the executable.
  • Second, since the Integrated Agent Controller is native code, it requires shared libraries which may or may not be installed on your system.
  • Third, several configuration files need to be writable by the user which executes Eclipse. I installed Eclipse using my own user (not root), so I did not run into this problem, however, there are several posts on the mailing list addressing this problem.

As a result, executing the Profiler within Eclipse would result in a cryptic “Unable to connect to localhost (port 10002)” message.

In order to get the Integrated Agent Controller running, we’ll need to fix the mentioned problems, here’s how to do it on Arch Linux:

  1. Change your working directory to where the TPTP agent controller is installed:
    cd eclipse/plugins/org.eclipse.tptp.platform.ac.linux_ia32_4.4.1.v200709261752/agent_controller
  2. Fix the permissions of the executables:
    cd <tptp_agent_controller_dir>/bin
    chmod +x ACServer ACStart.sh ACStop.sh ACVersion.sh ChkPass RAServer RAStart.sh RAStop.sh SampleClient SetConfig.sh TimeCollector readme.txt tptpFileTransferAgent tptpProcessController</tptp_agent_controller_dir>
  3. Fix the symbolic links for the linked libraries. The following list of files should point to their .so.4.4.0 counterparts. The easiest way to do this is just to download a copy of the standalone Agent Controller and to copy the lib directory to the lib directory of the Integrated Agent Controller:

    ./libtptpClient.so ./libjavaBaseAgent.so.4 ./libtptpUtils.so.4 ./libtptpAgentBase.so.4 ./libtptpUtils.so ./libtransportSupport.so.4 ./libbaseTransport.so.4 ./libhcclsm.so ./libhccldt.so.4 ./libhccls.so.4 ./libnamedPipeTL.so ./libhcclsm.so.4 ./libhcclco.so.4 ./libhccls.so ./libtptpACTL.so ./libtptpClient.so.4 ./libtransportSupport.so ./libtptpCmdExtr.so ./libhcjbnd.so ./libhcbnd.so ./libtptpCmdExtr.so.4 ./libtptpConfig.so ./libnamedPipeTL.so.4 ./libhcclco.so ./libpiAgent.so.4 ./libtptpCCTL.so ./libsocketTL.so ./libtptpCCTL.so.4 ./libjavaBaseAgent.so ./libprocessControlUtil.so.4 ./libtptpConfig.so.4 ./libcompSupp.so ./libtptpLogUtils.so ./libsharedMemTL.so.4 ./libtptpACTL.so.4 ./libprocessControlUtil.so ./libbaseTransport.so ./libpiAgent.so ./libhclaunch.so ./libsocketTL.so.4 ./libhcthread.so ./libcompSupp.so.4 ./libtptpLogUtils.so.4 ./libtptpAgentBase.so ./libhcthread.so.4 ./libsharedMemTL.so ./libhcbnd.so.4 ./libhcjbnd.so.4 ./libhclaunch.so.4 ./libhccldt.so
  4. Install the compatibility libraries using the PKGBUILD located in this wiki article.
  5. Ensure your configuration files are writable by the Eclipse user.
  6. Occasionally, the Agent Controller leaves behind profiling data in the /tmp/IBMRAC directory which causes problems with subsequent executions of the Agent Controller. Delete /tmp/IBMRAC in order to remove the temporary files.
  7. Note: Occasionally, a Java process may prevent the Agent Controller from exiting properly. Killing the appropriate process will allow the controller to be restarted. A ‘killall java’ generally does the trick :)

Firefox 3.0, ScribeFire, RadeonHD and other Miscellaneous Goodies

  • I’m making this post from ScribeFire, a Firefox extension for writing blog entries. Give it a try!
  • Firefox 3.0 is in beta now. Tons of change, but the most important ones to me are: Full page zoom, better GTK integration, and the promised Firefox 2.0 bookmarks revamp. I suggest trying out the nightly builds to see the latest and greatest.
  • The open source RadeonHD driver has reached version 1.0!  I have to switch to a VT in order to control the panel brightness, and it consumes more power than the fglrx driver since there is no dynamic clock management, but most important to me is that… suspend and hibernate just work!
  • The KDE 4.0 release has been pushed to January. I can’t blame them, having tried bits and pieces of it so far, it definitely needs the extra time. I much rather wait and have a stable desktop environment.
  • I switched to Arch Linux a couple months ago. I highly recommend it for experienced Linux users who would like a binary distribution, with a simple system management framework, and a great package management system.
  • Kile 2.0 has been released. There are some nice GUI changes, but most noticeable to me is several fixes to the static line wrapping feature.

Enable root account in Ubuntu

Ubuntu disables the root account by default. One simple command can re-enable it:

sudo passwd root

To switch to the root user in the shell:

su

Alternatively, you can switch to the root user in the shell without enabling the user account by using the following command:

sudo -s

Finding duplicate lines with sed

Something simple and useful. Finding the duplicate lines in UNIX is done with the following series of commands:

sort [file] | uniq -c | awk '$1 !~/1/'

Keep trailing spaces when unblocking with dd

I had the task of a simple FTP file transfer from a Mainframe to the development box. Easy enough, until I discovered the horrors of EBCDIC. Anyways, the UNIX tool dd converts one file type to another. To convert from EBCDIC to ASCII, set the conv=ascii parameter.

The problem with this is that the file I have are fixed length records. When specifying the record length, dd goes and trims the trailing spaces off each record. To fix this:

dd conv=ascii if=[in file] | fold -w[record length] &gt; [out file]

Setting up Forward / Back Buttons on Logitech MX518

Note: This guide was based on Ubuntu 5.04.

Step 1: X Server Settings
Edit the /etc/X11/xorg.conf file and look for the “InputDevice” section, make sure it looks like this:

Section “InputDevice”
Identifier “Configured Mouse”
Driver “mouse”
Option “CorePointer”
Option “Device” “/dev/input/mice”
Option “Protocol” “ExplorerPS/2″
Option “Buttons” “7″
Option “ZAxisMapping” “4 5″
EndSection

Make sure that the ‘Buttons’ is ‘7′, ‘Protocol’ is ‘ExplorerPS/2′, and ‘ZAxisMapping’ is ‘4 5′.

Step 2: Install imwheel
Type:

sudo apt-get install imwheel

Reboot, and it should work!