Wireless Woes

I have a Netgear WG111v2 USB wireless card. It's a pain in the backside to configure in Ubuntu, since the default drivers tend to drop connections after a certain amount of time, or if the connection is used under heavy load. When I used a 32 bit OS, ndiswrapper seemed to be the right answer, but since "upgrading" to a 64 bit system that hasn't been a working option, since it just resulted in a very unstable system and no connection at all.

Thankfully though, a handy comment in the bug report has solved my problems (thanks are due to Vit Svarc). I'll report the solution here to help whoever might be experiencing the same problem.

Before we begin, let's make sure we have the same hardware, since apparently the WG111v2 has shipped with different versions.

If you type:

lsusb

into your console, you should get something like this:

Bus 004 Device 002: ID 0846:6a00 NetGear, Inc. WG111 WiFi (v2)

The important part is having and ID of 0846:6a00. If you don't, then I have no idea if these instructions will help you.

Assuming you've done that, we download the rtl8187 drivers:

wget http://dl.aircrack-ng.org/drivers/rtl8187_linux_26.1010.zip unzip rtl8187_linux_26.1010.zip cd rtl8187_linux_26.1010.0622.2006/

If, like me, you're running a 2.6.27 kernel, you'll need to patch these drivers:

wget http://patches.aircrack-ng.org/rtl8187_2.6.27.patch tar xzf drv.tar.gz tar xzf stack.tar.gz patch -Np1 -i rtl8187_2.6.27.patch

You'll also need to modify the r8187.h file, replacing asm/semaphore with linux/semaphore.

sed -i 's/asm\/semaphore.h/linux\/semaphore.h/g' ./beta-8187/r8187.h

Now blacklist the rtl8187 driver, and shut it down:

echo "blacklist rtl8187" | sudo tee -a /etc/modprobe.d/blacklist sudo ifconfig wlan0 down sudo rmmod rtl8187

Then finally make and install the new driver:

sudo make sudo make install

Finally, we load up the new drivers, and re-enable our connection. Everything should work fine now.

sudo modprobe r8187 sudo ifconfig wlan0 up

I've even noticed that I get much better reception with this driver. The only problem is that you'll have to do all this again if your kernel gets updated.

Mirrorboard

Ever wished you could type with one hand?

Inspired by a post on xkcd, I wanted to try out my skills at a one handed keyboard. Sadly, the xkb file that's provided on that site messed some of the key up on my apple keyboard -- I could no longer use the arrow keys, for one.

So, I set out to make my own version of a mirror board that didn't mind which keyboard I was using. By using xmodmap, I've been able to do pretty much exactly what I wanted, which is now in my .mirrorboard.sh file that is set to run when I log in:

#!/bin/bash
xmodmap -pke | sed -f ~/.mirrorboard.sed > ~/.Xmodmap2 
echo "keysym Super_L = Mode_switch" >> ~/.Xmodmap2
xmodmap ~/.Xmodmap2

This effectively prints out the current keymap, then replaces instances of each letter to be its the mirrored alternative, and then feeds the changes back into xmodmap. Since my apple keyboard has the Super_L key next to the space, it's pretty convenient to use that as the mode switcher.

The .mirrorboard.sed file looks like like this:


s/= q Q q Q/= q Q p P/g
s/= w W w W/= w W o O/g
s/= e E e E/= e E i I/g
s/= r R r R/= r R u U/g
s/= t T t T/= t T y Y/g

s/= a A a A/= a A semicolon colon/g
s/= s S s S/= s S l L/g
s/= d D d D/= d D k K/g
s/= f F f F/= f F j J/g
s/= g G g G/= g G h H/g

s/= grave asciitilde grave asciitilde/= grave asciitilde slash question/g
s/= z Z z Z/= z Z period greater/g
s/= x X x X/= x X comma less/g
s/= c C c C/= c C m M/g
s/= v V v V/= v V n N/g

s/= less greater less greater/= less greater BackSpace Delete/g

The result is that my keyboard now works in mirror mode when I hit the left super key. The only problem left is my complete inability to make good use of it. Here's my attempt at a standard phrase, with two hands on the top line, to compare with just one hand on the bottom. No cheating.

the quick brown fox jumped over the lazy white dog.
the qouick vnburwowvn jfox juvnmped over tghe sl;azy wgheite dog/.

Maybe that wasn't such a good idea after all...

Z/Eves

Since I've been working with the Z notation, I have been looking for a suitable theorem proving program. On my quest for tool support, I have stumbled across Z/Eves.

Apparently it's pretty good, but it suffers from several problems:

  • It's outdated (so uses Python 2.3).
  • The source is closed.
  • The original developer abandoned it.

Sigh.

Compile Python 2.3

At least the first of these problems are not insurmountable, although it involved a little bit of patience. My machine runs Ubuntu 8.10, which does not have any Python 2.3 support, otherwise it would be a simple case of

sudo aptitude install python2.3

Instead, I had to download the original source from here, and compile it myself. However, there's a bug that prevents this from working well, and so compiler flags are needed at the ./configure stage.

Here's what I needed to do to get it up and running:

cd opt
wget http://www.python.org/ftp/python/2.3.7/Python-2.3.7.tar.bz2
tar -xvjf Python-2.3.7.tar.bz2
cd Python-2.3.7
./configure BASECFLAGS=-U_FORTIFY_SOURCE
make

Install Z/Eves

That's not all though, Z/Eves requires a little tweaking once it's been installed.

wget http://agamenon.uniandes.edu.co/~rcardoso/Cursos/MESw/Material/ZEVES/z-eves-2.3.tgz
tar -xvzf z-eves-2.3.tgz

Now you need to modify the z-eves-2.3/system/system/z-eves-gui.sh so that it looks like this:

zevesdir=~/opt/z-eves-2.3
zguidir=$zevesdir/gui-2.3
python=~/opt/Python-2.3.7/python
zfontsdir=$zevesdir/zedfont

lispdir=$zevesdir/system
zsysdir=$zevesdir/system
zlibdir=$zevesdir/library/
zeves=$zsysdir/z-eves-pc-linux-cmucl.core

xset +fp $zfontsdir
export LC_ALL=C
export ZEVESCMD="$lispdir/lisp -core $zeves -- -libs $zlibdir"
exec $python $zguidir/toplevel.pyc "$@"

It's important that you set a new zfontsdir, and add the xset line, since that will enable Z/Eves to display everything correctly.

For good measure I changed the z-eves-2.3/system/system/z-eves.sh file to reflect a new zevesdir too. Oh, notice that the original file uses gui-2.2, rather than gui-2.3. I don't know if this is because the 2.3 release isn't stable, but in either case, it seems that gui-2.2 doesn't work even with python2.3 (I expect it needs an even older version).

With all that done, I was able to run Z/Eves without any silly magic numbers getting in the way.

init()


init() {
do {
 think();
 blog();
 forget();
} while (!finished && !lazy)

Hopefully, that'll get things started. Welcome to my blog. I'm a PhD student working on the applications of formal methods in relational databases, and hopefully this blog will provide technical, if not amusing, discussions about the work that I'm doing. It'll also be a replacement for my Tomboy notes, since it's where I try to keep track of some of the tweaks needed to make things run smoothly on my computer, so that I can remember what I did next time I accidentally sudo rm -rf / in a brief moment of madness.

I expect though, that it will end up being a blog with about 4 posts, 1 reader (me), and definitely no "interesting" factor. Whatever the outcome, or frequency of the posts here, I hope that this isn't a complete waste of cyberspace.