Plesk: How many ColdFusion sites?

A customer asked how many ColdFusion sites they had on their Plesk server. Ordinarily, the following query would make this easy to answer:

# mysql psa -e "select count(*) as 'Coldfusion Enabled' from hosting where coldfusion = 'true'"
+--------------------+
| Coldfusion Enabled |
+--------------------+
|                159 |
+--------------------+

In their case, however, they had ColdFusion support enabled for all sites, so we needed to find out how many domains actually had ColdFusion content. Here’s a quick&dirty one-liner:

# find /var/www/vhosts/ -type f | grep -i "\.cfm" | cut -d/ -f5 | sort | uniq | wc -l
   150

Konsole and the console font

After doing some updates on my Debian Lenny workstation, I noticed that KDE’s Konsole is no longer able to find the “Console” font, and upon trying to install it, I’m greeted with an error saying:

Could not install console8x16.pcf.gz into fonts:/Personal/

Fortunately, this is easily fixable. As root, run the following:

# dpkg-reconfigure fontconfig-config

Choose the default option to all but the question about bitmap fonts – choose YES here. This will enable support for bitmap fonts. Then do:

# dpkg-reconfigure fontconfig

This will update the font cache. Now restart your Konsole, and your fonts should be back to normal.

Update 2009/03/07:   I had this happen to me again today (did a dist-upgrade to Squeeze) and after running the above fix, only one of the two missing fonts returned.   I found that removing the contents of ~/.fontconfig/ does the trick.

Update 2009/07/25:   I got a new PC at work, and this time did a clean install of Squeeze, which meant getting dumped into KDE4.  Again, the font was missing, and the font installer wouldn’t see the pcf file.  I had to do the above, and then, using the font installer, had to type *.pcf  in the filter field – this installed the font.  I also had to set font anti-aliasing to “enabled” instead of “system settings” in the System Settings panel –> Appearance –> Fonts.

Migrating a MySQL database containing views

You may have come across this problem: say you have a MySQL database called ‘myblog’ which you’re moving to a new server on a different provider, and said provider doesn’t allow you to name the database, but instead use their own scheme, ‘user82_db1’ for example.

If you happen to have views in your database, this will cause the import to fail, as those views would still refer to ‘myblog’ instead of the new database. Fortunately, this is easily fixed using the ‘rpl’ command. Say your database is backed up as ‘myblog-backup.sql’:

# rpl "\'myblog\'." "\'user82_db1\'." myblog-backup.sql

This will replace any instance to ‘myblog.’ with ‘user82_db1.’ and allow you to import a working database.