Thursday 15 September 2011

Web browser hacks/Fix, Css hacks - ie, firefox, chrome, safri, Opera


CSS hacks take advantage of browser bugs for hiding CssRules from specific web browsers. Listed below are the hacks for major browsers like ie6, ie7, firefox2, firefox3, Google chrome, safari and opera.

Inline Hack for IE
* (star) can be used as the inline hack for both ie6 and ie7.

For Example:
Syntax: .selector{*property:value;}
.logo{*margin-left:10px;}

IE6 browser inline Hack
_ (underscore) can be using only for ie6

For Example:
Syntax: .selector{_property:value;}
.logo{_margin-left:10px;}

Firefox inline style
content:"\"/*" can be used for firefox only where IE cannot recognize it.

Internal Style
Use * html for ie6 and *+html hack for ie7

For Example:
Synatax: * html .selector{property:value;} , * + html .selector{property:value;}

* html .logo{margin-left:10px;} for ie6
* + html .logo{margin-left:20px;} for ie7

IE7 and Firefox browser Hack
Use html>body hack for ie7 and firefox.

For Example:
Syntax: html>body .selector{property:value;}

html>body .logo{margin-left:10px} will take only in ie7 and firefox

Mordern browser Hack or Firefox Hack
Use html>/**/body {} hack which will support only in both firefox2 and firefox3.

For Example:
Syntax: html>/**/body .selector{property:value;}

html>/**/body .logo{margin-left:10px} will take only in firefox.

Browser hack for Opera versions 9 and below
Use html:first-child {} for opera browser. Also you use
Syntax: @media all and (min-width:0px) {head~body .selector {property:value;}}

For Example:
@media all and (min-width:0px) {head~body .logo {margin-left:10px;}} only for opera

Firefox3 browser hack
Use html>/**/body .selector, x:-moz-any-link, x:default {property:value;} for firfox3 only.

For Example:
Syntax: html>/**/body .pro_yl, x:-moz-any-link, x:default {background:red;}

Google Chrome browser hack
Use body:nth-of-type(1) .elementOrClassName{property:value;} only for google chrome.

For Example:
body:nth-of-type(1) .logo{margin:20px;}

Safari browser hack
Use Syntax: body:first-of-type .elementOrClassName{property:value;}

Fox Example:
body:first-of-type .logo{margin-top:10px;} only for safari.

Wednesday 29 June 2011

Web developers find variations of any color


Web developers find variations of any color from

http://0to255.com/

how to make same browser mode in IE8

If any AJAX or floting functionality is not working in IE cause of get different browser mode automatically then you should put following code:-

If you want same browser mode in IE, you need to put following code :

<meta http-equiv="X-UA-Compatible" content="IE=8" >


Monday 9 May 2011

quickquote_ajax.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script src="jquery-1.4.4.js" type="text/javascript"></script>
<title>Untitled Document</title>
</head>

