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

Prestashop 1.2.x not showing Categories box

Problem: In the front system (FS) Prestashop is not showing the Categories box. In the back system (BS), clicking on the Catalog tab shows just a blank page, or an error message saying the page is unavailible. The probable reason is that your Home category is missing or messed up. The problem is that you can’t get into the Catalog tab in the backend system to fix it. I ended up in this situation by trying to import categories as a CSV (comma/semi colon separated file) and I had a category in that file with ID = 1. Category ID number 1 is reserved for the Home category. Prestashop did not filter this or issue a warning during the import. So take it from me – do not try to import a category with ID = 1. Prestashop table ps_category in phpmyadminSolution: I opened my database with phpmyadmin and went to the ps_category table. The row for id_category 1 was messed up and by comparing it to a backup I set it to: id_category = 1, id_parent = 0, level_depth = 0, active = 1. The dates I left as they were. Then I went into the table ps_category_lang and made sure that there were entries for id_category 1 for all languages that I had installed (I had two in my system). Voila, back and front system now works. By adjusting the ID:s in my category import file (making sure no ID was 1) it worked like a charm to import it.

FON 2.0n router sharing 3G over Wifi

When you’re travelling as a professional nerd, you regularly needs to access the Internet. Internet cafés can be expensive and 3G… don’t think about using it abroad. It ususally costs a fortune.

I joined the FON network where you share your broadband connection at home to other FON-users and in return you are able to use the 1.5 million (and growing) FON hotsposts around the world for free.

In 2009 FON launched a new router, the FON 2.0n. It is packed with features (to read more about it, see FONs website), but most important is the USB port where it is possible to attach a 3G device. This enables you to share your 3G internet connection over the FON 2.0n wifi router. I usually bring this router on trips where I need to share my 3G internet connection to several computers over Wifi.

Read more