Wednesday, November 15, 2006

Comparing files across servers

From Linux Journal:

Here's an idea. Every once in a while you need to compare a bunch of files between two machines (e.g. when you have a directory replicated between two servers).

Here's a quick and easy way to do it (all commands running on machine2 as user1):

[user1@machine2]$ cd /home/user1/src
[user1@machine2]$ ssh user1@machine1 "cd src; find . -type f -exec md5sum {} \;" | md5sum --check | grep -v "OK"

Basically, we are ssh-ing into the secondary machine, creating a list of files and running md5 on them, and then using that list as input for the local directory. Clearly, you can change the find parameters for specific files, and also add gzip in the pipe if the list is very long or the connection is slow.

Monday, October 30, 2006

Configuring subversion on FC5

Well, I just spent hours trying to figure out why I couldn't get subversion to work. I followed all of the instructions to the letter, etc. Well, it turns out that the instructions I was following had a typo. I was using the SVNPath apache directive instead of the SVNParentPath directive.

Anyway, my FC5 installation already had apache2, mod_dav, and subversion installed, but it didn't have mod_dav_svn. So I installed it:

yum install mod_dav_svn

This automatically added the and files to /etc/httpd/modules. It also added /etc/httpd/conf.d/subversion.conf, which included these directives:

LoadModule dav_svn_module modules/
LoadModule authz_svn_module modules/

Had I just used the sample from that file, it probably would have just worked since it had SVNParentPath in it. But instead, I added the following to my virtualhost:
      <location /svn>
DAV svn
SVNPath /absolute/path/to/repository
This was taken directly from the "Installing Subversion" HowTo guide listed on the subversion documentation site. Here is the link:

I created the repository:

su - username
cd /home/username
mkdir svn
cd svn
svnadmin create reponame
chown -R apache.apache reponame

Now, testing things out by going to caused the following error:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<d:error> </d:error>
<c:error> </c:error>
<m:human-readable errcode="2"> </m:human-readable>
Could not open the requested SVN filesystem

Once I changed the directives to the following, it worked:
      <location /svn>
DAV svn
SVNParentPath /absolute/path/to/repository
Before using SVNParentPath, I would get the following error using "svn co":

svn: PROPFIND request failed on '/svn'
Could not open the requested SVN filesystem

Now when I execute the following:

svn co test

It responds that it checkout revision 0. Yay!

I think that I could have got SVNPath to work too, but I would have had to run the svnadmin create on that directory, not a subdirectory. Maybe I just needed to follow the directions better. Regardless, the SVNParentPath is the command that I really want since I want multiple repositories in that directory without having to configure multiple Location directives in Apache.

Friday, October 06, 2006

Rebuilding RAID array

One of my servers had a problem with its software raid array. As always, I check /proc/mdstat to see if there are any issues. In the past, if there has been a problem, all of the RAID partitions show a problem. But this time, only one partition had a problem:

[root@sapphire]# more /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md0 : active raid1 sdb1[1] sda1[0]
1260992 blocks [2/2] [UU]

md1 : active raid1 sdb5[1]
3759104 blocks [2/1] [_U]

md2 : active raid1 sdb6[1] sda6[0]
3759104 blocks [2/2] [UU]

md3 : active raid1 sdb8[1] sda8[0]
25454848 blocks [2/2] [UU]

unused devices:

As you can see, md1 only has one drive in the mirrored array. Instead of both sda5 and sdb5, only sdb5 is active. If the array was working properly, the indicator would show [UU] and not [_U].

After some googling, I found that I needed to rebuild the dirty disk with the following command:

raidhotadd /dev/md1 /dev/sda5

This says to add the kicked out /dev/sda5 disk to the /dev/md1 array. It rebuilds the dirty array disk from the main array disk. While it is running, you can see its progress by looking at mdstat:

[root@sapphire]# more /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md0 : active raid1 sdb1[1] sda1[0]
1260992 blocks [2/2] [UU]

