(Lack of) Time Warner Internet Problems

I first started having intermittent connection issues with my Time Warner Internet connection sometime in May of 2008. After dealing with a total of 15 different individuals in Time Warner Technical Support over the course of 8 months, I finally got the issue resolved on February 3rd, 2009. On February 3rd, a technician came out and replaced our modem for the second time. I’m not sure what made this change different, but our connection has behaved itself since. I posted the scripts I use to monitor my connection, reboot the modem, and parse the log file on my personal website a while back. Now that things appear to be working correctly, I decided to parse my logs and see what they show.

Jul 2008: 472
Aug 2008: 507
Sep 2008: 188
Oct 2008: 217
Nov 2008: 1084
Dec 2008: 935
Jan 2009: 348
Feb 2009: 160
Mar 2009: 144

Downtime is counted in minutes. That means that in February and March, we experienced around 5 minutes of downtime per day. Most likely these minutes were non-conservative and were not noticeable. During the worst months of November and December, we experienced more than a half hour of downtime each day. This was quite noticeable and often occurred in 3, 6, or 9 minute blocks of downtime.

The best conclusion to take away from this is that pinging a server every minute to check connection availability is not granular enough to be overly useful statistics, but it was very useful to ensure that our Internet connection did not remain down for hours at a time.

svn switch

I’ve struggled with this command for a while. It should let me change the URL of a directory in a repository, but I’ve never had any luck. It turns out it wasn’t so hard. Running “svn info” shows the current URL and that it ends in “cosc170”.

zlund@kastria:~/compilers$ svn info
Path: .
URL: svn+ssh://dakara/home/zac/repositories/marquette/cosc170
Repository Root: svn+ssh://dakara/home/zac/repositories/marquette
Repository UUID: e0bd8123-bfd5-445b-929b-77a6dd82f418
Revision: 29
Node Kind: directory
Schedule: normal
Last Changed Author: zac
Last Changed Rev: 27
Last Changed Date: 2009-01-31 15:06:57 -0600 (Sat, 31 Jan 2009)

I want to change “cosc170” to “cosc/170” because I already made this change in the repository and the URL is out of date on this working copy. Therefore, I type “svn switch” followed by the new URL and then a “.” to specify the current directory.

zlund@kastria:~/compilers$ svn switch svn+ssh://dakara/home/zac/repositories/marquette/cosc/170 .
At revision 36.

It updates the URL and the working copy. Now a “svn info” shows the correct URL and the updated revision number.

zlund@kastria:~/compilers$ svn info
Path: .
URL: svn+ssh://dakara/home/zac/repositories/marquette/cosc/170
Repository Root: svn+ssh://dakara/home/zac/repositories/marquette
Repository UUID: e0bd8123-bfd5-445b-929b-77a6dd82f418
Revision: 36
Node Kind: directory
Schedule: normal
Last Changed Author: zac
Last Changed Rev: 33
Last Changed Date: 2009-03-09 23:18:47 -0500 (Mon, 09 Mar 2009)

When the directory structure of a repository changes, it isn’t necessary to check out a new copy. The existing working copy can be updated to reflect the change to the repository.

Recording Cell Phone Voicemails

My girlfriend Clarissa asked me if it is possible to save a voicemail message that is stored by her mobile provider’s voicemail system. The short answer is no, but I figured I could do better.

Google released Google Voice which replaces GrandCentral. I went ahead and upgraded my GrandCentral account to a Google Voice account. It went smoothly, and now my Gmail account is integrated with my old GrandCentral account. I have my Google Voice account configured to ring my office phone, my mobile phone, and a Gizmo5 SIP account.

Back to saving a mobile voicemail message. Since it costs to dial out through Gizmo, I figured I could place the call through Google Voice and answer it with the Gizmo client on my laptop. Then I could use Gizmo to record the voice mail message and then send it to Clarissa. I entered her mobile number on Google Voice and hit dial. I answered it on the Gizmo client, but pressing # did not prompt me to enter her PIN to check her messages. When I tried doing the same thing on my office phone, it worked fine. After a bit of creative thinking, here is the solution that I came up with:

  1. Dial my Google Voice phone number on my office phone, and then answer the call in the Gizmo client.
  2. Start a new call on my office phone, and dial Clarissa’s mobile number.
  3. When Clarissa’s recorded greeting starts playing, hit #. When prompted for her PIN, enter her PIN.
  4. Conference the two calls together on my office phone, and mute myself on the office phone and in the Gizmo client.
  5. Hit record in the Gizmo client.
  6. When the message is done playing, hang up the conference call on my office phone, and hang up the call in the Gizmo client.
  7. Edit the recording to remove unnecessary audio from the beginning and end of the message.

