When displaying a list that requires information from several tables in the database, you can sometimes end up with three or more database queries per list row. Depending on the situation, this may not be a problem. However, it is possible to join the tables in one large SQL query using the :include option.

# :include example
#
@requests = Request.find(:all, :include => [:department, :status])

Using the :include option may improve performance. However, it will likely use more server memory and could potentially return a lot of data through the joins that may not even be used.

Tagged with:  

For those running Xen on servers with no back-end SAN, the following instructions detail the steps necessary to move an LVM-based virtual machine to a new physical host. There may be more elegant ways to achieve this, but this is what worked for me.

Environment
Ok, so let’s set the scene:

  • vmhost is a RHEL 5 server running several virtual machines using the Xen virtualization technology. Each virtual machine is allocated a 60 GB logical volume within an LVM volume group. One of these virtual machines, “win2k3vm”, needs to be moved to a new server.
  • new-vmhost is almost identical to vmhost, but has updated hardware and more memory. This is the server that “win2k3vm” will be moved to.

Continue reading »

Tagged with:  

Install phpMyAdmin

On February 20, 2008, in Linux, MySQL, PHP, by Brad

phpMyAdmin is web-based PHP application for managing MySQL databases. It is fairly easy to install and configure.

Download the latest stable version from the phpMyAdmin web site, and extract it to a location of your choice. I prefer to keep the installation outside of the web root and use an apache alias to reference it.

Continue reading »

Tagged with:  

Mount an ISO file

On January 25, 2008, in Linux, Tech Notes, by Brad

You can mount a CD or DVD image in Linux so that it appears like a regularly inserted disc. Use the following command:

prompt# mount Fedora-8-x86_64-DVD.iso /mnt/isofile/ -o ro,loop=/dev/loop0

Ensure that the /mnt/isofile directory exists before trying to mount the ISO to that location.

 

VNC over SSH

On May 25, 2007, in Apple OS X, Linux, Tech Notes, by Brad

Sometimes it is useful to manage a Linux server remotely using VNC. A simple and secure method for doing so is to tunnel the VNC connection using Secure Shell. The following instructions have been tested on Redhat Enterprise Linux 5 AS.

On the server side:
First, we need to ensure the vncserver is actually running. SSH to the server or logon at the console as your regular user account. No root privileges are necessary. Once logged in, just type vncserver. You should see something like this:

Continue reading »