Wednesday, February 28, 2007

Google Traffic

No, I'm not talking about web traffic. It's real automobile traffic. Google maps now shows traffic conditions, and sure enough, eastbound Highway 26 is slow (and I dare you to find a time when it's not!).

Tuesday, February 27, 2007

Best Little Emacs Tutorial Ever

I discovered Steve Yegge's long essays and blog posts a while ago. I think it was his Effective Emacs post that I first came across actually, but he's written a whole bunch of interesting geeky stuff. So interesting that I find myself telling my wife about it. So interesting that, even through my pathetic retelling, it actually interests my wife (a little), who isn't even a computery geeky person. I wish I wrote stuff half that interesting. Go check his blog out, because it's just so interesting. Have I mentioned it's interesting? So anyway, I was inspired to write, and publicly thank him for his recent little emacs tutorial. Very educational and entertaining. What more could you want? It just so happens that I'm in the middle of a repetitive editing task, using emacs, of course, and I took a break for lunch and read this tutorial and was inspired to write some interactive lisp functions to make it easier. It took about 30 seconds (after, I don't know, 20 minutes of interesting reading, but that doesn't count). I love it!

Monday, February 26, 2007

Dynamic DNS and ddclient

This was originally posted on my family blog on 4/21/06. I will be slowly moving the geeky stuff from there to this blog.

Because I've been too cheap to pay for a real domain name, or a static IP address, I've been using the wonderful free services of DynDNS.org to bring you this family website. I use ddclient to keep DynDNS updated, but somehow I messed it up last night when configuring it for Ubuntu, and the family website has been unavailable all day. I know, your world had ended without it. I'm sorry! I've learned something from this though, and here are my new ddclient tips.

If your webserver is behind a router, like mine, then you need to have ddclient visit a webpage to get the router's IP address. To make ddclient do this, it's configuration file needs to have this line in it:

use=web, web=checkip.dyndns.org/, web-skip='IP Address' 

My mistake was that I also had the normal 'use' line in the config file, after that one:

use=if, if=eth1

so ddclient was using the IP address reported by my ethernet card, my local network IP. None of you have access to that one though :-/. To debug ddclient, you can run it from the command line as root with the verbose output enabled like so:

ddclient -daemon=0 -debug -verbose -noquiet

That gives you a pretty good idea of what it's doing and how you can fix it. At least, that's all I needed this evening.

Saturday, February 24, 2007

Subversion Network Setup

This was originally posted on my family blog on 4/20/06. I will be slowly moving the geeky stuff from there to this blog.

In a previous entry I explained how I set up subversion on my linux box. At the end I left a reminder to myself to write down how to set up network access to the repositories before I forgot. Well, I forgot, and now that I'm migrating everything over to Ubuntu 5.10, it's time to re-learn. Here's my notes on how to do it.

I will again be using the subversion book. Specifically chapter 6. I also got help this time around from a blog entry about setting up subversion with apache on Ubuntu.

Alright, under Prerequisites in the svn book it lists what you need to install. These are all easily obtainable through apt (since I'm on Ubuntu):

aptitude install libapache2-svn

(I already had apache2 and subversion installed. I'm assuming the above would have grabbed those too though, if they weren't already installed, because apt is cool like that).

The above will install the modules needed for apache2 and add all the needed LoadModule commands. It also creates a configuration file in /etc/apache2/mods_benabled/dav_svn.conf. I commented out everything that was in this since I want my subversion repository served by one of my virtual hosts. Wherever you put it, you need something like this:

<Location /repos>
    DAV svn
    SVNPath /path/to/svnrepository

    # how to authenticate a user
    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile /path/to/svnrepository/svn-auth-file
    Require valid-user
</Location>

Then do:

/etc/init.d/apache2 reload

Now you need to setup the http authentication password file. The book explains it well:

$ ### First time: use -c to create the file
$ ### Use -m to use MD5 encryption of the password, which is more secure
$ htpasswd -cm /path/to/svn-auth-file harry
New password: ***** 
Re-type new password: *****
Adding password for user harry
$ htpasswd -m /path/to/svn-auth-file sally
New password: *******
Re-type new password: *******
Adding password for user sally

At this point you should be able to browse the svn repository, after entering your username and password, by pointing your web browser to http://www.example.com/repos/project/ (assuming your hostname is www.example.com, of course). You should also be able to checkout code, like so:

svn co http://www.example.com/repos/project/trunk/ project

That's it!

Wednesday, February 21, 2007

Migration from Mandriva to Ubuntu

This was originally posted on my family blog on 4/17/06. I will be slowly moving the geeky stuff from there to this blog.

The promise of easy OS upgrades with Ubuntu has lured me to make the switch. It was a pain to upgrade Mandrake versions last time I did it. People always talk about how easy it is with Debian/Ubuntu. I've been pretty impressed with the online help for Ubuntu too, way better than I've seen for any other Linux distribution. So I'm making the painful switch. If you see the website not working, you now know why. I've realized, more than halfway through this, that it was much easier to upgrade from one version of Mandriva to the next than it is to go from Mandriva to Ubuntu. Package names and configuration file locations and defaults are all just different enough to make it a very manual process. How sweet it will be go upgrade from Ubuntu Breezy Badger to Ubuntu Dapper Drake with a few apt commands (and it better work!!!!)!

Here's a few web pages that have helped me out so far:

Tuesday, February 20, 2007

Dump for Backups

This was originally posted on my family blog on 4/10/06. I will be slowly moving the geeky stuff from there to this blog.

Not willing to wait any longer (two whole days already!?!) for a fixed mondo rpm, I tried to compile it myself. No luck, make complained about no target for the man pages or something. So in the meantime, I'm looking at good ol' dump. It looks kind of handy, and I think I could get it to almost do what mondo promises with a little scripting. It wants to backup whole filesystems. It will do a sub-directory, but if you do that it won't do differentials. You can have it exclude files and directories, but you have to supply it the inode numbers of what you want it to exclude. Apparently a simple file or directory name isn't good enough for dump, you have to use stat yourself. Also, it won't split the backup file up like mondo, unless it runs out of tape. That means that if you are backing up to CDs, you'd have to manually use split and mkisofs to get ready to burn.

Here is the test backup command I'm running right now (bzipping with level 9 is very slow on my box, remind me not to do that again):

dump -j9 -0af /mnt/home/backup2/dump-test /home/bryan/Documents

OK, finally finished. It's simple to restore stuff:

restore -ia -f /mnt/home/backup2/dump-test

It starts a little shell, you can use 'cd' and 'ls' to see what's been backed up. You then use 'add' to add files to the extraction list. An 'ls' will then put a star next to the files and directories to be extracted. When you are all ready type 'extract' and it extracts to the directory you were in when you typed the above command. Then 'q' to quit. Not bad.

Friday, February 16, 2007

Mondo Bug

This was originally posted on my family blog on 4/8/06. I will be slowly moving the geeky stuff from there to this blog.

I finally got to where I'm confident mondo is going to work for my backup needs, and I got the command-line that I want all figured out to backup just the stuff I need. Here it is, for posterity's sake:

 mondoarchive -O -i -I "/home /etc" -d '/mnt/home/backup2' -E '/home/pub /home/bryan/.mozilla/firefox/6ytxpczd.default/Cache /home/bryan/backgrounds /home/bryan/downloads /home/bryan/glazba /home/bryan/roms /home/bryan/src /home/bryan/tmp /home/bryan/video /home/bryan/vmware/Browser-Appliance /home/bryan/vmware/test' -g -s '700m'

The '-I' option I'm using is straight from the mondoarchive man page. However, mondo gives this error message when I try the above:

Fatal error... ERROR ! You specified a directory to include which doesn't exist
---FATALERROR--- ERROR ! You specified a directory to include which doesn't exist

Huh!?! I tried various and sundry other combinations and coulnd't get it to work. I finally glanced over at the mailing list archives and found that, just today, this was identified as a bug. At least I know I'm not going insane. Bruno (a fellow HPer, by the way) says the fix is in svn, but I think I'll wait until someone builds some rpms for me.

Thursday, February 15, 2007

Blogger Missing Features

I discovered two missing features from blogger today. Things that shouldn't be that hard for them to do. First, if you put a future date on a post, it still shows up on your blog as soon as you click "PUBLISH," not in the future. Lame. Second, when you click "PUBLISH" it creates a permalink for the post out of the title you've entered. That's nice, except that if you realize you made a mistake and change the title, the permalink can't be changed to match. You would have to delete the post entirely and re-create it. Lame. My simple family blog that I wrote in Django made it simple to do these things with the automatic admin interface. I was hoping blogger would be a step up, and it is in a lot of ways, but I miss those features.

A Differential Backup with Mondo

This was originally posted on my family blog on 4/7/06. I will be slowly moving the geeky stuff from there to this blog.

I broke out the mondo man page. To verify my little backup, and see what has changed since I made it, I ran this:

mondoarchive -V -i -I "/home/bryan/Documents" -d '/mnt/home/backup3' -g -s '700m'

I had made a little change in a text file, and it flagged it and told me. I just noticed that it says the -I switch is ignored if you are just verifying. Oh well.

Now, to do the actual differential backup I ran this command:

mondoarchive -O -i -D -I "/home/bryan/Documents" -d '/mnt/home/backup3' -g -s '700m'

For backing up one little text file it still took a while because it seemed to re-generate the boot disk. I think I saw an option in the manual to not do that, but it was highly recommended that you don't use that option. Anyway, looking at the backup directory, it seems to have overwritten the full backup iso with the differential. The restore only restores the changed file (and some empty directories, hmm). So, don't save the differential in the same place as the original? How do I tell it which is the orignial backup to start from when doing the differential then?

OK, a little digging around and I discovered some emails that explain how the differential backups are done: Mondo Differential backup, Mondo Differential/Incremental BU?, and this one helped a bit too, Mondo Differential backups on two different sets. Basically, the file list and timestamp of the last backup is stored in /var/cache/mondo-archive/, so you can specify any destination you want and it knows what to base the differential off of. I still need to try this, but my 2 year old is pulling on my away at the moment.

Monday, February 12, 2007

A Small Backup with Mondo

This was originally posted on my family blog on 4/6/06. I will be slowly moving the geeky stuff from there to this blog.

I tried backing up just the Documents directory in my home directory with mondo. It went much much faster, of course, but at the end it wouldn't restore. Weird. So I tried again and used less compression this time. It gave a strange error message at the end:

Boot+data floppy creation failed. However, FYI, you may burn /root/images/mindi/mondorescue.iso to a CD and boot from that instead if you wish.

But the restore still worked fine. I think I got the same error the first time too. The differences the second time were, I used the default iso file name of mondorescue, and I used minimum compression. Why didn't the boot disk creation work? Maybe it couldn't make the boot disk because I didn't back up anything under /. Who knows.

I guess if I stick with mondo I'll have to double check each backup and make sure it works.

I just ran the exact same mondoarchive again, hoping it'd be smart and do a differential, but it doesn't seem to be. I guess I'll have to break out the man page and use the command-line for that one.

Saturday, February 10, 2007

Home Backup with Mondo Rescue

This was originally posted on my family blog on 4/5/06. I will be slowly moving the geeky stuff from there to this blog.

I'm playing with Mondo Rescue for backing up my hard drive. Here are some quick notes of the experience so far.

I ran a basic mondoarchive "gui" session, and accepted all defaults, except that I excluded /mnt from the backup. It asked for a max iso size, I didn't ever plan to burn these to anything, but I put in 700 MB because I didn't know what else to do. I backed up to hard drive (the unused hd on my system). It spent about 13 hours working, created 50 isos and then quit. I didn't see it quit, and from the log it looks like it gave up with the message "too many isos." No kidding.

Now I'm attempting to restore a single file. I typed mondorestore. The "gui" started up and told me to insert the boot disk. I just hit enter and it went to a menu asking what to restore from. I chose harddrive. It asked for the path to my isos. I gave it the path and it took off and after some work it showed me a file list from which I could select what I wanted to restore. I dug down and selected a single rpm file from my downloads directory (something that never should have been backed up, but oh well). It then asked me where to restore to, so I gave it a path on the (previously) unused hard drive. It's now chugging through all 50 isos looking for the file, telling me, "This may take some time." No kidding! OK, I was watching and it finished with an error in the middle of trying to do something with my large files:

# mondorestore
---FATALERROR--- Mommy!

However, it did restore the one file I asked it to!

I'm feeling pretty darn good about mondo at this point. It seems super easy to use, and does what I want. I think I'll be able to skip backing up some key directories, such as my music, and get a manageable set of stuff so it won't have to create too many isos and have these problems.

Things to try just to be sure:

  • Only back up some stuff on my hard drive (try to get way fewer isos).
  • Make sure the restore from the smaller backup works.
  • Try out the differential backup feature.

Friday, February 9, 2007

How To Fix alt-b in Newer gnome-terminal

This was originally posted on my family blog on 3/29/06. I will be slowly moving the geeky stuff from there to this blog.

In my newest Ubuntu install, alt-b no longer moves the cursor back a word. It opens a menu. That's really obnoxious. Fortunately you can fix it:

Note: To use the Alt-F and Alt-B shortcuts in GNOME terminal, you need to disable its keyboardshortcuts. To disable them, select Edit -> Keyboard Shortcuts... from the menu and check both disable boxes.[source]

Ahh. Much better.

Thursday, February 8, 2007

Nice Fonts for Emacs

This was originally posted on my family blog on 12/18/06. I will be slowly moving the geeky stuff from there to this blog.

If you use emacs on windows you have seen how nice it can look, especially if you used the cool windows emacs installer (go with the patched version). Today the emacs wiki lead me down the path of nice looking fonts on Linux. I added these lines to my /etc/apt/sources.list:

deb http://debs.peadrop.com edgy backports
deb-src http://debs.peadrop.com edgy backports

Then I imported the gpg key:

wget http://debs.peadrop.com/DD385D79.gpg -O- | sudo apt-key add -

And then installed emacs-snapshot-gtk1:

sudo aptitude update
sudo aptitude install emacs-snapshot-gtk

Then I changed my default-font, like so:

(set-default-font "Bitstream Vera Sans Mono-12")

And now I start emacs like so:

emacs-snapshot-gtk --enable-font-backend

Wow, it looks really good. This gets you a pretty recent build from the emacs cvs repository, so there are some bugs. I’ve seen ediff really wig out, but overall it hasn’t been bad at all.

Footnotes

1 I was already running emacs-snapshot-gtk actually, so I only had to do an aptitude upgrade after the update.

References:

http://g33k.wordpress.com/2006/11/06/gnu-emacs-with-xft-goodness/
http://debs.peadrop.com/dists/edgy/backports/

Emacs URL Package

I just noticed this on the emacs wiki: the URL package. If you are using emacs from cvs you can M-x load-library RET url, and then open a url just like you would any file, c-x c-f http://bryan-murdock.blogspot.com , and get a buffer full of html. How cool is that?

Wednesday, February 7, 2007

Focus Follows Mouse on Windows

This was originally posted on my family blog on 3/13/06. I will be slowly moving the geeky stuff from there to this blog.

More on making my windoze box work like my linux box. Focus follows mouse, copy to clipboard by only highlighting, pasting with the middle button, and sinking windows to the bottom of the pile with a right-click, all with the True X-Mouse Gizmo. It's very nice. The only downside is that if you want to change the default settings it takes a registry hack. Since my new standard issue work laptop doesn't have a middle mouse button I'll need to do this.

Dang, if all these tweaks work well enough maybe I won't have enough motivation to install linux on this thing...nah, I'm sure I still will!

Virtual Desktops on Windows

This was originally posted on my family blog on 3/13/06. I will be slowly moving the geeky stuff from there to this blog.

I love multiple virtual desktops. I have to work on windoze sometimes at work, which doesn't have virtual desktops, but I found Virtual Dimension, and it rocks!

Tuesday, February 6, 2007

Root Partition Full

This was originally posted on my family blog on 3/11/06. I will be slowly moving the geeky stuff from there to this blog.

If you've tried to access the website in the past few days you haven't been able to. I'm sorry. This will be way too much information for many of you, but so I don't forget I'll write down just what happened and how I fixed it. For the less interested, just know that I'm on top of it, and that the system is back up. Yay!

Here is the sequence of events that lead to this, as far as I can re-create them. First, I don't remember how long ago, but I installed Mandriva Linux on this machine. I probably had it automatically partition the hard drive, probably for a desktop setup. This created a root partition and a /home partition. It made the root partition about 6 GB, and all the rest of the hard drive went for /home. I put a second network card in the machine and set it up as a router for my home network. I configured samba to serve files on the network card that the home network was on, eth0. Since then I have installed the postgresql database, which by default keeps all its data in /var/lib. Also, a goodly amount of log files have accumulated. I don't know how much space this was all using before, but I made a change that started using a whole lot more recently, and not on purpose. I bought a linksys router, so I disabled eth0 on this machine. This caused samba, actually nmbd, to write lots of error messages to about 4 or 5 different log files: /var/log/messages, /var/log/syslog, /var/log/daemons/warnings, /var/log/daemons/errors, and I think /var/log/mail/warnings too, all saying it couldn't find eth0. All of these log files had grown into the hundreds of megabytes range in size. Finally, my wife saw the whole machine crash when she tried to open a rather large attachment in gmail. Firefox probably saved it to /tmp, which became the straw that broke the camel's back. Of course this happened shortly after I left town for a few days, hence it didn't get fixed until today. Ahh computers, you gotta love 'em. At least with Linux it's easy to figure exactly what when wrong like this.

Needless to say, I reconfigured samba, deleted some log files, and for good measure I removed a whole bunch of cached rpms. My root partition has 2 GB free now. I hope that lasts until I can figure out how to non-destructively resize ext3 partitions!

Monday, February 5, 2007

Swap ctrl and caps

This was originally posted on my family blog on 2/6/06. I will be slowly moving the geeky stuff from there to this blog.

I really like having the Ctrl and Caps Lock keys swapped on my keyboard. It makes using emacs just that much better. In the past, on my Linux boxes, I've had to write a little xmodmap script to do it. I just learned that Gnome now has an option to do this in the Keyboard Preferences dialog under Layout Options, Control Key Position. Sweet. And who says Gnome isn't for power users?

For windoze I usually find a regedit script with google, such as this one.

Saturday, February 3, 2007

Subversion Setup

This was originally posted on my family blog on 2/2/06. I will be slowly moving the geeky stuff from there to this blog.

No, I'm not talking about how to overthrow the government. This is how I set up subversion repositories on my Linux box. I got most of this form the subversion book. I'll try to link to the specific parts of the book where each part came from.

First, create the repository using fsfs for the database, because I heard it's way cooler than Berkeley db. Seriously (no really, I wish I had a better reason, I read something that I found on Google somewhere that it was).

svnadmin create --fs-type fsfs /path/to/repos/project

Next, set up the project directory tree to be imported. I'm using what seems to be the standard setup with trunk, branches, and tags sub-directories, as somewhat explained in the section on using branches in the svn book.

mkdir project
mkdir project/tags project/branches project/trunk
cp -r /path/to/work/in/progress/* project/trunk/

Lately it's a python project I'm putting into subversion so I remove the .pyc files, they don't go under revision control so one more step:

find project/ -name "*.pyc" | xargs rm

Now import it:

svn import project file:///path/to/repos/project -m "initial import"

See that it worked:

svn list file:///path/to/repos/project

To really make sure it worked, check out the project somewhere else:

cd /tmp
svn checkout file:///path/to/repos/project/trunk project

And that's it, as long as you only want local access. I've set up network access through Apache and I need to write that up too (before I totally forget).

Welcome

I've created this blog as a place to post my learnings and discoveries of all things technical (AKA, geeky). I did this so family and friends reading my other website could enjoy the family news and pictures of their grandsons/nephews without having to endure my latest Emacs epiphanies, Python ponderings, or Ubuntu undulations. Just to make things clear, if you read this blog you will see acronyms, configuration files, and even source code. I must warn you of this ahead of time lest I be accused of technical harassment. Viewer discretion is advised. You have been warned.