There you have it, an elaborate solution to record voicemails stuck in your mobile voicemail inbox. I have been using YouMail to avoid this problem, and I plan on helping Clarissa switch to it soon.

Bad Bash Sourcing

A while back I switched such that my .bash_profile sources my .bashrc instead of the reverse. Based on a few sources, this seems to be the preferred approach. Today I decided to push those files to a few servers that haven’t been updated lately. I transferred my .bash_profile and then my .bashrc:

zac@dakara:~$ scp ~/.environment/bash/bash_profile lansky:~/.bash_profile
bash_profile                                  100%  120     0.1KB/s   00:00    
zac@dakara:~$ scp ~/.environment/bash/bashrc lansky:~/.bashrc
lost connection

What happened? My .bash_profile sources my .bashrc, but since I hadn’t yet replaced the .bashrc, it still sources my .bash_profile. That means infinite loop and that I am an idiot. SSH, rsync, and scp are all broken. There is no way to remove or replace either of those files without another account. I guess it’s time to open a support ticket at DreamHost.

The moral of the story is to always be careful how you source those files. I usually try to keep an SSH session open on the remote machine when I modify those files in case I break login, but this time I didn’t. A few searches didn’t reveal any solutions. I’d love to know if someone has a way of resolving this without access to another account on the remote machine.

Advanced Bash Completion

Ubuntu has a lot of advanced bash completion features that simplify using the shell. For example, when using the ssh command, I can tab complete server names based on my host file and my ssh config file. It turns out that most of this is accomplished with one bash_completion script. This page has a lot of useful information about the Bash shell and also the very useful script. I’ve found that when I use Fedora in the Xinu lab, I am left typing a lot of this stuff myself. Since I use the same bashrc file on both Dakara and my lab machine (Kastria), I didn’t want to always resource the file so I added this to my bashrc:

# Source global definitions
[ -f /etc/bashrc ]      && source /etc/bashrc
[ -f /etc/bash.bashrc ] && source /etc/bash.bashrc
# enable programmable completion features
if [ -z "$BASH_COMPLETION" \
    -a -r ~/.configuration/bash/bash_completion.caliban ]; then
    BASH_COMPLETION=~/.configuration/bash/bash_completion.caliban
    source $BASH_COMPLETION
fi

First, I source the global definitions, Ubuntu uses /etc/bashrc, and Fedora uses /etc/bash.bashrc. After that, if the bash_completion script was already sourced, $BASH_COMPLETION will be set. I check to see if it is zero length (-z) and then source my own copy of it if it is. Now I have advanced bash completion on both Ubuntu and Fedora.

The Typical Vim Reaction

Every now and then I feel permitted to go on a rant. It’s unfortunate because this isn’t even a particularly good rant. Why do so many of my (instant messaging) conversations with others about Vim look like this?

Chris: do you use an IDE?
Chris: and if so which one?
Zachary: um, I generally use vim:-P
Chris: gah

Vim is a great text editor. It’s a step up from Ed which is the standard text editor. I started using Vim five years ago. That was about the time that I discovered secure shell, and I started administering servers and other computers remotely. It turns out that Vim was the best text editor over a secure shell session, and since most of my machines ran Mac OS X at the time, Emacs was a terrible option. (I’m not really sure what you call Emacs on Mac OS X. You probably shouldnt’ call it Emacs.) I limped along using very basic Vim functionality over secure shell for a while. Then I discovered a useful graphical tutorial for Vim, and it became considerably more useful.

Now I use Vim because every other text editor or word processor is slower and requires the use of a mouse. (Gah!) I write most of my documents in LaTeX using Vim. I read my email in Mutt and compose emails in Vim. I use Vim almost exclusively to edit code and configuration files on my workstations and servers which works well because it does a good job of syntax highlighting and smart indentation.

A few years ago, I wouldn’t have thought I’d be using Vim exclusively, and it was somewhat by accident that I switched, but now that I am using it, I would be unable to go back.

Pasting in Vim