<body>
    <form name="frmQuote" action="" method="post">
    <input type="hidden" name="txtTotal" id="txtTotal" value="2" />
    <table width="100%">
        <tr>           
            <td colspan="3" width="64%">&nbsp;</td>
            <td width="10%" align="center">&nbsp;</td>
            <td width="10%"><strong>PRICE</strong></td>
            <td width="10%" align="center">&nbsp;</td>
            <td width="6%">&nbsp;</td>
        </tr>
        <tr>           
            <td colspan="3"  width="64%">&nbsp;</td>
            <td width="10%"><strong>Type1</strong></td>
            <td width="10%"><strong>Type2</strong></td>
            <td width="10%"><strong>Type3</strong></td>
            <td width="6%">&nbsp;</td>
        </tr>
        <tr>
            <td width="20%">Width (cm)&nbsp;<input type="text" name="txtwidth1" id="txtwidth1" onblur="javascript:calculateQuickQuote('1');"/></td>
            <td width="20%">Height (cm)&nbsp;<input type="text" name="txtheight1" id="txtheight1" onblur="javascript:calculateQuickQuote('1');"/></td>
            <td width="24%">Number or blinds&nbsp;<input type="text" name="txtnoblinds1" id="txtnoblinds1" onblur="javascript:calculateQuickQuote('1');"/></td>
            <td width="10%"><span id="type11"></span><input type="hidden" name="txttype11" id="txttype11" value="" /></td>
            <td width="10%"><span id="type12"></span><input type="hidden" name="txttype12" id="txttype12" value="" /></td>
            <td width="10%"><span id="type13"></span><input type="hidden" name="txttype13" id="txttype13" value="" /></td>
            <td width="6%">&nbsp;</td>
        </tr>
        <tr>
            <td width="20%">Width (cm)&nbsp;<input type="text" name="txtwidth2" id="txtwidth2" onblur="javascript:calculateQuickQuote('2');"/></td>
            <td width="20%">Height (cm)&nbsp;<input type="text" name="txtheight2" id="txtheight2" onblur="javascript:calculateQuickQuote('2');"/></td>
            <td width="24%">Number or blinds&nbsp;<input type="text" name="txtnoblinds2" id="txtnoblinds2" onblur="javascript:calculateQuickQuote('2');"/></td>
            <td width="10%"><span id="type21"></span><input type="hidden" name="txttype21" id="txttype21" value="" /></td>
            <td width="10%"><span id="type22"></span><input type="hidden" name="txttype22" id="txttype22" value="" /></td>
            <td width="10%"><span id="type23"></span><input type="hidden" name="txttype23" id="txttype23" value="" /></td>
            <td width="6%">&nbsp;</td>
        </tr>
        <tr>
            <td colspan="6">
            <div id="addExtraFields"></div>
            </td>
        </tr>
        <tr>
            <td colspan="6" align="left">
                <input type="button" name="btnaddsize" value="Add different size" onclick="javascript:return addSize();"/>
            </td>
        </tr>
        <tr>           
            <td colspan="3"  width="60%" align="right"><strong>Total: &nbsp;</strong></td>
            <td width="10%"><span id="total1"></span></td>
            <td width="10%"><span id="total2"></span></td>
            <td width="10%"><span id="total3"></span></td>
            <td width="10%">&nbsp;</td>
        </tr>
    </table>
    </form>
   
<script type="text/javascript">
function calculateQuickQuote(num)
{
    var width = 1;
    var height = 1;
    var noblinds = 1;
    if(isNaN(eval("document.getElementById('txtwidth"+num+"').value")) && eval("document.getElementById('txtwidth"+num+"').value!=''"))
    {
        alert("Invalid value!");
        eval("document.getElementById('txtwidth"+num+"').value=''");               
        return false;
    }
    if(isNaN(eval("document.getElementById('txtheight"+num+"').value")) && eval("document.getElementById('txtheight"+num+"').value!=''"))
    {
        alert("Invalid value!");
        eval("document.getElementById('txtheight"+num+"').value=''");
        return false;
    }
    if(isNaN(eval("document.getElementById('txtnoblinds"+num+"').value")) && eval("document.getElementById('txtnoblinds"+num+"').value!=''"))
    {
        alert("Invalid value!");
        eval("document.getElementById('txtnoblinds"+num+"').value=''");
        return false;
    }   
    if(eval("document.getElementById('txtwidth"+num+"').value!=''"))
    {
        width = eval("document.getElementById('txtwidth"+num+"').value");
    }
    if(eval("document.getElementById('txtheight"+num+"').value!=''"))
    {
        height = eval("document.getElementById('txtheight"+num+"').value");
    }
    if(eval("document.getElementById('txtnoblinds"+num+"').value!=''"))
    {
        noblinds = eval("document.getElementById('txtnoblinds"+num+"').value");
    }
   
   
    if(eval("document.getElementById('txtnoblinds"+num+"').value!=''") && eval("document.getElementById('txtheight"+num+"').value!=''") && eval("document.getElementById('txtwidth"+num+"').value!=''"))
    {
    url = "quickquote_calculation.php?width="+width+"&height="+height+"&noblinds="+noblinds;
   
    var response = $.ajax({ type: "GET",  
                        url: url,  
                        async: false,
                        success : function(calculation)
                        {
                            eval("document.getElementById('type"+num+"1').innerHTML="+calculation+"");
                            eval("document.getElementById('txttype"+num+"1').value="+calculation+"");
                            eval("document.getElementById('type"+num+"2').innerHTML="+calculation*2+"");
                            eval("document.getElementById('txttype"+num+"2').value="+calculation*2+"");
                            eval("document.getElementById('type"+num+"3').innerHTML="+calculation*3+"");
                            eval("document.getElementById('txttype"+num+"3').value="+calculation*3+"");
                        }
                      });
   
    var total = document.getElementById('txtTotal').value;
   
    var totWidth = 0;
    var totHeight = 0;
    var totNoBlinds = 0;
    for(var i=1;i<=total;i++)
    {
        if(eval("document.getElementById('txttype"+i+"1').value")!="")
        {
            totWidth+=parseInt(eval("document.getElementById('txttype"+i+"1').value")) ;
        }
        if(eval("document.getElementById('txttype"+i+"2').value")!="")
        {
            totHeight+=parseInt(eval("document.getElementById('txttype"+i+"2').value")) ;
        }
        if(eval("document.getElementById('txttype"+i+"3').value")!="")
        {
            totNoBlinds+=parseInt(eval("document.getElementById('txttype"+i+"3').value")) ;
        }
    }
    document.getElementById('total1').innerHTML = "$"+totWidth;
    document.getElementById('total2').innerHTML = "$"+totHeight;
    document.getElementById('total3').innerHTML = "$"+totNoBlinds;
    }
}

