Search This Blog

Thursday, June 15, 2006

HTML - change the way links look

In the example below underlining is turned off for all links.

The A:hover tells the browser that when the mouse is over a link the underline should appear.
The hover option only works on MSIE 4+.
(But it does not cause an error on Netscape if you include it - the effect just does not appear.).

<html>

<head>
<title>This is my page</title>
<style type="text/css">
<!--
A:link {text-decoration: none}
A:visited {text-decoration: none}
A:active {text-decoration: none}
A:hover {text-decoration: underline}
-->
</style>

</head>

<body>
Welcome to my world!<br>
<a href="http://viraj-workstuff.blogspot.com/">This Link To My Blog has no underline</a>
</body>

</html>

If you want to turn off the effect for just a single link, add a style property to the <a href> tag:

<a href="http://viraj-workstuff.blogspot.com/" style="text-decoration: none">Go to my blog</a>

You can make multiple style settings instead of just removing the underline.

<html>

<head>
<title>This is my page</title>

<STYLE TYPE="text/css"><!--
A.set1:link {color: #FF00FF; }
A.set1:active {color: #FFFF00; }
A.set1:visited {color: #00FFFF; }

A.set2:link {color: #AA00FF; background: FF00AA; text-decoration: none}
A.set2:active {color: #FF00AA; background: none transparent;}
A.set2:visited {color: #FFFF00; text-decoration: none}
--></STYLE>

</head>

<body>
Welcome to my world!<br>
<a href="http://viraj-workstuff.blogspot.com/" CLASS=set1> My Blog </a>
<a href="http://www.blogger.com/profile/10381021" CLASS=set2> My Profile </a>
</body>

</html>

Wednesday, February 15, 2006

Converting win XP to linux

For people who are more used to a few linux features which they very much miss in windows.

Multiple workspaces: You miss this feature when you are working on different projects and you see all the windows in the same workspace. You find it difficult to find the project specific window. You just wish there were workspaces where you could group together the windows and put them in different workspaces. Dont worry, you have a solution though not exactly similar to linux. Thank you Virtual Dimension.

Multiple Panels: For people used to multiple launch panels, ObjectDock.

Sunday, January 15, 2006

Upgrading to firefox 1.5

My config : linux fc3 x86.

The Totem video plugin doesn't seem to work with firefox 1.5
Install package 'mozilla-mplayer' instead.

Also you need package 'libstdc++5' installed.

You may get an error dialog (twice) each time Firefox starts up saying Firefox could not install this item because of a failure in Chrome Registration.
This is a bug.
To work around do the following:-
sudo touch /opt/firefox/extensions/talkback@mozilla.org/chrome.manifest


Installing :
#>First, back up your bookmarks and settings:

cd ~/.mozilla/firefox/*.default
mkdir ~/Desktop/ffsettings
cp bookmarks.html cert8.db cookies.txt formhistory.dat key3.db signons.txt history.dat mimeTypes.rdf ~/Desktop/ffsettings

#>Download firefox-1.5.tar.gz from mozilla.com, and change to the directory you downloaded it to.

#>Install it to /opt/firefox:

sudo cp firefox-1.5.tar.gz /opt/
cd /opt
sudo tar xzvf firefox-1.5.tar.gz
sudo rm firefox-1.5.tar.gz

#>Link to your plugins (and remove totem-mozilla as it doesn't seem to work with Firefox 1.5):

cd /opt/firefox/plugins/
sudo ln -s /usr/lib/mozilla-firefox/plugins/* .
sudo rm libtotem_mozilla.*

#>Change to your home directory, and rename your old profile, leaving it as a backup (using the existing profile may cause problems with Firefox 1.5):

cd
mv .mozilla .mozilla.fc3

#>To ensure it is used as the default version, modify the symbolic link in /usr/bin:

mv /usr/bin/firefox /usr/bin/firefox.bak
sudo ln -s /opt/firefox/firefox /usr/bin/firefox

Restoring should only be done after running firefox at least once and fully closing it.

#>Restore your old data:

cd ~/Desktop/ffsettings
mv * ~/.mozilla/firefox/*.default

#>Restore your Searchplugins:

sudo cp -i --reply=no /usr/lib/firefox[-VER]/searchplugins/* /opt/firefox/searchplugins/
sudo cp -i --reply=no ~/.mozilla/firefox/*.default/search/* /opt/firefox/searchplugins/

#>If you want to keep the original fc3 icon for firefox, enter this command:

sudo cp /usr/share/pixmaps/firefox.png /opt/firefox/chrome/icons/default/default.png

#>To ensure that other programs use version 1.5 of firefox and not the old 1.07 version, go to Preferences -> More Preferences -> Preferred Applications in the System menu. For the "Web Browser" tab, choose "Custom" and then enter the command:

firefox %s


Restoring Extensions and Themes

this should only be done after running firefox at least once and fully closing it.

#> Backup the new profile (just in case):

cd ~/.mozilla/firefox
mkdir ff1.5
mv profiles.ini *.default ff1.5/

#> Restore your previous profile:

cp ~/.mozilla.fc3//firefox/profiles.ini .
cp -r ~/.mozilla.fc3//firefox/*.default .


Updating

To get firefox's own update/autoupdate to work at all, you have three choices (read them all and choose one):

#> Change the /opt/firefox directory to have 'write' permissions & ownership set for the user instead of the root. To change ownership, after installation type:

sudo chown -R username:username /opt/firefox

This is the only way to get update notification working, but doing this has security implications in a multi-user environment, and is not recommended: a virus or malicious program running as a user may now replace or corrupt the files in /opt/firefox, which would affect other users of the computer.

#> An alternative to the above method is to run firefox with sudo to get the updates. That is, when there is an update available, you would run sudo firefox -safe-mode (the safe-mode is an extra layer of protection since it will not load any extensions while running as sudo), install the update (Help -> Check for Updates...), close firefox, and then restart firefox as a normal user. You should NOT browse other websites while you are running firefox with sudo. (It is not known whether this method is any safer/more secure than the first method).

#> A third option, is to use method 1, but only for updates: Keep the firefox folder owned by root and use it normally until you need an update, then give your user ownership: sudo chown -R username:username /opt/firefox. Start firefox normally and update (Help -> Check for updates...). Once the update is completed, you should restore ownership to root: sudo chown -R root:root /opt/firefox. Again, do NOT browse other sites while firefox has these elevated permissions. This is probably the best option although it is also the most cumbersome.


Removing


#> Restore the symbolic link:

sudo rm /usr/bin/firefox
mv /usr/bin/firefox.bak /usr/bin/firefox

#> Restore your old profile:

cd
mv .mozilla .mozilla-1.5
mv .mozilla.fc3 .mozilla

#> (optional) Delete the firefox directory

sudo rm -r /opt/firefox

Monday, January 02, 2006

Session closing problem on browser close

You have a website which requires authentication to access certain pages. You write a code for the same and you manage to make it work for logging in and logging out. If the user is not logged in, the page cannot be accessed as you wanted.

But lets say the user logs in and before loggin out closes browser and leaves. Somebody else comes in and tries to go directly to the restricted page and gets in with the first user logged in. For this you can set the session.cookie_lifetime to '0' which keeps the session alive till browser is closed.

But again this has a problem. The session gets terminated on browser close only if the browser is non-tabbed like IE. The problem exists with tabbed browsers like firefox. If you wish to allow 2 logins at the same time in two different tabs in same window you cant. I found a more severe problem with firefox regarding sessions. Lets say you have multiple firefox windows opened. You login using 1 window. Close that window (not just tab) without loggin out, and try accessing the restricted page using a new or a already existing window and you are in. Isnt this something unexpected. Thats because firefox doesnt terminate sessions till firefox as a whole application is closed and not just the window is closed.

So be carefull when you use such browsers on a public access machine...

Sunday, January 01, 2006

Install PHP5 to be run in parallel with PHP4 in same apache web server instance.

I had PHP4 already installed as module. I wanted the XML functions included in PHP5. The scripts had previously been written in PHP4 and I didnt want to take the pain of changing the scripts. So searched for a way to install PHP5 to be run in parallel with PHP4 on the same Apache web server.
I use Apache 2.0.52 on Fedora core 3. So cant guarantee that this would be helpful to you.

I have installed PHP4 as module and PHP5 as cgi.

Create a cgi-sys folder in /usr/local.

Save the following script as a sh file and run it as root.
Dont forget to check the version of PHP5 you wish to install , the location of PHP currently installed and the location of conf directory for apache.

#!/bin/sh

VERSION=5.1.1
cd /usr/src
wget -O php.tbz2 "http://us3.php.net/get/php-${VERSION}.tar.bz2/from/this/mirror"
tar -xjvf php.tbz2
rm -f php.tbz2

cd php-${VERSION}

PHP='/usr/bin/php'

CFG=`$PHP -i | grep configure | sed "s/'//g" | sed "s/\.\/configure \(.*\)--with-apxs.*apxs \(.*\)/\1 \2/"`

CFGLINE="${CFG##* => } --prefix=/usr/local/php5 --exec-prefix=/usr/local/php5 --enable-force-cgi-redirect --enable-discard-path"

./configure $CFGLINE

HTTPD_CONF_DIR="/etc/httpd/conf"
make
make install

if [ -f /usr/local/php5/bin/php ]
then
# cp -f php.ini-recommended /usr/local/php5/lib/php.ini

cp /usr/local/php5/bin/php /usr/local/cgi-sys/php5
chown root:wheel /usr/local/cgi-sys/php5

echo "ScriptAlias /cgi-sys \"/usr/local/cgi-sys/php5\"" > $HTTPD_CONF_DIR/php5.conf
echo "Action application/x-httpd-php5 \"/cgi-sys/php5\"" > $HTTPD_CONF_DIR/php5.conf
echo "AddType application/x-httpd-php5 .php5" >> $HTTPD_CONF_DIR/php5.conf


TEST=`grep php5.conf $HTTPD_CONF_DIR/httpd.conf`

if [ "$TEST" = "" ]
then
echo "Include ${HTTPD_CONF_DIR}/php5.conf" >> $HTTPD_CONF_DIR/httpd.conf
/etc/init.d/httpd restart
fi
else
echo "There was an error..."
fi