md1 : active raid1 sda5[2] sdb5[1]
3759104 blocks [2/1] [_U]
[=>...................] recovery = 7.9% (300080/3759104) finish=5.5min s
md2 : active raid1 sdb6[1] sda6[0]
3759104 blocks [2/2] [UU]

md3 : active raid1 sdb8[1] sda8[0]
25454848 blocks [2/2] [UU]

unused devices:

When it completed, it looked like this:

[root@sapphire zones]# more /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md0 : active raid1 sdb1[1] sda1[0]
1260992 blocks [2/2] [UU]

md1 : active raid1 sda5[0] sdb5[1]
3759104 blocks [2/2] [UU]

md2 : active raid1 sdb6[1] sda6[0]
3759104 blocks [2/2] [UU]

md3 : active raid1 sdb8[1] sda8[0]
25454848 blocks [2/2] [UU]

unused devices:

Now all partitions are functioning properly again.

Thanks to for details on doing this.

Thursday, October 05, 2006

Howto modifiy apache httpd suexec docroot

What if you don't want all of your web documents to be located in /var/www? That isn't too much of a problem with apache. Just point to another directory as the DocumentRoot setting.

But what if you also want CGI scripts to be located somewhere else? This poses a problem. The CGI wrapper that comes with FC5 httpd RPM is configured to only allow CGI scripts in /var/www. To fix this, it is necessary to rebuild the httpd RPM from source after making a couple changes.

To get started, you should be logged into your system via SSH and sitting in your home directory. Do not be logged in as root at this time. Your account needs to be set up to build RPMs from source. Do the following:

% echo "%_topdir /src/rpm" >> ~/.rpmmacros
% mkdir -p ~/src/rpm/
% cd ~/src/rpm

Now, you need to download the latest httpd source RPM (SRPM) from Fedora. For me, I'm using Fedora Core 5 and there have been some updates to the httpd RPM since FC5 came out. So I'll use the latest SRPM version from the Download/Updates section of the site:

The latest version at the time of this writing was httpd-2.2.2-1.2.src.rpm. Use wget at the command line to download this file and then install it:

% cd ~
% wget
% rpm -ivh ~/httpd-2.2.2-1.2.src.rpm

This will put the source tarball and patches in ~/src/rpm/SOURCES and a specfile (instructions for building) in ~/src/rpm/SPECS. You now need to edit the specfile with a custom release number, altering the suexec docroot, and adding some comments to the changelog:

% vi ~/src/rpm/SPECS/httpd.spec

Change line 10 from:
Release: 1.2

Release: 1.3

Change line 194 from:
Change line 484 to:
* Thu Oct 05 2006 Your Name <you@yours> 2.2.2-1.3
- Rebuilt with suexec-docroot set to /home instead of %{contentdir}

Next, you will rebuild httpd, creating both a binary RPM and a source SRPM:

% rpmbuild -ba ~/src/rpm/SPECS/httpd.spec

You may have to install some additional packages to satisfy build dependencies here. You'll need to be root to do this or use sudo. Just use yum for it will be easiest. When it's done, you'll have binary packages in ~/src/rpm/RPMS/i386/, and a new source package with your modified specfile in ~/src/rpm/SRPMS/.

You can now either upgrade to the httpd you just compiled... To install, do the following. Make sure to include httpd-devel if you are going to build custom apache modules such as Tomcat mod_jk or Caucho mod_caucho. You will need /usr/sbin/apxs that is included in it.

% cd ~/src/rpm/RPMS/i386
% sudo rpm -Fvh httpd-2.2.2-1.3.i386.rpm httpd-manual-2.2.2-1.3.i386.rpm httpd-devel-2.2.2-1.3.i386.rpm mod_ssl-2.2.2-1.3.i386.rpm

OR simply extract the suexec binary and copy it over the original one (this may work if there are no updates to mod_ssl in the newer RPMs you have installed):

