Thursday 29 August 2013


How to install gnome3 on ubuntu




This article will help you to install gnome3 on ubuntu. people who are not interested in using unity can install gnome environment on their ubuntu machine.Gnome3 now comes with various new features

Read more >>

How to install curl on ubuntu




We only need to run following commands to install CURL for PHP on Ubuntu
srinu@ebiz:~$ sudo apt-get update

srinu@ebiz:~$ sudo apt-get install php5-curl

srinu@ebiz:~$ sudo service apache2 restart

Tuesday 27 August 2013

Birthday Dropdown using html and js validation


Birthday Dropdown using html and js , validation for selected year is not leaf year the day will show only 28 days
<html>
 <head>
 <script type="text/javascript">
  function call(){
 var kcyear = document.getElementsByName("year")[0],
  kcmonth = document.getElementsByName("month")[0],
  kcday = document.getElementsByName("day")[0];
       
 var d = new Date();
 var n = d.getFullYear();
 for (var i = n; i >= 1950; i--) {
  var opt = new Option();
  opt.value = opt.text = i;
  kcyear.add(opt);
    }
 kcyear.addEventListener("change", validate_date);
 kcmonth.addEventListener("change", validate_date);

 function validate_date() {
 var y = +kcyear.value, m = kcmonth.value, d = kcday.value;
 if (m === "2")
     var mlength = 28 + (!(y & 3) && ((y % 100) !== 0 || !(y & 15)));
 else var mlength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][m - 1];
 kcday.length = 0;
 for (var i = 1; i <= mlength; i++) {
     var opt = new Option();
     opt.value = opt.text = i;
     if (i == d) opt.selected = true;
     kcday.add(opt);
 }
     }
    validate_date();
  }
 </script>
 </head>
   <body>
        <div class="register-form-row">
      <div class="register-form-row-col">Date Of Birth :</div>
      <div class="register-form-row-col">Month :<select name="month" onchange="call()" >
         <option value="">select</option>
         <option value="1">Jan</option>
         <option value="2">Feb</option>
         <option value="3">Mar</option>
         <option value="4">Apr</option>
         <option value="5">May</option>
         <option value="6">Jun</option>
         <option value="7">Jul</option>
         <option value="8">Aug</option>
         <option value="9">Sep</option>
         <option value="10">Oct</option>
         <option value="11">Nov</option>
         <option value="12">Dec</option>
        </select>
        Day :<select name="day" >
           <option value="">select</option>
          </select>
        Year:<select name="year" onchange="call()">
           <option value="">select</option>
          </select>
               </div>
       </div>
   </body>
</html>
Demo
Date Of Birth :
Month : Day : Year:

Wednesday 21 August 2013

Get the value from a select box and display their value.Using jQuery


Display select box selected value using jQuery......
<html lang="en">
 <head>
   <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
 </head>
  <body>
  <p></p>
 <select id="kc">
   <option>knowledge</option>
   <option>cornor</option>
   <option>knowledgecornor</option>
   <option>srinu chilukuri</option>
 </select>
 <script>
   function displayVals() {
   var singleValues = $("#kc").val();
   $("p").html("<b>value:</b> " +
   singleValues );
   }
   $("select").change(displayVals);
   displayVals();
 </script>
 </body>
</html>
Demo:

Tuesday 20 August 2013

Facebook Slide Out Like Box Widget For Blog Or Website


Stylish facebook like box widget is design and it will slide out smooth when you place your cursor on the widget banner due to the jQuery effect.
For you to add this great widget to your blog, simply follow the few steps below.

Read more >>

Monday 19 August 2013


How to Install nginx webserver in ubuntu




Nginx (pronounced engine-x) is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server.with Nginx now hosts nearly 12.18% (22.2M) of active sites across all domains. Nginx is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption. it serves static content 50 times faster than Apache. nginx is a perfect load balancer can able to handle more than 7000 live request per second.


Read more >>

Input field accept only numeric valus (Trying to paste Text Content Not Accept)


This post will show you how to restrict keyboard inputs so that only numbers can only be pressed for a specific HTML element to ensure that the number-only fields get valid values, and trying to paste other than numerics its not accept.

Read more >>

Saturday 17 August 2013

Google API – Get contact list


