Ktools PhotoStore batch image regenerate

Ktools PhotoStoreThe Ktools PhotoStore software (www.ktools.net) automatically generates thumbnails, sample and large images with watermarks of the images in the database. If you change the settings regarding the image sizes only newly added images will get the new sizes.

The following simple script regenerates / resizes the thumbnails, sample and large images from the original images. It runs in batch mode, i.e it will work on every image you have in your stock_photos folder. It will overwrite your current i_, s_ and m_-versions of your images without warning. The sizes is set in the script (it does not read the current settings in the manager).

#!/bin/sh
# ps_regenerate.sh for Ktools Photo Store - http://www.ktools.net
# Copyright 2010-12-27 HelTech Communication, Stefan Helander
# http://www.heltech.se
#
# This script may be downloaded from https://nerdia.net and used for free. It is not
# allowed to redistribute this script without written permission.
#
# Requires GraphicsMagick - gm
#
# Regenerates thumbnail, sample and large images for Ktools Photo Store.
# Copy this file to photostoreroot/stock_photos and execute it
# in that folder. If necessary adjust the sizes below.
# !!! WARNING !!! This script overwrites current m_, s_ and i_versons
# of your current images without question.
#
I_SIZE=”150″
S_SIZE=”500″
M_SIZE=”1200″
COMMAND=”gm convert”
FILES=`ls *.jpg | grep -v “^m_” | grep -v “^s_” | grep -v “^i_”`
for FILE in $FILES
do

# Make i_ image
$COMMAND -size $I_SIZE "$FILE" -resize $I_SIZE "i_$FILE"
# Make s_ image
$COMMAND -size $S_SIZE "$FILE" -resize $S_SIZE "s_$FILE"
# Make m_ image
$COMMAND -size $M_SIZE "$FILE" -resize $M_SIZE "m_$FILE"

done

PrestaShop module TECHNICAL ERROR

On a PrestaShop 1.3.2.3 installation I purchased the One Page Checkout 1.2.2 and installed it. After that I got the following error message when trying to add a product to the basket in the shop front end: TECHNICAL ERROR: unable to add the product.

Details:
Error thrown: [object XMLHttpRequest]
Text status: parserror

Solution: The reason is the web server is running in SAFE MODE and the user owning all the PrestaShop files is the FTP user I use to upload the shop. When installing the One Page Checkout module it will be owned by the user running the web server process (in my case www-data:www-data). In SAFE MODE a php script is not allowed to execute a script owned by another user. The solution is to set the owner of all the order-files in the PrestaShop directory to my FTP-user (including the files installed by the OPC module). In a shell this is simply done by the chmod command: cd prestashop-installation-dir chown -R my-user:my-group order* (Replace prestashop-installation-dir with the real path where PrestaShop is installed and my-user:my-group to the userid:grouid owning the rest of the files in the Prestashop installation.)

Screen is displayed upside down or sideways on my laptop with Windows 7, Windows 8 or Windows 10

Just press and hold CTRL and ALT and then press the up arrow and the screen will return to it’s normal orientation.

In order to support devices with different orientation you can rotate the screen. The screen can be rotated left (left arrow key), right (right arrow key), upside down (down key) and normal (up key) while pressing CTRL and ALT.

My guess this is going to be the next practical joke at the office 🙂

In case the keyboard shortcut doesn’t work, it can also be fixed through control panel settings described in this article.

/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