Archive for the ‘Web’ Category

Absolute vs relative paths

posted by Knut Torgersen
May 13

In your web programming you can either use relative or absolute paths to, say, pictures and other items you want to make accessible to the public.

Relative path: The root of your path is assumed to be / regardless of location. An address will look like: /images/mypic.jpg. Easy to maintain and code is trans-web portable. You can also address items relative to your current subdirectory. If, for instance, your index.html resides in the /example/ directory, you can address the /images/ folder like this: ../images/mypic.jpg

Absolute path: The root of your pat is your (or any other, for that matter) domain that then contain the file structure. This means that you prefix every (relative) address with your domain name. An address will look like: http://www.mydomain.com/images/mypic.jpg

Personally, I try avoiding at least the extreme version of relative addressing in my private webs, as they may turn up confusing or even non-functional. I therefore take the extra time to make sure all of my paths are fully absolute. Boring to enter, but 100% foolproof. Foolproof works well for me. Very well, in fact…


May 13

The MediaWiki is the wiki flavour used by THE wiki of them all: Wikipedia. It is not all that difficult to set up, but it is not equally easy to configure. The procedure for changing the upper left hand corner logo image turned out to deviate from descriptions and not behave completely by the book (as in the manual).

First of all, create an image that is 135 by 135 pixels. I used PNG, but both GIF and JPG should do. Put this image in a suitable place on the wiki. The relative paths /, /images/ and /skins/common/images/ are suggested places, so I put mine in /images. See this link for a discussion on relative vs permanent links.

Now, locate (still relative) /LocalSettings.php and open it in your favourite editor. Do a sweep for $wgLogo just to be certain it does not exist.  When satisfied, add it near the end somewhere where it seems more or less logical to put it. I made a new comment line (starts with the hash, #) below $wgDiff3 and below the comment added the proper $wgLogo line.

First, I tried as suggested to enter the relative path to my PNG, but that only made a white, empty space appear. I moved the file around and did not at all getting the results expected. I then rechecked the official MediaWiki manual and discovered that paths can be both relative and absolute. I then entered the absolute path to the image, saved, refreshed the page in the browser – and there it was.


Adding a favicon to WordPress

posted by Knut Torgersen
Oct 27

Favicon.ico, favicon.gif, … or png, apng, jpg… or any other name, actually are the names of the little picture many websites publish to show their logo next to their web address in most major web browsers these days. The image may be 16×16, 32×32 or 64×64 pixels in size. Traditionally, you had to make it a standard Microsoft .ICO format and give it the exact name favico.ico or it would not work at all. Now you can call it whatever you want, place it where you want and use the format you want too.

To get started, make an icon and decide where to place it within your web. Personally, I tend to put it in the default “root” location of the WordPress installation and calling it favicon.png, but read on for alternatives and why you might want to choose otherwise.

Now, find the file header.php and open it in your favourite text editor. It is in the directory where the current theme resides. Since I at the time of this writing use “blue-server”, the path is (web/*nix style)

/wordpress/wp-content/themes/blue-server/header.php

Inside this file – assuming your file is favico.php, located at the root of your wordpress, add above the other lines starting with <link rel=… a line like this:

<link rel="icon" type="image/png" href="http://yourdomain.com/wordpress/favicon.png">

Save the file and if necessary, upload and replace the original. If you switch view for instance every eason, it would be wise to either keep the favicon file inside each theme directory or to name the favicon properly. Or both.


White Screen of Death

posted by Knut Torgersen
Oct 24

Bummer – my site got cracked and some person used it to send out spam mail. Because of this I have re-installed the site and I have switched to the lastest version ov WordPress. But of course I had to get the White Screen of Death. Upgrading the database went well, but WSoD after it finished. Fortunately, the solution was simple…: Copy everything important into a new, fresh copy of wp-config.php, fill in the missing code fields and upload. Refresh the page and voilá! NOT!

I then went into the admin screen (via url, since the page was, as I said – blank) and noticed it complained about the current theme. I reset the theme to a default one and refreshed the site. And… And… This time it worked.

So, here we are. New version and new looks.



If Apache web server for Windows does not return your website and only stands there spinning, add Win32DisableAcceptEx to the file httpd.conf.


Automatic search for information

posted by Knut Torgersen
Jul 18

Mozilla Firefox has the ability to automatically look up information for you using a specific website. You write your mnemonic and the info you want checked in the location toolbar (where you normally type the name of a webpage) and Firefox takes care of the rest.

Here is how to put it all together:

  1. Navigate to the webpage you want to use
  2. Click the field you want
  3. Right-click and select “Add a keyword for this search…” from the dropdown menu
  4. Add a name you wish to use and the the keyword you will type before your search item – and (say, imdb) find a place to save your new search bookmark
  5. Press OK and you are done

Now, just type your imdb xyzzy where xyzzy is the search item you want Firefox to check – and there you go!