/tmp problem when installing plugins in WordPress

When you try to install a plugin in WordPress and get an error message like this:

Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/tmp//google-integration-toolkit.tmp) is not within the allowed path(s): (/var/www/XXX/) in/var/www/XXX/web/wp-includes/functions.php on line 2140

Warning: touch() [function.touch]: SAFE MODE Restriction in effect. The script whose uid is 12345 is not allowed to access /tmp owned by uid 0 in /var/www/XXX/web/wp-admin/includes/file.php on line 184

Download failed. Could not create Temporary file.

This is happening when the server is running with SAFE MODE because WordPress will not be able to access paths outside it’s web root. Find out the full path to your web root on the server (a hint is in the error message you just saw). Create a temporary directory within your website path and add the following line.

Edit wp-config.php and add:

define(‘WP_TEMP_DIR’, ‘/var/www/XXX/tmp’);

(Replace /var/www/XXX/tmp with the full path to your temporary directory.)

Fixing a stuck thermostat (TA RVT) on your central heating radiator

Is your radiator cold or gives very little heat? Or is it burning hot, no matter how you turn the knob on the thermostat? Then the problem is probably caused by the thermostat being stuck.

Use this instruction on your own risk. If you feel unsecure about it, call a professional. This instruction applies to central heating systems using water and a thermostat called TA RVT. If your thermostat is of another type it is possible that the procedure is similar but not necessarily. Go on with caution.

Read more

CSS letter-spacing bug in IE7 and solution

A very good and scalable way to set letter spacing in CSS is by using ’em’s as it works relative to the font size. If you for example specify letter-spacing = 0.2em the letter spacing will stay proportional even though you change the font-size. You can easily set the letter spacing for the entire site in all font-sizes.

The ’em’s works exactly like ‘tracking’ which many designers work with. To convert tracking to em just divide it by 1000. That is x em = tracking y / 1000. For example tracking 200 equals to 0.2em.

The definition of 1 em is the size of the character M in the current font size. So 1 em for a font-size of 10px equals to 10px. 1 em for a 24px font size is 24px.

It is very practical to use ’em’s to specify the letter-spacing as it is proportional to the font size. For small ’em’s however, Internet Explorer 7 (IE7) seems to round the values making the letter spacing appear wrong. It works alright in other browsers as well in IE8.

A workaround is to convert the letter spacing to pixels for your current font-size. The drawback is that you have to calculate it for every font-size you are using. And if you change a font-size you must recalculate the letter spacing.

The calculation is really simple. Just multiply the font size in pixels with the letter-spacing in ’em’s and you will get the letter spacing in pixels. If you have a font size of 16 pixels and want a letter spacing of 0.2em (which is equal to a tracking of 200) you do: 16px x 0.2em = 3.2px letter spacing.

Examples using 0.2em (tracking 200):

#mysize16
{
font-size: 16px;
letter-spacing: 3.2px; /* 0.2em x 16px = 3.2px */
}

#mysize24
{
font-size: 24px;
letter-spacing: 4.8px; /* 0.2em x 24px = 4.8px */
}

Replacing the modular connector on HM-103

ICOM HM-103 microphone with modular connectorThe ICOM IC-706 series comes with a HM-103 microphone with a modular plug as the connector. The disadvantage with these connectors is that the lock pin easily breaks. Replacing the modular plug should be quite easy with a modular crimp tool. However there are some caveats. If you need the schematics of the microphone you find it here (download the instruction manual).

In the old connector you will see two black wires. After cutting the old connector and pealed off the outer skin of the cable you will discover that there is only one black wire. In addition to that, there is a red wire and a gold and silver shield.

Keep the old modular plug to see how the wires should be placed. Trim down the shield leaving just one or two single “straws” from it. The shield should go where the middle black wire is in the old connector (pin nr 5), between the white and the green. The red one is not used and should be cut off.

Getting the wires in the correct positions in the modular connector is a bit like building a ship in a bottle but with patience you will get it in place. Double check the wire colours against the old connector before you crimp it with the modular tool.

WordPress insert image/video/music problem caused by plugin

When writing a post in WordPress, and you press Upload/Insert buttons to insert images, video, music or other media you can run into a problem where a popup displaying “Are you sure you want to do this?” is showing instead of the normal insert screen. The problem is described here. As mentioned in the posts, it is caused by some plugin. This can be hard to guess as the plugin in question might have nothing to do with writing and posting articles.