% rpm2cpio ~/src/rpm/RPMS/i386/httpd-2.2.2-1.3.i386.rpm | cpio -imVd ./usr/sbin/suexec
% sudo cp -p /usr/sbin/suexec /usr/sbin/suexec.orig
% sudo cp ./usr/sbin/suexec /usr/sbin/suexec
% sudo chown root:apache /usr/sbin/suexec
% sudo chmod 4510 /usr/sbin/suexec

Lastly, you need to make sure the permissions are set right for the directory with the cgi scripts. The directory cannot be writable by anyone but the user. This means it should be set to 744.

If you run into errors, check:

Perfect FC5 Server Setup?

This article does a good job of detailing the basics needed to setup a FC5 server:

For my needs, I have a lot of other things to add as well. But this is a good starting point.

Also, I hadn't heard of ISPConfig yet. Its an open source web based control panel. I'm definitely going to check it out. Need to find out if it is just for server administrators, or if users can use it too.

Wednesday, October 04, 2006

Interesting AJAX blog

Fedora Core Unofficial FAQ

Found an unofficial FAQ for Fedora Core. It has some useful information, but mostly beginner stuff. However, it does refer to some RPM repositories that could be useful.

Wednesday, August 09, 2006


Well, since I seem to be stuck in this dilema of sticking with Java or switching to Ruby, news of JRuby successfully running Ruby on Rails is enticing. Would be nice to stick with Java but be able to benefit from using Ruby as well... It sounds like the next release (0.9.1) will be the one to test out.

Tuesday, August 08, 2006

Java IDE

I've been using Eclipse for a while now for Java development. I've even used it for C++ and Perl development via plugins. But I'm now considering stepping up to MyEclipse 5.0 and paying the $30 or $50 per year for all the added features. Did a little research and overall it sounds like people really like MyEclipse. It sounds like NetBeans is pretty good too, but I'm already used to Eclipse. And IntelliJ IDEA got good ratings as well, but it is a lot more expensive.

So, I plan to spend a bit more time seeing what is possible with just plain Eclipse and additional plugins such as the Eclipse Web Tools Platform (WTP). I don't think it will reach the level of MyEclipse, but it might suit my needs. Hmmm, I wonder if there is a Ruby plugin for Eclipse.

Also, it seems like AppFuse might be very useful. I believe it has Eclipse integration. Need to find out for sure. Also, see if there is any MyEclipse integration for it.

Friday, July 28, 2006

Aptana - Javascript focused IDE

Aptana is a robust, JavaScript-focused IDE for building dynamic web applications. Highlights include the following features:
  • Code Assist on JavaScript, HTML, and CSS languages, including your own JavaScript functions
  • Outliner that gives a snapshot view of your JavaScript, HTML, and CSS code structure
  • Error and warning notification for your code
  • Support for Aptana UI customization and extensions
  • Cross-platform support
  • Free and open source. (Source available soon)

Why Blog?

I read this article recently and it renewed my desire to blog more regularly. It is a good write up on the reasons that people should write blogs and it counters all of the objections that people normally have about doing it.

Cleaning up your CSS

Two things related to cleaner CSS:

First, a great suggestion on how to better organize your CSS files. The idea is to use indentation in your CSS files to make it cleaner to look at and easier to find elements. Just like you would indent source code, you indent your CSS. Very good idea, and I can't believe I haven't thought of it!

Secondly, we all know there are times when CSS browser hacks are necessary. But they always make CSS files look so nasty. And it is often difficult to remember what each hack needs to be formatted like. Using the CSS Browser Selector JS library, it becomes easy to add browser hacks into your CSS files without making them messy or having to remember how to format them.

Choosing a web application framework

I really need to find a good web app framework. Something that doesn't force me to do lots of extra stuff, configuration, and so forth. Something that is easy and quick to get up to speed in and that I don't have to jump through hoops to get working. And, something that has strong AJAX support.