I find it very annoying when I paste text into a Vim, and it decides to re-tab everything and comment all lines after a comment. I decided to see if I could find a solution because “:set nosi noai” doesn’t do the trick. Stack Overflow has a solution that works very well:

<Esc> :set paste
<paste all you want>
<Esc> :set nopaste

It’s such a simple solution for a problem that has annoyed me for quite a while.

AWStats on Ubuntu Server

Since I am running this blog on my own server, I decided I should probably set up some log parsing. My personal website is hosted by Nearly Free Speech, and they provide AWStats for statistics. Another site I administer is hosted by DreamHost. DreamHost provides Analog web statistics. After playing with both, I decided to use AWStats.

Ubuntu Tutorials has provided a nice tutorial about setting up AWStats on Ubuntu. I configured my sites individually with no default site in the following files:

/etc/awstats/awstats.blog.lundscape.com.conf
/etc/awstats/awstats.claude.zacintosh.com.conf
/etc/awstats/awstats.wiki.lundscape.com.conf

This means that browsing to “http://domain.tld/awstats/awstats.pl” as they suggest won’t work. Instead, I append the site to the end of the string like this: “http://domain.tld/awstats/awstats.pl?config=blog.lundscape.com”.

Also, rather than adding entries to my crontab, I simply added a script to my “/etc/cron.hourly”:

#! /bin/bash

/usr/lib/cgi-bin/awstats.pl -config=blog.lundscape.com \
	-update > /dev/null 2>&1
/usr/lib/cgi-bin/awstats.pl -config=claude.zacintosh.com \
	-update > /dev/null 2>&1
/usr/lib/cgi-bin/awstats.pl -config=wiki.lundscape.com \
	-update > /dev/null 2>&1

This automatically updates my AWStats every hour whether I view my statistics in a web browser or not.

Install Flash on Mac OS X from the command line

My mother needed the latest version of Flash to view a web page. I decided this was a good opportunity to install the package from the command line over secure shell. She has a PowerMac G4 running Mac OS X 10.4. It turns out that the update didn’t work, but I relearned a bit about some useful command line tools for Mac OS X. I always start in the temp directory. Then I downloaded the installer and unzipped it. That’s all pretty straightforward.

cd /tmp/
curl -O http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_osx_ub.dmg.zip
unzip install_flash_player_osx_ub.dmg.zip

Next, I used “hdiutil” to mount the disk image and then changed to that directory.

hdiutil attach Install\ Flash\ Player\ 10\ UB.dmg
cd /Volumes/Install\ Flash\ Player\ 10\ UB/

Then I used “installer” to install the package specifying the package with “-pkg Adobe\ Flash\ Player.pkg” and the target volume with “-target /”.

installer -verbose -pkg Adobe\ Flash\ Player.pkg -target /

It will run through the installation and output some information. After that, I changed back to the temp directory. I initially tried using “umount” to unmount the disk image, but that is a bad idea because it doesn’t fully unmount the image. The better approach is to use the “hdiutil” again. I find the volume to unmount by using the “df” command. Once it is unmounted, I deleted the zip file and the disk image.

cd /tmp/
hdiutil detach $(df | grep Flash | awk '{print $1}')
rm install_flash_player_osx_ub.dmg.zip
rm Install\ Flash\ Player\ 10\ UB.dmg

Most applications for Mac OS X come in disk images, and many of those have package installers. This is a quick way to install software on a remote Macintosh or a way to automate installations with scripts.

Grub Boot Issues

A while back, I updated one of my servers (Abydos) from Ubuntu 8.0.4 Server to Ubuntu 8.10 Server. That process was pretty easy, but when I rebooted, it failed to boot. I simply selected another kernel version from the boot menu and forgot about it. Then Ben ran into the same issue when he updated his desktop (Loki). I decided to learn a little bit about Grub.

It turns out that fixing the problem is pretty simple. The file to change is /boot/grub/menu.lst, and it contains a default line:

default         0

and a bunch of title lines:

title           Ubuntu 8.10, kernel 2.6.27-9-generic
title           Ubuntu 8.10, kernel 2.6.27-9-generic (recovery mode)
title           Ubuntu 8.10, kernel 2.6.24-19-generic
title           Ubuntu 8.10, kernel 2.6.24-19-generic (recovery mode)
title           Ubuntu 8.10, memtest86+

Grub uses zero based indexing, so I changed default from 0 to 2. It’s as simple as that.