I ran into this problem using the latest WordPress 3.0.1. The plugin that was causing trouble for me was WP-ContactForm. By disabling it, it was possible to insert images in the posts again.

If you experience this problem, try disabling all plugins. If inserting images now works, try enabling the plugins one by one to figure out which one is causing the trouble.

Connecting Remote Desktop to console screen

When you connect to a Windows XP with remote desktop (RDP), you automatically get connected to the console, i.e. the same screen/session that a local user is logged into.

Starting RDP in console modeHowever, if you connect to a server, like Microsoft Windows Server 2003, you will not get connected to the local console session, but instead to a new session. Sometimes it is necessary to connect to the console session, for example when troubleshooting a problem and there is an error message on the console session screen.

To start the remote desktop in console mode you click on the Windows Start button and type in the Run or Search field:

For Windows XP:

mstsc /console

For Windows Vista / 7:

mstsc /admin

And then press enter or click Run.

phplist problem with local UTF-8-characters in subject line

phplist is a popular software for sending newsletter to large lists of recievers. It has a large number of features which I will not go into depth here. For more information about what phplist can do –  visit the phplist homepage.

If you are experiencing problems when you are sending a newsletter containing local characters, like the Swedish Å, Ä and Ö in the subject line, the most probable reason is that administration web pages are rendered in a character set different from the one used in the newsletter.

The following solution is assuming that you are running phplist on a Linux host.

Read more

Pimping the laptop with a Solid State Drive

Intel Solid State diskSome week ago my laptop complained while trying to save a file that there was some error writing to the disk. I had two choices – wait until the harddisk breaks, preferably when I am overloaded with work and a deadline is coming up (that is a law of nature). Or I could buy a new disk now and replace it before disaster happens. I choose the not so adventurous way and decided to do something about it now.

I’ve been glancing at the dropping prices of Solid State Drives as they are faster than mechanical and probably lasts longer. My choice fell on the Intel X25-M 2,5″ 80 GB SSD SATA/300 MLC 34 NM from the swedish supplier called Dustin. I must mention the super quick delivery Dustin (in assistance by the swedish post) had. I ordered the device late tuesday night in their web shop. Wednesday morning around 10 i got the delivery note by mail. At 13.00 the very same the delivery guy rang my doorbell. That is impressive!

The installation was easy. Just unscrew the drive bay, uninstall the old harddisk and replace it with the SSD. Be sure not to touch the connectors of the SSD disk as it is sensetive to electric discharge. I partitioned the disk with dualboot running Ubuntu 10.04 LTS in one and Windows 7 in the other. Boot time is impressive as you can see in the videos. My laptop has a new life!

Canon Powershot G9 user friendly translation for disabling sound

Canon Powershot G9 sound offThis translation train wreck has somehow slipped through Canon quality check. The menu is in Swedish and controls sound effects of the camera. Instead of just writing Sound (“Ljud” in Swedish) with the selection On or Off the translator wrote “Ljud av” which backtranslates to “Sound off”. In order to disable the sound you should set “Sound off” to on. Why make it easy? 🙂

mysqldump to multiple files

It is a good idea to run mysqldump by cron to regurlarly make backups of your MySQL databases. An easy way to do this is by adding the –all-databases parameter.  This way you will have a backup of all your databases – in one file though. If the amount of data and the number of databases is small this might be ok.

After the first session of restoring just one database or one table from your one-file-backup you realize that it would be nice to have the dumps split up in some convenient way. Like dumping each database to one file, one for each database.

This little shell script does the trick for you. It is really simple and has no error handling what so ever. It is released under GNU GPLv2 license. If you modifiy it or add features (like error handling or so), please do send me a copy or post it as a comment here.


#!/bin/sh
# mysqldump-multi.sh
# Copyright HelTech Communication, Stefan Helander 2010
# stefan@heltech.se, http://www.heltech.se
#
# Licensed under GNU GPLv2
#
# Dumps all MySQL databases. Each database stored in a single file.
#
# settings

DUMPDIR=/root/mysql-backup/backups
MYSQL_HOST=localhost
MYSQL_USER=root
MYSQL_PASS=YOUR-PASSWORD-HERE
MYSQL=/usr/bin/mysql
MYSQLDUMP=/usr/bin/mysqldump

# dump each db

for DB in `echo 'show databases' | $MYSQL -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASS --batch -N`
do
$MYSQLDUMP -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASS --quote-names --create-options --force $DB > $DUMPDIR/$DB.sql
done