home

Archive for December, 2005

NASCAR Driving School

Thursday, December 22nd, 2005

For U.S. Micro Corp’s 10th Anniversary Christmas Party, they took us all down to the Atlanta Motor Speedway for Buck Baker’s NASCAR Driving School.

Jodi suiting up

After a quick course and some instructions, we suited up, and hopped into the passenger seat of a real NASCAR. Unbelievable. The professional drivers must have been going close to 180+ mph. The G-force effect was amazing.

So after some laps, we switched positions, and did a few laps with the professional driver in the passenger seat. And after a few laps, he hops out, leaving us behind the wheel of a 500 horsepower speed machine.

Me in the Drivers seat

I’ve done some crazy wild things in my life, but this tops the chart. Going 140+ mph around the Atlanta Motor Speedway, putting the pedal to the medal — just incredible!

I’ve got lots more photos in the NASCAR gallery. Unbelievable!

mythtv minimyth working

Sunday, December 18th, 2005

Wow. I decided to refresh my MythTV installation, and went all out. My new mythtv backend/frontend server is running on Fedora Core4 with an xfs filesystem on an LVM partition (so it can be expanded with new hard drives easily). That server was easy to redo, there were only a few minor things I wanted to change about the setup: the xfs filesystem being the main change….

The cool part, however, is my new diskless (diskless by necessity, not by choice, now) mini-itx system that sits under the bed, hooked up to a projector, and plugged into an auto-switching amp (between the whole house audio and the local source) to some nice in-wall speakers. The mini-itx system uses the MiniMyth project. Despite the frontpage’s lack of updates, inside the forums there’s an active community.

The really neat part is that this diskless myth frontend is that it is just so slick. I had to convert my main mythtv-server (the frontend/backend) to be the DHCP router (configuring DHCP to give back out my IP addresses), install TFTP, and PXE server packages, and configure the pre-built epia kernel and rootfs crammed into a little 50 MB image that boots up really daggone quick, and quite frankly, looks amazing!

I’m going to post some pictures and all my setup notes soon here. Maybe, just maybe, I might volunteer with all that extra spare time I’ve got to update the linpvr.org page — I’d love to keep up that minimyth distro — it is phenomenal!

how to setup roundcubemail on gentoo

Tuesday, December 13th, 2005

After using horde-imp mail for, well, since back in college, and squirrelmail for years — I finally decided to check out roundcubemail. It is fantastic, so far!

Fellow (and current) Georgia Techian, Paul Stamatiou has a much linked to document describing howto setup roundcube on MediaTemple and on FreeBSD. I’ll just add some shortcuts to his setup, but it is really good, and is what I glanced at before giving it a try myself.

First, I grabbed a tarball of the latest dev build:

# cd /var/www/webmail.example.com/htdocs-secure/
# wget [url_to_latest_roundcube_build_tarball]
# tar xzvf [roundcubemail_tarball].tar.gz

Then I moved it to a nicer directory (without the versioning number in the dir):

# mv roundcubemail-[version] roundcubemail
# cd roundcubemail

# mv config/db.inc.php.dist config/db.inc.php
# mv config/main.inc.php.dist config/main.inc.php

Then I edited the db.inc.php file, adding my own mysql table and user for the PEAR DSN string:

$rcmail_config['db_dsnw'] = 'mysql://user:password@localhost/roundcubemail';

I also edited the main.inc.php file to use secure IMAP on port 993 (since I don’t run unencrypted IMAP):

$rcmail_config['default_host'] = 'ssl://localhost:993';

// TCP port used for IMAP connections
$rcmail_config['default_port'] = 993;

Now to create that database (command-line style) and import the initial structure:

# mysql -u root -p
mysql> CREATE DATABASE roundcubemail;
mysql> USE mysql;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE,
DROP on roundcubemail.* TO user@localhost IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
mysql> USE roundcubemail;
mysql> SOURCE ../SQL/mysql.initial.sql
mysql> SHOW TABLES;

mysql> q

It should be all set, but to make sure it runs on the ssl for this webmail server, I simply toss a small index.php file in the normal htdocs directory:

header("Location: https://webmail.example.com/roundcubemail/");

So that when a user hits: http://webmail.example.com/ they are automatically forwarded to https://webmail.example.com/roundcubemail/.

This would be a great opportunity for me to create an ebuild and use the webapp-config tool to configure it - thus allowing me and others to be able to upgrade and instal easily — perhaps one day (or night) I will delve into this. Enjoy!

mod_rewrite voodoo

Sunday, December 11th, 2005

When they said mod_rewrite was voodoo, I didn’t believe them. Now I do.

I’ve finally come up with something decent to convert my old movable type’s permalink structure to a new one that is compatible with my static pages in the root directory, and the archives in an archive directory.