Google API – Get contact list I am going to tell you about inviting friends. I think that this is the most important part for every website, a key to success. Today I will show you how to create simple and effective Gmail contact importer using OAuth authorization and API. Also, I will tell about obtaining Google API access too.

As the first step – lets prepare our own project in Google API console, please open this link https://code.google.com/apis/console/  and create your project. Then we need goto ‘API Access’ section and click ‘Create an OAuth 2.0 client ID’ button. Now we should fill a name for our new project:


Click next button, and, at the second step we should set URL of our destination page:


Finally, we’ve got our Client ID and secret (or – consumer key and secret):



Now – download the source files from Here  and lets start coding

index.php
<?php
  if (version_compare(phpversion(), "5.3.0", ">=")  == 1)
    error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
    else
    error_reporting(E_ALL & ~E_NOTICE); 

 $sClientId = 'Your Google Client Id';
 $sClientSecret = 'Your Client Secret ';
 $sCallback = 'http://localhost/srinu/googleapi/index.php'; // change it to your call back url!
 $iMaxResults = 90; // max results
 $sStep = 'auth'; // current step

   include_once('GmailOath.php');

   session_start();

 // prepare new instances of GmailOath  and GmailGetContacts
 $oAuth = new GmailOath($sClientId, $sClientSecret, $argarray, false, $sCallback);
 $oGetContacts = new GmailGetContacts();

if ($_GET && $_GET['oauth_token']) {

    $sStep = 'fetch_contacts'; // fetch contacts step

    // decode request token and secret
    $sDecodedToken = $oAuth->rfc3986_decode($_GET['oauth_token']);
    $sDecodedTokenSecret = $oAuth->rfc3986_decode($_SESSION['oauth_token_secret']);

    // get 'oauth_verifier'
    $oAuthVerifier = $oAuth->rfc3986_decode($_GET['oauth_verifier']);

    // prepare access token, decode it, and obtain contact list
    $oAccessToken = $oGetContacts->get_access_token($oAuth, $sDecodedToken, $sDecodedTokenSecret, $oAuthVerifier, false, true, true);
    $sAccessToken = $oAuth->rfc3986_decode($oAccessToken['oauth_token']);
    $sAccessTokenSecret = $oAuth->rfc3986_decode($oAccessToken['oauth_token_secret']);
    $aContacts = $oGetContacts->GetContacts($oAuth, $sAccessToken, $sAccessTokenSecret, false, true, $iMaxResults);

    // turn array with contacts into html string
    $sContacts = $sContactName = '';
    foreach($aContacts as $k => $aInfo) {
        $sContactName = end($aInfo['title']);
        $aLast = end($aContacts[$k]);
        foreach($aLast as $aEmail) {
            $sContacts .= '<p>' . $sContactName . '(' . $aEmail['address'] . ')</p>';
        }
    }
  } else {
    // prepare access token and set it into session
    $oRequestToken = $oGetContacts->get_request_token($oAuth, false, true, true);
    $_SESSION['oauth_token'] = $oRequestToken['oauth_token'];
    $_SESSION['oauth_token_secret'] = $oRequestToken['oauth_token_secret'];
 }

?>
<!DOCTYPE html>
<html lang="en" >
    <head>
        <meta charset="utf-8" />
        <title>Google API - Get contact list | Sri info</title>
        
    </head>
    <body>
       <h1> Get Contect List using Google api<h1>
       

    <?php if ($sStep == 'auth'): ?>
        <center>
        <h3>Step 1. OAuth</h3>
        <h4>Please click <a href="https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=<?php echo $oAuth->rfc3986_decode($oRequestToken['oauth_token']) ?>">this link</a> in order to get access token to receive contacts</h4>
        </center>
    <?php elseif ($sStep == 'fetch_contacts'): ?>
        <center>
        <h2>Step 2. Results</h2>
       
        <?= $sContacts ?>
        </center>
    <?php endif ?>

</body>
</html>
When we click authorization button, it will open google authorization page, where we should grant access for our application to get our contact list:

JQuery Slider


Drag a handle to select a numeric value.
The basic slider is horizontal and has a single handle that can be moved with the mouse or by using the arrow keys


