Mini How To

Enable MySQL General Query And Slow Query Log

MySQL has a query logging feature. In order to use it you have to first enable it.

Enabling the general query log

Step 1: Set your log file in /etc/my.cnf

vi /etc/my.cnf

In the [mysqld] section specify the general log file name:

log=/var/log/mysqld.general.log

Step 2: Create the file and make sure it is owned by the system user mysql

touch /var/log/mysqld.general.log
chown mysql.mysql /var/log/mysqld.general.lo


How To Configure Yum To Exclude A Mirror

Many of us have suffered from failing package repository mirrors. Some are slow, some won't have updated content, etc. You might want to remove/blacklist a particular mirror in your yum configuration.

Before trying to remove a mirror, install the fastest mirror plugin.

yum install yum-fastestmirror -y

The fastest mirror plugin is capable of determining mirror speeds and cache it. If that works for you well and good.


Touchpad Tap Function Won't Work On Laptop PC

Issue: The laptop PC has the PS/2 Synaptics TouchPad. The tap function or the double click function does not work out of the box on a fresh Fedora 9 install.

Solution: Add psmouse.proto=imps to the grub configuration file

Step 1: Open the grub configuration from a text editor
vi /etc/grub.conf
 
Step 2: Append psmouse.proto=imps to the kernel line
I am pasting the information from my computer. It may vary slightly on your computer.
 
Before: kernel /boot/vmlinuz-2.6.25.10-86.fc9.i686 ro root=UUID=c1c4deb3-cc72-4ce6-b76f-4c4a8d61b61e rhgb quiet 


Adding * To Required Zend_Form Field Using CSS

You want to add an asterisk to required fields, huh?

add asterisk to zend form required element

There are many approaches to accomplish this. One among them is setting the requiredSuffix option to the label decorator of the form element. Assuming $element is your Zend_Form_Element object:

<?php
$element
->getDecorator('label')->setOption('requiredSuffix'' * ');
?>

Another option is to add the * while setting the label.

<?php
$element
->setLabel('My Label *')
?>

The third, which I am currently using in one of my Zend Framework powered applications is adding * using CSS. The default label decorator generates the following mark-up.


How Do I Remove Alpha Channel From The Image Using GIMP

As per the Wikipedia "alpha compositing is the process of combining an image with a background to create the appearance of partial transparency". To remove the transparency or the alpha channel:

  1. Fire up GIMP
  2. Open the image for which the alpha channel has to be removed
  3. Click the Image menu on the image window
  4. Click Flatten Image from the pull down menu
  5. Save

In short, remember to flatten the image when you want to remove the alpha channel.

Quote from the GIMP docs:


Syndicate content