Life Moves On

My Experience With Technology

Friday, May 29, 2009

CSS Positioning

CSS postioning is a nightmare for an average web designers and programmers. I found a quick and execellent tutorial on css positioning. Find them below

1) http://www.barelyfitz.com/screencast/html-training/css/positioning/
2) http://www.autisticcuckoo.net/archive.php?id=2004/12/07/relatively-absolute

Labels: ,

Sunday, April 19, 2009

Outlook blocks outgoing mail when Avast turned on

I was using Microsoft outlook that has my Google account configured. I installed avast antivirus recently. Since then i was unable to send emails as i was getting the following message.

""Task 'pop.gmail.com-Sending' reported error (0x800CCC7D): "Your outgoing
(SMTP) server does not support SSL-secured connections. If SSL-secured
connections have worked in the past, contact your server administrator or
Internet service provider (ISP).'"


After much goggling and lots of trial and errors i could fix the problem by changing the outgoing mail server of my account to "smtp.googlemail.com" from "smpt.gmail.com" and setting the port to "465"

Labels: ,

Tuesday, April 07, 2009

SIte's index page being replaced

The nightmare for any site owner is his site getting hacked. These days we find hundreds of posting on their sites main page
getting replaced by an index.htm file, that holds an iframe, loading some Chinese , Turkish or Russian website. This index.htm file loads every time someone visits your site, bypassing your actual home page. The immediate solution is to delete this index.htm. But you will see that this page will be replaced within no time putting your site in bad shape as before.

So the next solution is to contact the hosting provider. No hosting provider would help you, they would say its just a programming issue or somebody hacked your site as you were not careful. Next option is to switch to a new hosting provider. The support form of every hosting provider will have at least few hundred threads on site's index pages being replaced. Hmmm no way out.

Very recently few of our company sites were affected with the same issue. I had a chance to go through the server log files. The log files clearly showed that someone from Turkey/Germany establishing an FTP connection to the server. He then uploads a index.htm page to the site. All the hacked sites showed the same log i.e. some one physically connecting to the site using FTP and uploading index.htm. So it was obvious that FTP password was compromised. We escaped further attacks by disabling FTP on our servers.

Now how do they steal the password?. There are lot of malicious sites when visited installs certain software automatically on our machine. These software will steal passwords including FTP passwords and will update the hawker’s database. The hacker’s intention is normally to redirect your visitors to his site , which he achieves by uploading his own index.htm file.

So next time your sites index page is replaced, accept that your FTP information is compromised and immediately change your sites FTP passwords. Don’t forget to delete the hacker’s index.htm file.

Labels: ,

Tuesday, March 17, 2009

Scroll 'div' to the bottom

If you would like to move your scroll to the bottom of a div, use the following code on page load function. This is very handy when you would like to create chat windows where the chat log div should always scrolled down to bottom to see the latest chat dialogs


body onload="document.getElementById('testdiv').scrollTop = document.getElementById('testdiv').scrollHeight"


This assumes that id of the div you want to work with has is "testdiv".

Labels: ,

Monday, March 09, 2009

Changing the background image of an element on mouseover

If you would like to change the background image of any element using javascript use the following code on the same tag

onmouseover="this.style.background='url(images/home2.gif) no-repeat';" onmouseout="this.style.background='url(images/home1.gif) no-repeat';"

Labels: , ,

Wednesday, December 10, 2008

Redirect http requests to https using javascript

Here is a function to redirect all http requests to https using client side javascript.
All requests are redirected to https://www.hostname



function redirectToSecure()
{


var curprot = new String(window.document.location.protocol); //get protocol
var curhost = new String(window.document.location.hostname); //get hostname

if ((curprot.indexOf("https")== -1) && (curhost.indexOf("www.")== -1)){
// if both 'https' & 'www' not present

document.location.href='https://www.'+document.location.hostname;

} else if((curprot.indexOf("https")== -1) && (curhost.indexOf("www.")!= -1)){
// if 'https' not present & 'www' present

document.location.href='https://'+document.location.hostname;

} else if((curprot.indexOf("https")!= -1) && (curhost.indexOf("www.")== -1)){
// if 'https' present & 'www' not present

document.location.href='https://www.'+document.location.hostname;

}


}

Labels: ,

Tuesday, November 25, 2008

Enabling gmail chat

Yesterday one of my friends wanted to chat with me very urgently. He wanted me to use gmail chat. When i logged into my gmail account i found that i am logged out of chat and gmail wanted me to re-login to chat. I tried clicking "enable chat" link on the bottom, moved to older standard version , altered all settings etc but i could nt fix the issues. After a long try i could fix the issue by clearing all google cookies in my browser. If anyone experience the same issue please follow the following method. In firefox go to tools --- options --- privacy --- show cookies --- select the google cookies from the list --- Remove cookies.