Percona Toolkit on CentOS

I wanted to install Percona Toolkit on a CentOS machine today but the download comes as an RPM. Percona make it easy to install it with Yum however by adding their repo. To do it do:

64 bit:
# rpm -Uhv http://www.percona.com/redir/downloads/percona-release/percona-release-0.0-1.x86_64.rpm

32 bit:
# rpm -Uhv http://www.percona.com/redir/downloads/percona-release/percona-release-0.0-1.i386.rpm

and then you can simply do

# yum install percona-toolkit

Thanks Percona!

Unable to access DFS redirection shares

We had a problem today on our Windows 2008 Server installation where most shares under a DFS namespace were accessible correctly, but all shares which were hosted on a physically different server, using DFS redirection, were unaccessible.

The message the client received was the typical message about being unable to access the share, please check with your system admin, etc., and then at the end said:
“The file cannot be accessed by the system.”

It turned out the solution was simply a case of restarting the DFS Namespace service on the server hosting the namespace. I don’t know why this happened but we had restarted the Windows server hosting DFS a few times recently due to hardware problems so I presume it somehow lost contact with the other server.

“Mailbox Rights” in Exchange 2003 showing only SELF

I had a problem today where the Mailbox Rights in Exchange for newly created users were showing only an entry for SELF and nothing else. After a bit of head scratching I eventually found via Google that this is normal until the user has logged in for the first time (either via Outlook Web Access or via normal Outlook) or the user has received an email. You can read more about it here:

http://www.petri.co.il/self_permission_on_exchange_mailboxes.htm

In my case I simply logged on each user I needed to create via OWA to get the permissions set correctly, before adding the additional permissions that I needed.

What does filter=2 in the querystring mean on Facebook?

I was wondering what filter=2 means when you see it in the query string on a page on Facebook. A quick search on Google didn’t turn anything up either which was annoying as I always feel that you should be able to find an answer to practically any well-worded question on Google!

In the interest of allowing Google to provide an answer to this question I am writing this post:

filter=1 means display only posts by the page
filter=2 means display only posts by others
filter=3 means display highlights (and is also the default if no filter is specified)

Hope that helps someone!

Shape Catcher

Have you ever wanted to put some kind of symbol on a page but didn’t want to have to resort to Photoshop to create an image for it? There are lots of Unicode symbols but trying to find the one you want can be very difficult. I found a really useful website called Shapecatcher which allows you to draw the symbol that you want and it will search for Unicode characters close to the shape you have drawn. Very handy, and it’s amazing some of the characters that exist in Unicode!

Display all Apache configuration files

Various times I’ve had a problem with Apache and I’ve wanted to be able to display all of the configuration files as they are seen when parsed by Apache. As I can never remember now to do it I thought I would document it here.

The mod_info module can be used to do this. Just add the following to one of the hosts in your Apache configuration and then go to the /server-info address on your server.

SetHandler server-info
Order deny,allow
Deny from all
Allow from 192.168.0.1

Don’t forget to secure access to this location by IP address or other method (see deny and allow directives above).

qmail log files on Plesk CentOS server

After a big of digging around on a server today, I followed my nose to where the log files are held.

qmail is started from within /etc/init.d/qmail. Searching for qmail-start reveals two ways in which qmail can be started, the Debian way or the “other” way. As this is CentOS we need the “other” way, which is:

qmail-start "$defauldelivery" splogger qmail &

The splogger argument tells qmail to use the syslog for logging, and CentOS uses rsyslog so look in the file /etc/rsyslog.conf. There you will find the line:

mail.*                    -/usr/local/psa/var/log/maillog

which finally leads us to the path to the qmail log file:

/usr/local/psa/var/log/maillog

Phew, got there at last! :-)

‘mod_alias’ and ‘mod_rewrite’

I spent a few hours recently trying to debug some Apache Rewrite rules on our development server.

We had a particular directory outside the root of the website that I was using an Alias command to make available. However, within this directory I also wanted to apply a couple of different Rewrite rules.

A simple cachebuster

One of the rules was basically to remove instances of the string nocache_XXXX_ where XXXX was a number which could change (this is usually a date-stamp, such as 20130131 if modified on 31st Jan, 2013). This allows us to easily change the number in the URL which will force the browser to reload the page, avoiding possible caching problems.

For example:
http://www.example.com/nocache_20130131_js/file.js
will be rewritten as
http://www.example.com/js/file.js
If the file.js changes we can modify the number in the url, which will force the browser to load the JavaScript again as it is a different URL, but the web server will return the current “file.js” inside the “js” directory, after the rewrite rule has been applied.

To cut a long story short, I found out that mod_alias and mod_rewrite cannot be used together. Therefore, the workaround in my case was to use just mod_rewrite and use a symbolic link instead of trying to use mod_alias. Note that to allow symlinks to be use, it is also necessary to specify Options FollowSymLinks within the Apache config for that site.

Maybe this will help someone else avoid wasting time trying to get mod_rewrite to work on top of mod_alias.