Nov 17, 2012

The sound of the dialup, pictured

If you ever connected to the Internet before the 2000s, you probably remember that it made a peculiar sound. But despite becoming so familiar, it remained a mystery for most of us. What do these sounds mean?

(The audio was captured by William Termini on his iMac G3.)

As many already know, what you're hearing is often called a handshake, the start of a telephone conversation between two modems. The modems are trying to find a common language and determine the weaknesses of the telephone channel originally meant for human speech.

Below is a spectrogram of the handshake audio. I've labeled some signals according to which party transmitted them, and also put a concise explanation below.

The first thing we hear in this example is a dial tone, the same tone you would hear when picking up your landline phone. The modem now knows it's connected to a phone line and can dial a number. The number is signaled to the network using Dual-Tone Multi-Frequency signaling, or DTMF, the same sounds a telephone makes when dialing a number.

The remote modem answers with a distinct tone that our calling modem can recognize. They then exchange short bursts of binary data to assess what kind of protocol is appropriate. This is called a V.8 bis transaction.

Now the modems must address the problem of echo suppression. When humans talk, only one of them is usually talking while the other one listens. The telephone network exploits this fact and temporarily silences the return channel to suppress any confusing echoes of the talker's own voice.

Modems don't like this at all, as they can very well talk at the same time (it's called full-duplex). The answering modem now puts on a special answer tone that will disable any echo suppression circuits on the line. The tone also has periodic "snaps" (180° phase transitions) that aim to disable yet another type of circuit called echo canceller.

Now the modems will list their supported modulation modes and try to find one that both know. They also probe the line with test tones to see how it responds to tones of different frequencies, and how much it attenuates the signal. They exchange their test results and decide a speed that is suitable for the line.

After this, the modems will go to scrambled data. They put their data through a special scrambling formula before transmission to make its power distribution more even and to make sure there are no patterns that are suboptimal for transfer. They listen to each other sending a series of binary 1's and adjust their equalizers to optimally shape the incoming signal.

Soon after this, the modem speaker will go silent and data can be put through the connection.

(UPDATE 02/2013: Due to numerous requests, I made this into a 42-megapixel poster that Redbubble is selling. Some $4 per poster is directed to the poor nerd who made this.)

Nov 9, 2012

How I made my Ubuntu usable again

Many fellow Ubuntu users have been protesting the recent developments in user interface design, call it Unity/Gnome 3/whatever. But what can a user do? Of course one could migrate [back] to Debian. But I happen to really like the way Ubuntu has done many other things. And I've found a way to restore its usability. I'll also share a few extra tips that I've found useful with Ubuntu.

Moving to Xfce

First, I replaced the default desktop environment with Xfce. It's a full-fledged, light-weight, easy-to-use desktop environment that by default has kind of an OSX-style look but is extremely customizable. It also comes with a simple compositor. Installing Xfce is simple:

sudo apt-get install xubuntu-desktop
sudo apt-get --purge remove ubuntu-desktop

This will also rebrand your distro as Xubuntu. Despite this superficial change, it will use the same repositories and, for the most part, will work exactly the same way as you're used to.

No more PulseAudio

Secondly, and less importantly, I eradicated PulseAudio which is another common source of mischief:

~ - zsh ×
1513 windy@pentti~ ) sudo apt-get --purge remove pulseaudio Scan finger on UPEK TouchStrip Sensor-only █

One of the most satisfying biometric sudo moments!

Cool little terminal

My terminal emulator of choice is rxvt-unicode, also known as urxvt. Living up to its name, it has great support for Unicode in addition to being fast and lightweight. It can be daemonized, which shortens the startup time of new windows even more. Needless to say, it's very customizable via Xresources. It also comes with a bunch of optional Perl extensions.

Keyboard tips

These keyboard tips work in Xubuntu and Xfce, but could be applied to other environments, too.

Some shortcuts

Keyboard shortcuts can be added in Application Menu → Settings → Keyboard → Application Shortcuts. For example, I've set the command urxvtcd to be executed when the section (§) key is pressed. This way you can map a seldom-used key to do something more useful, in this case open a new terminal window.

I've also made it easy to copy text from XA_PRIMARY (the "mouse cursor" clipboard) to XA_CLIPBOARD (the "Ctrl+C Ctrl+V" clipboard) by adding a shortcut key of to the command /bin/sh -c "xclip -f -out | xclip -selection clipboard".

Compose key

The Compose key can also be useful. It lets you quickly input many special characters not directly present on the keymap, using simple mnemonics.

To map the Windows key to work as a Compose key, add keycode 133 = Multi_key to your ~/.Xmodmap:

~ - zsh ×
1516 windy@pentti~ ) echo keycode 133 = Multi_key >> ~/.Xmodmap 1516 windy@pentti~ ) █

Also, make Xfce read the config at startup by adding xmodmap /home/username/.Xmodmap to your Settings → Session and Startup → Application Autostart:

Some compose key sequences and the characters they produce:

Cmp + s + o§
Cmp + o + c©
Cmp + a + eæ
Cmp + - + >
Unicode input

To input an arbitrary Unicode character that you know the code point of, press Ctrl+Shift+U, then the code point in hexadecimal, and commit it with Enter or Space. Like so:

Ctrl + Shift + U
21D2   space  
221B   space  
5B97   space  
2620   space  
Over-enthusiastic Sticky keys

You can disable gdm's Sticky Keys and Slow Keys accessibility helpers by adding xkbset -a to the aforementioned Autostart list.

Done!

There you go! Make sure to choose Xfce or Xubuntu session from the greeter when you log in. And here's a screenshot of my Xubuntu session with root-tail, conky, rxvt-unicode, vim, and Firefox: