Updating a database option in DB2

Sometimes after a database has been created, you may want to move where the default log path is. Or you may want to change  DB2 places the log path in the home directory, and you may want to have the logs stored on another storage device.

Login as the DB2 adminstrative user, then type the following command to change your log path:

> db2 UPDATE DB CFG FOR MyDB USING <OptionName – ex., NEWLOGPATH> <Value – ex., /db2data/AnyDirectory/NODE0000/logdir>

Stop and restart DB2 (db2stop force and db2start). Your new log path is now active.

Updating the log path in DB2

Sometimes after a database has been created, you may want to move where the default log path is. DB2 places the log path in the home directory, and you may want to have the logs stored on another storage device.

Login as the DB2 adminstrative user, then type the following command to change your log path:

> db2 UPDATE DB CFG FOR MyDB USING NEWLOGPATH /db2data/AnyDirectory/NODE0000/logdir

Stop and restart DB2 (db2stop force and db2start) and the your new log path will now be active.

Restoring all reports to Jasper Server

Sometimes it is necessary to restore an entire copy of Jasper Reports generic lipitor. This can only be done by first removing all of the existing entries in the Jasper Reports server to be restored to.

First, on the source machine, backup the entire Jasper Reports server by running the following commands:

> cd /home/jasper/jasperserver-3.5/scripts
> /home/jasper/jasperserver-pro-3.5/scripts/js-export.sh –everything –output-dir /home/jasper/jasperserver-pro-3.5/scripts/js-export.$HOSTNAME.`date +\%y\%m\%d`

Then copy the backup directory to the destination machine:

> scp -pr /home/jasper/jasperserver-pro-3.5/scripts/js-export.$HOSTNAME.`date +\%y\%m\%d` destinationMachine:/home/jasper/jasperserver-pro-3.5/scripts

Now, on the destination Jasper Server, run the following commands:

> cd ~/jasperserver-3.5/scripts/mysql
> ./jasper_init.sh
> cd ..

Finally, do the restore by running the following command:

> ./js-import.sh –input-dir js-export.<TheHostNameOfTheSourceMachine>.`date +\%y\%m\%d`

Now just be sure to update your Data Sources in the Jasper web site on the destination machine.

Enabling Apache support for pretty permalinks in WordPress

In WordPress, there is a feature called PermaLinks. These create URL’s that are better searched by Google. So instead of getting a URL like http://example.com?id=454, you get something like http://example.com/enabling-apache-support-for-pretty-permalinks-in-wordpress. Now the search engines will see a URL that they can parse for information, rather than an arbitrary number.

Enabling Apache support for what is known as address rewriting is accomplished by modifying your httpd.conf file. Open the file and look for the line that says:

<Directory “/var/www/html”>

In this section there will be a line:

AllowOverride None

Change this line to:

AllowOverride All

Save the httpd.conf file. Then restart Apache.

Now when you click, Enable Permalinks in WordPress, you will have a search engine friendly blog.

Adding custom palettes to Dundas pie charts in .NET 3.5x

One of the new features in Dundas 6.x and above, is the ability to create custom palettes of colors and apply them to pie charts. This way you no longer have to settle for Dundas’s default fluffy colors. In order to change the color palette, create a Color array and assign it to the series like this:

Color[] clrSteps = new Color[] {
Color.Red,
Color.Green,
Color.Magenta,
Color.Blue,
Color.LightBlue,
Color.Coral,
Color.LightCyan,
Color.Goldenrod,
Color.Gray,
Color.GreenYellow,
Color.Honeydew,
Color.Ivory,
Color more helpful hints.Khaki,
Color.Lavender
};
yourPieChart.PaletteCustomColors = clrSteps;

Now your pie chart will start with red for the first slice, then continue to use the clrSteps array for each slice’s color. If there are more slices than colors you’ve provided, don’t worry, Dundas will start at the beginning color in the array and continue through all of the colors as many times as needed.

Linux log error – Could not receive trustdoms : xxx Time(s)

When using Samba with Linux, Red Hat Enterprise Linux attempts to connect to a Windows server that acts as the domain controller. This is called a trustdom; as Linux is attempting to build a trust relationship with a Windows Domain Controller. You will see the following message in your log:

——————— samba Begin ————————

**Unmatched Entries**

nsswitch/winbindd_util.c:trustdom_recv(243) Could not receive trustdoms : 288 Time(s)

———————- samba End ————————-

To stop this error message, you need to stop the winbind service. To do this, run the following commands:

chkconfig winbind off
service winbind stop

This will ensure that upon reboot, the service does not start. And the second command ensures that the service is stopped immediately.

Check your log tomorrow to ensure that you are no longer receiving this message.

QEMU seems to make Windows read-only

The Problem:

The server is acting all weird, thought i might raise a flag to you:
– after you said you attached the larger drive/partition, nothing changed
– when i logged on as administrator tonight, it acted like ive never logged on before
– the profile is fucked up somehow; i dont have any icons, no quick launch, none of the items i installed, etc.
– for some weird reason, i can’t download any files using a web browser when on the server.  i also cannot ftp any files to the server.  when i use ie to download an attachment from gmail for example, it can’t do it.  when i tried to download firefox, i also got an error about contacting the server.  very weird.  also, with full permissions, and full write access, i am unable to write any files to the server via ftp either.  me = confused.

Did you refresh the instance or something like that?

The Solution:

In this instance, a new virtual drive was added to a Windows 2003 Server running under a QEMU virtual machine on Linux. QEMU most likely has the virtual instance locked read-only because the new virtual drive has not been allowed to initialize itself under Windows. This stops Windows from being able to write to any file.

In this case the problem was resolved by forcing a power down on the instance. Then under the setting for the virtual machine on the Hardware tab, check that the new drive is in the list of hardware. If so, then start the instance. Log in as Administrator in Windows. Go to Control Panel – Administrative Tools – Computer Management. Once it opens, select Disk Management, and initialize and format the new drive.

If from above the new hardware is not in the list of Hardware Devices. Try reconnecting to the virtual disk you created, or just create a new virtual disk and attach it to the Windows instance.

Windows service failure while running in a QEMU virtual instance

If you are running Windows under QEMU and see Event ID 7000’s like these below–

If you get this Description:

“The Parallel port driver service failed to start due to the following error:
The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.”

Then you have the ParPort service not starting. This happens if you upgrade your W2K3, W2K, or NT server from hardware (motherboard) that HAD a Parallel Port, but are now on a new motherboard that has no Parallel Port.

The fix is simple:
1. Open Regedit and go to–
HKLM\System|CurrentControlSet\Services\Parport
2. Edit the Start key and change the value to 4. Changing the value to 4 will “disable” the service.
3. Reboot the server

You should no longer get that annoying popup dialog when Windows starts.

Setting the Session Timeout in Tomcat

You can specify the timeout of a session in the deployment descriptor of your web application (web.xml):

<web-app>
  <session-config>
    <session-timeout>60</session-timeout>
  </session-config>

  ...
</web-app>

The number within the session-timout element must be expressed in minutes.

Be sure to restart Tomcat to take the new setting.

Using QEMU for operating system virtualization

Fortunately, it’s not the only game in town. Different ways of tackling virtualization have led to a number of different software packages including VMware, Xen, VirtualPC, and Usermode Linux. Another virtualization program is called QEMU and it’s a lot like VMware in concept.

The first step is to grab QEMU from the project Web site. You can download the source or binaries for different platforms. Once the software is installed, you can install your first virtual operating system. The next step is to create a disk image:

<code>
$ qemu-img create linux.img 2G
</code>

This creates a 2-GB image file that will be used for the virtual hard drive. You can use different formats for the image file; you can even use the VMware vmdk image format. The default (raw) format is the best for Linux guest operating systems as it will only take up as much space as required.

Next, grab an ISO image of your favorite Linux distribution, or the CD-ROM it came on. In this case, the ISO image used is the Mandriva Linux 2006 DVD install image. The next step is to start QEMU and tell it to use the image and to boot from it, and at the same time, let it know that our newly created image file is the primary hard drive for this virtual machine:

<code>
$ qemu -boot d -cdrom ~/Mandriva-Linux-Powerpack-2006-DVD.i586.iso -hda linux.img
</code>

This tells QEMU to boot first off the CD-ROM (-boot d), that the CD-ROM device is an ISO image (-cdrom; or use -cdrom /dev/cdrom if you are using a real CD), and that the /dev/hda device to the virtual machine is the file linux.img.

Proceed with the install as usual; when the installation is done and you have to reboot, change the command line to something like:

<code>
$ qemu -boot c -cdrom /dev/cdrom -hda linux.img -user-net -m 256
></code>

This tells QEMU to boot off of the hard drive and to use /dev/cdrom as the CD-ROM device; it allows networking and assigns 256 MB of RAM to the virtual machine.

QEMU isn’t as fast or as feature-rich as VMware, but it’s still quite capable. It has support for 64-bit hosts and guests–something that VMware is just now introducing in recent betas, but which require very recent 64-bit host CPUs. If you’re looking for a cheap way to virtualize an operating system or two for testing purposes, QEMU may be a great alternative to an expensive and proprietary solution.