Script for a pre-loader when importing / loading flash movies (swf) into main movie

I decided for once I would do my own portfolio in Flash, because I wanted to check out the new features that had arisen since I used it really thoroughly back in 2002. Web banners, which is the only Flash stuff I've done in the recent time, usually don't pose a problem as they are of low technical quality more animation challenges there.

Anyways I tied this together using several tutorials. There were some pitfalls which I will go trough but I'll try to be brief as I hate long-winded tutorials.

Problem adding column values in MySQL SELECT query / sorting by added column values

I wanted to sort an sql query according to added column values. Like this

<?php
$query
= "SELECT * FROM myTable1 AS my1 ".
"LEFT JOIN myTable2 AS my2 ON my2.id = my1.id ".
"LEFT JOIN myTable3 AS my3 ON my3.id = my1.id ".
"ORDER BY (my2.price + my3.price)";
?>

Setting up crontab in Drupal

Not knowing so much about Unix commands and such setting up crontabs for your Drupal site can be a hassle. I recently noticed that my supposed crontab run wasn't functioning as expected. Patching together intelligence from several sites I finally managed to make something useful at last.

First create directory and the file that the crontab will call, in my case it was put in a bin directory on the same level as my public_html directory.
$ mkdir bin
$ cd bin
$ pico weekly.crontab.sh

Letting primary links be active / highlighted when browsing sub paths by overriding theme_links() function in Drupal

I wanted to highlight the primary links when browsing the secondary links (or sub links of the primary links). After some googling I understood that I had to override the theme_link() function. The overriding basically looks if the first slash text is in the in the link url currently active in the loop. All this is dependent on URL aliases being activated. It then proceeds to add the active class to the anchor.

After I messed with the theme_link() function I placed it in the template.php page which now looks likes this

<?php

Search and replace for characters in the whole database for Drupal

<?php
# Define which characters you want changed (key) and what you want them changed to (value)
$charChangeArray = array(
'Ã¥'=>'å',
'Ã…'=>'Å',
'ö'=>'ö',
'Ö'=>'Ö',
'ä'=>'ä',
'Ä'=>'Ä',
'ç'=>'ç',
'é'=>'é',
'¿½'=>'è',
'â'=>'â',

A script for converting your MySQL database collation to utf8 and utf8_general_ci and table columns to uf8_bin in Drupal

I recently had to migrate a database from one server to another. The new server was MySQL 5.xxx and I got the chance to change the collation and character set of my database. Being of Swedish origin there's always a hassle with å,ä,ö letters.

A Web Design Survey

Could be interesting, if it is global.

Let HTML tag inherit its parent's style i.e. set child tag style to parent tag style

Sometimes you want to make paragraphs clickable but when putting the text in <a> tag it usually changes the color and weight of the tag. However if you want the text to same as the paragraph you set it to inherit like this

property: inherit;

So the same color and font would become like this

<p><a href="www.mysite.com" style="color:inherit; font-family:inherit;">Lorem ipsum.....</a></p>

Link precedence in CSS2 class selectors

Had some problems with the precedence of an A tag class in my code. The link text keep coming up red instead of black as I had specified it should be in the dot-class in my style sheet, .MyClass. I tracked the problem down to the precedence for A.visited over <a href...class="MyClass">www.MyLink.com</a>.

Flash versus gif banner - Requiem for the gif animation

Recently the company I work for had an exchange of banners. We let them put up one banner on our site and they let us put up one theirs. When asked for the material I sent an animated flash banner and got the answer back that their banner rotating system only was compatible with animated gifs and other image formats. The had some reason for this compatible issue. Their arguments follows

  • Not all people can view flash files in their browser.
  • It is an easy system, and everyone else of our clients is using it.
urchinTracker(); // -->