<html lang="en">
 <head>
  <meta charset="utf-8" />
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
   <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
   <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <script>
 $(function() {
 $( "#slider-range-max" ).slider({
 range: "max",
 min: 1,
 max: 100,
 value: 1,
 slide: function( event, ui ) {
 $( "#amount" ).val( ui.value );
 }
 });
 $( "#amount" ).val( $( "#slider-range-max" ).slider( "value" ) );
 });
  </script>
 </head>
   <body>
 <p>
    <form name="qnty" action="" method="post">
 <label for="amount">Quantity:</label>
 <input type="text" id="amount" readonly style="border: 0; color: #38761d; font-weight: bold;" name="qnty"/>
 </p>
 <div id="slider-range-max" style="cursor:pointer"></div>
 <br>
 <input type="submit" value="submit">
   </body>
  </form>
 </html>

Friday 16 August 2013

Extend phpMyAdmin time out


1)Go find phpmyadmin's config.inc.php
$ sudo gedit /etc/phpmyadmin/config.inc.php
2)Add these lines to the bottom of the file
$cfg['LoginCookieValidity'] = 60*60*24;
ini_set('session.gc_maxlifetime', $cfg['LoginCookieValidity']); 
3)Restart Apache
$ sudo service apache2 restart
If with above trick, still doesn't work, try to edit /etc/phpmyadmin/config.inc.php file, then search for
$cfg['Servers'][$i]['auth_type'] = 'cookie'
then edit / add the following
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'your_mysql_username';
$cfg['Servers'][$i]['password'] = 'your_mysql_password';

10 Simple Ways To Improve SEO Rankings




Thursday 15 August 2013

Connecting Microsoft SQL Server with PHP on Ubuntu



Here is how to get PHP 5.3 on Linux (specifically Ubuntu) talking to a Microsoft SQL Server database:

  1) Install FreeTDS and the PHP MS SQL extension

sudo apt-get install freetds-common freetds-bin unixodbc php5-sybase

  2) Restart Apache

sudo /etc/init.d/apache2 restart

  3) Configure FreeTDS

  Add this at the end of the file:
[yourserver]
host = your.server.name
port = 1433
tds version = 8.0
Test connection to the MSSQL server with this PHP script
<?php
 $server = 'your server name';
 $username = 'enter';
 $password = 'enter';
 $database = 'enter';
 $connection = mssql_connect($server, $username, $password);
 if($connection != FALSE)
  {
  echo "Connected to the database server OK<br />";
  }
 else
  {
  die("Couldn't connect");
  }
 
 if(mssql_select_db($database, $connection))
  {
  echo "Selected $database ok<br />";
  }
 else
  {
  die('Failed to select DB');
  }

 $query_result = mssql_query('SELECT @@VERSION');
 $row = mssql_fetch_array($query_result);
  if($row != FALSE)
  {
  echo "Version is {$row[0]}<br />";
  }
 mssql_free_result($query_result);
 mssql_close($connection);
 ?>

   

How to send SMS using PHP


How can I send SMS using PHP?
Actually this is easy process but for this you have to purchase an API to send SMS. But I have found a solution to show your project temporarily. I have an API that provides a free trial and allows to send 5 free SMS that is sufficient to show the project.

To integrate this you have to follow the following steps :

  1) Go to site http://vianett.com, on this site click on free trial as follow :



2) You will get a simple form, fill that form and after submission you will get a mail which will contain username and password.
   3) Now download the sms api from Here

   4) Place this file into your project folder

   5)  Now put the following code in the file and send SMS :
<html>
 <body>
   <h1></h1>
   <form method=post action='srisms.php'>
   <table border=0>
    <tr>
      <td>Recipient no:</td>
      <td><input type='text' name='recipient'></td>
    </tr>
    <tr>
      <td>Message</td>
      <td><textarea rows=4 cols=40 name='message' maxlength="140"></textarea></td>
    </tr>
    <tr>
      <td> </td>
      <td><input type=submit name=submit value=Send></td>
    </tr>
    </table>
   </form>
 </body>
</html>
srisms.php

Wednesday 14 August 2013

How to Get the Current Page URL


<?php
function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
?>
<?php
  echo curPageURL();
?>

How to check if the request came from mobile or computer using php



 Include Mobile_Detect.php file  Download from Here
<?php
require_once ('Mobile_Detect.php');
$detect = new Mobile_Detect;
$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
$scriptVersion = $detect->getScriptVersion();
?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,    minimum-scale=1.0, user-scalable=no">
</head>
<body>
    <p>This is a <b><?php echo $deviceType; ?></b></p>
</body>
</html>