The kicker is that for each post I used to store in an archive directory, I simply do a query on the current site on just the category — I couldn’t narrow down post because they both parse postnames differently: movabletype used underscores _ , while wordpress uses - dashes.

The rule that did it in the archives directory:

# migration from seebq.com

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [S=80]
RewriteRule ^(.+)?/(.+)?$ index.php?category_name=$1 [QSA,L]

how fast is PHP PDO versus PEAR DB?

Wednesday, December 7th, 2005

I wrote a little test script to compare PHP PDO versus PEAR, and here are the results:

I’m simply doing a query to return a few rows, and discarding them.

First, using PEAR DB, opening and closing connections:

2 consecutive calls on average: 0.0582370758057 seconds
20 consecutive calls on average: 0.292555093765 seconds
200 consecutive calls on average: 2.75805211067 seconds
2000 consecutive calls on average: 25.285836935 seconds

Next, using PHP PDO, opening and closing connections:

2 consecutive calls on average: 0.0467140674591
20 consecutive calls on average: 0.274536132812 seconds
200 consecutive calls on average: 2.57240796089 seconds
2000 consecutive calls on average: 24.2841658592 seconds

I then turned PHP PDO’s persistent connection on:

2 consecutive calls on average: 0.0204339027405 seconds
20 consecutive calls on average: 0.0369820594788 seconds
200 consecutive calls on average: 0.250319957733 seconds
2000 consecutive calls on average: 2.66390395164 seconds

To be fair, I commented out the disconnect() from the PEAR library in between calls:

2 consecutive calls on average: 0.0467071533203 seconds
20 consecutive calls on average: 0.0733239650726 seconds
200 consecutive calls on average: 0.415247917175 seconds
2000 consecutive calls on average: 4.10179281235 seconds

and commented out the $dbh = null (disconnect) from the PDO Persistent calls:

2 consecutive calls on average: 0.0203170776367 seconds
20 consecutive calls on average: 0.0376739501953 seconds
200 consecutive calls on average: 0.259738922119 seconds
2000 consecutive calls on average: 2.4946231842 seconds

But in between page loads, the disconnect is always called. More testing is needed to see if persistence is achieved between page loads, but my guess is no.

try {
	$mtime = microtime();
   	$mtime = explode(" ",$mtime);
   	$mtime = $mtime[1] + $mtime[0];
   	$starttime = $mtime;

	for ($i=0; $i<1000; $i++) {
	$dbh = new PDO( 'pgsql:host=localhost;dbname=new_test',
					'postgres',
					'nopassword' );
					// PHP 5.1 specific
					// array( PDO::ATTR_PERSISTENT => true ) );
					// PHP 5.0 specific
					//array( PDO_ATTR_PERSISTENT => true ) );

	// make initial connection
	foreach ($dbh->query('SELECT * from users;') as $row) {
    	// print_r($row);
    	$bob = $row;
	}

	// close the connection
	$dbh = null;

   	// make another connection after
	$dbh = new PDO( 'pgsql:host=localhost;dbname=new_test',
					'postgres',
					'nopassword' );
					// PHP 5.1 specific
					// array( PDO::ATTR_PERSISTENT => true ) );
					// PHP 5.0 specific
					// array( PDO_ATTR_PERSISTENT => true ) );

	foreach ($dbh->query('SELECT * from users;') as $row) {
    	//print_r($row);
		$bob = $row;
	}

	$dbh = null;

	}

	$mtime = microtime();
   	$mtime = explode(" ",$mtime);
   	$mtime = $mtime[1] + $mtime[0];
   	$endtime = $mtime;
   	$totaltime = ($endtime - $starttime);
   	echo "This page was created in ".$totaltime." seconds"; 

}
catch (PDOException $e) {
	//print_r($e);
	// if cannot connect to DB, fatal DB error -
	// handle in global exception handler
	throw new DatabaseException();
}

having fun with the new server

Wednesday, December 7th, 2005

I’ve been having lots of fun with the new server — setting all kinds of automagically updating scripts and fun toys. I setup up automatic Bayesian-filter based learning of spam for all accounts on my box. See SpamAssassin Learning for more details.

I’ve also been loving gentoo’s ebuild system. I even managed to modify/create an ebuild for some software I wanted to install:

raop_play - a music file player for Apple Airport Express for Linux

Alas, now I am not bound to the Mac (or gasp, Windows) for streaming to my Airport Express.

So, now I have some music files (imported or bought from iTunes Music Store, stripped of DRM with Fairkeys, converted to mp3 with some scripts), served up over a mDNSresponding/ZeroConf iTunes Music Share, then I also serve them up over my own Shoutcast Streaming Radio Station (so I can listen anywhere), then I tune into it with my raop_play to stream it wirelessly to the Whole House Audio…. very nice.

Now, if only I could get that web front-end coded up in Ruby on Rails and served to a Nokia Wireless Handheld device (or my Siemens SX66 over wi-fi). Then I’d be set.