function addSize()
{
    var total = parseInt(document.getElementById('txtTotal').value)+1;
    document.getElementById('txtTotal').value = total;
   
    dv = document.createElement('div');
    dv.setAttribute('id',"div"+total);
   
    dv.innerHTML='<table width="100%"><tr><td width="20%">Width (cm)&nbsp;<input type="text" name="txtwidth'+total+'"+ id="txtwidth'+total+'" onblur="javascript:calculateQuickQuote('+total+');"/></td><td width="20%">Height (cm)&nbsp;<input type="text" name="txtheight'+total+'" id="txtheight'+total+'" onblur="javascript:calculateQuickQuote('+total+');"/></td><td width="22%">Number or blinds&nbsp;<input type="text" name="txtnoblinds'+total+'" id="txtnoblinds'+total+'" onblur="javascript:calculateQuickQuote('+total+');"/></td><td width="10%" style="padding-left:27px;"><span id="type'+total+'1"></span><input type="hidden" name="txttype'+total+'1" id="txttype'+total+'1" value="" /></td><td width="10%" style="padding-left:27px;"><span id="type'+total+'2"></span><input type="hidden" name="txttype'+total+'2" id="txttype'+total+'2" value="" /></td><td width="10%" style="padding-left:27px;"><span id="type'+total+'3"></span><input type="hidden" name="txttype'+total+'3" id="txttype'+total+'3" value="" /></td><td width="2%"><img src="delete_icon.png" onclick="javascript:deleteElement(\''+total+'\');" /></td></tr></table>';
   
    // attach event onmouseclick to the created div tag

    //finally add the div id to ur form
    //document.frmQuote.addExtraFields.appendChild(dv);
    document.getElementById('addExtraFields').appendChild(dv);
   
}

function deleteElement(id)
{
    eval("document.getElementById('txttype"+id+"1').value=0");
    eval("document.getElementById('txttype"+id+"2').value=0");
    eval("document.getElementById('txttype"+id+"3').value=0");
    document.getElementById('div'+id).style.display='none';
    setValues();
}

function setValues()
{
    var total = document.getElementById('txtTotal').value;
   
    var totWidth = 0;
    var totHeight = 0;
    var totNoBlinds = 0;
    for(var i=1;i<=total;i++)
    {
        if(eval("document.getElementById('txttype"+i+"1').value")!="")
        {
            totWidth+=parseInt(eval("document.getElementById('txttype"+i+"1').value")) ;
        }
        if(eval("document.getElementById('txttype"+i+"2').value")!="")
        {
            totHeight+=parseInt(eval("document.getElementById('txttype"+i+"2').value")) ;
        }
        if(eval("document.getElementById('txttype"+i+"3').value")!="")
        {
            totNoBlinds+=parseInt(eval("document.getElementById('txttype"+i+"3').value")) ;
        }
    }
    document.getElementById('total1').innerHTML = "$"+totWidth;
    document.getElementById('total2').innerHTML = "$"+totHeight;
    document.getElementById('total3').innerHTML = "$"+totNoBlinds;
}
</script>
</body>
</html>

Friday 6 May 2011

responsefile.php

<?PHP
define('DB_SERVER', 'localhost'); // eg, localhost - should not be NULL
define('DB_USERNAME', 'root');  // MySql user
define('DB_PASSWORD', ''); // MySql user password
define('DB_DATABASE', 'ajax'); // MySql DB

$user = DB_USERNAME;
$pass = DB_PASSWORD;
$server = DB_SERVER;
$dbase = DB_DATABASE;
$conn = mysql_connect($server,$user,$pass);
mysql_select_db($dbase,$conn);

$qu = "select * from team where id=".$_REQUEST['va'];
$res = mysql_query($qu);