Well, I'm finding this holy grail is either hard to find, or doesn't yet exist. I haven't tried out any platforms yet, still just researching, so I could be wrong. But from the googling I've done, nobody seems to be able to agree on any given framework. They each have pluses and minuses. At the moment, I'm seriously considering changing to Ruby after years of Java.

I've built lots of custom DHTML widgets in the past, and it was refreshing to look through the ZK Demos. I just may use this toolkit in the future.

Following are several resources I found useful, in no particular order of preference:

OnJava - What Web Application Framework should you use?

Raible Designs - Response to OnJava article
Stripes - Java Web App Framework
Click - Examples of Click Framework

ThinWire - AJAX Framework
Try Ruby - Interactive Ruby Demo

TheServerSide - Discussion of AJAX products
ZK - AJAX Framework
Quick Tour of Ruby
Roundup of 30 AJAX tutorials

CrazyBob - Discussion of Google Web Toolkit (GWT) vs. JSF
AJAX Patterns
JBoss Seam - Web 2.0 Application Framework

What is going to replace Struts in an AJAX world?

I'll post more resources as I find them...

Tuesday, July 25, 2006

FC5 software installers and updaters

My workbench mouse sucks bad, so bad that I don't even want to use it. I really need to remember to buy a new mouse sometime. As I configure new machines at my workbench, I've found it very frustrating to interact with the machines. So, in the meantime, I've started to use X Windows from my Windows XP machine to interact with the GUI apps on my FC5 systems. See a previous post about configuring XMing.

Anyway, I've found that the GUI software update program is called pup and the package explorer is called pirut. So instead of running them at the machine, I can open an xterm using XMing and then enter "pup &" or "pirut &" and work with the programs from my regular workstation.

XMing -- X Windows for Windows XP

Just installed and started to use XMing and XLaunch. Am able to connect to a single server, but can't seem to get it connecting to multiple servers at the same time. Will deal with it later. The following link proved useful for configuring XLaunch and getting PuTTY working with it:

Fedora Core 5 networking

Argh... I just wasted lots of time trying to figure out why a new FC5 installation was able to see the local network but not access anything past my router. As it turns out, all I needed to do was add the following to /etc/sysconfig/network and restart the network:


I have another FC5 machine here that wasn't having any problems and it didn't have this line in its network file. However, it had DHCP setup instead of a manual IP. Next time I'll know...

Friday, July 21, 2006

Purchased today

With all the domains such as and and so forth, I started looking for something that would interest me. I came up with since I can use it for all of the following:

Perhaps I'll make one of these the domain for my blog if I start actually blogging more often.

Caucho server problems

The caucho server went down last night. Argh. Couldn't access it remotely, so went to the colo. Still couldn't get onto it, and rebooting didn't help. Looked like the drives had failed or the SCSI controller was bad. Took the system back to my office to work on it.

After lots of testing of parts and swapping with another system configured exactly the same, I couldn't get anything to boot. Called SuperMicro for tech support and after further testing, they confirmed the problem was with the drives, not the SCSI controller, cable, or backplane.

Called Caucho and told them about the problem. Since both drives were bad, my assumption is that one drive failed a while ago and the other one continued to work since the server had mirrored drives. Then the 2nd drive failed last night. They didn't have any backup service on their server, and it sounded like they didn't do backups themselves. So I took the drives out of the system and shipped them for Monday delivery.

Tuesday, February 07, 2006

Long, long time...

Well, I guess I'm not very good at keeping up with this. I'm going to make an effort to do better. I think its been like 6 months since I last posted.

Lots has happened since then. For now, I'll just post some pictures of the back yard with grass and bark. Ended up deciding to wait until spring to add plants, but didn't want the dogs all muddy, so went ahead and put down bark. The winter and the dogs haven't been good to the grass, but it'll be fixed when I add the fence for the dog run and get all the plants.