$m = 0;
$arr = array();
$str = '<table>';
while($result = mysql_fetch_array($res))
{
    $str.='<tr><td>'.$result['team'].'</td><td>'.$result['sch1'].'</td><td>'.$result['sch2'].'</td><td>'.$result['sch3'].'</td><td>'.$result['sch4'].'</td><td>'.$result['sch5'].'</td><td>'.$result['sch6'].'</td></tr>';   
}
$str.='</table>';
echo $str;exit;
?>

values.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script src="jquery-1.4.4.js" type="text/javascript"></script>
<script type="text/javascript">

function callAjax(va)
{
    $.ajax({
      url: "responsefile.php?va="+va,
      context: document.body,
      success: function(result){
          document.getElementById('tabl').innerHTML = result;
      }
    });
}
</script>
</head>

<body>
<?PHP
define('DB_SERVER', 'localhost'); // eg, localhost - should not be NULL
define('DB_USERNAME', 'root');  // MySql user
define('DB_PASSWORD', ''); // MySql user password
define('DB_DATABASE', 'ajax'); // MySql DB

$user = DB_USERNAME;
$pass = DB_PASSWORD;
$server = DB_SERVER;
$dbase = DB_DATABASE;
$conn = mysql_connect($server,$user,$pass);
mysql_select_db($dbase,$conn);

$qu = "select * from month where year=".date("Y");
$res = mysql_query($qu);

$m = 0;
$arr = array();
while($result = mysql_fetch_array($res))
{
    $arr[$m]['id'] = $result['id'];
    $arr[$m]['month'] = $result['month'];
    $arr[$m]['year'] = $result['year'];
    $m++;
}

$m = '';
for($i=0;$i<count($arr);$i++)
{
    $m.= '<a href=javascript:callAjax('.$arr[$i]['id'].');>'.$arr[$i]['month'].'</a>&nbsp;';
}
echo $m;
?>
<div id="tabl">
</div>
</body>
</html>

Monday 25 April 2011

Facebook FBML will not work now

Hello,


As per new changes on Facebook, we will no longer be able to use static FBML application.

Also the Facebook will no longer support FBML Page Tab Type with Canvas Type iFrame application. So all existing application using this will not work.

And the Facebook roadmap suggests to change all the static FBML applications to iFrame applications.

Starting from March 11, 2011 there are changes in the coding pattern of iFrame application and Facebook has shut down FBML and Static FBML applications.

You might want to inform the client about this if their Facebook pages / tab / application are built using static FBML or iFrame application with Page Tab Type = "FBML" will not work and resolve this issue.

However, these tabs will continue to work until the next Facebook update.

Please refer: http://developers.facebook.com/blog/post/462/

Monday 18 April 2011

Friday 15 April 2011

CCleaner

CCleaner is the number-one tool for cleaning your Windows PC. It protects your privacy online and makes your computer faster and more secure.

http://www.piriform.com/ccleaner

htaccess http to http www

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^arpan.com [NC]
RewriteRule ^(.*)$ http://www.arpan.com/$1 [L,R=301]

---------------------------------------------------------------------

/****************** Start - redirecting index.php to root /*****************************

RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.arpan.com/$1 [R=301,L]


/****************** End - redirecting index.php to root /*****************************

Paypal Sandbox

<form target="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="B7WZEHMFG3TTW">
<input type="image" src="https://www.sandbox.paypal.com/WEBSCR-640-20110401-1/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/WEBSCR-640-20110401-1/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

Steps to follow for auto return:-
My Account
Profile
Profile Summary
Selling Preferences
Website Payment Preferences
Turning on auto return

Thursday 14 April 2011

Get user Data from Twitter

    $xml = simplexml_load_file("http://twitter.com/users/show/USERNAME.xml");

                echo $xml->getName() . "<br />";
               
                foreach($xml->children() as $child)
                  {
                  echo $child->getName() . ": " . $child . "<br />";
                  }

Wednesday 13 April 2011

Get Twitter Followers

$twit = file_get_contents('http://twitter.com/users/show/USERNAME.xml');
            echo "<pre>";
            print_r($twit);
            $begin = '<followers_count>'; $end = '</followers_count>';
            $page = $twit;
            $parts = explode($begin,$page);
            $page = $parts[1];
            $parts = explode($end,$page);
            $tcount = $parts[0];
            if($tcount == '') { $tcount = '0'; }
           echo '<b> '.$tcount.' </b> Followers';