Friday 14 November 2014

Using Diffuse comparing and merging text files in Ubuntu

Diffuse is a graphical tool for comparing and merging text files. It can work with many revision control systems as a diff viewer or merge tool. Diffuse is able to compare an arbitrary number of files side-by-side (n-way merge), and gives the user the ability to manually correct line matching and directly edit the files.

Install Diffuse in Ubuntu
open Terminal Type Command:
sudo apt-get install diffuse
After compilation Installation, In terminal type
diffuse file1 file2

Eg:diffuse source.php sourcedemo.php

diffuse will be display like:

Thursday 16 October 2014

FourSquare API integration with PHP website


Hi Friends Previously Explain about how to create Foursquare App, Now Explain Integrating Foursquare in Website using PHP with App Credentials Now, we will use a PHP library which is readily available here: Foursquare Libraries We will use the PHP one marked in red in below screenshot:

Tuesday 14 October 2014

How to create a Foursquare app ?


Hi Friends Previously I am Explain about how to create Facebook , Twitter and Google App, Now Expalin about how to create Foursquare App It is very is process completed in 3 steps.
1. Go to Developers section of FourSquare and click on My Apps at the top of the page.Foursquare

Friday 10 October 2014

Snow Effect using jQuery


In this article explain about snow effect using jquery the following code is used for display snow effect, In this using size and colr values are minSize:5,maxSize:10,flakeColor:white.



Wednesday 8 October 2014

Security for online webfolders using .htaccess

Today I am going to tell you about .htaccess file, this is very basic thing to hide folder file lists by using htaccess, when we are holding some file in our website that files are listed as file in web folder. So that is hack-able by visitor or hackers, so we have to make secure our web folder files. for that we are going to use htaccess.

Saturday 20 September 2014

Add Contacts to Gamil using PHP Curl


Hi Friends I am previously Explan about how to getting google(Gmail) contacts using Google API with php, you can find the process of getting gamil contacts Article here Getting Google Contacts
Now explain about how to add contacts to our gmail account it is very is process through PHP Curl in this process we need "access_token". the following snippet of code is used for add contacts to my gmail account.



Friday 19 September 2014

Use PHP To Detect An Ajax Request

Here is a quick PHP snippet that you can use to tell if the request coming to the page is from a form or from an Ajax request.
Where a page is being accessed by AJAX it will post data using XML, PHP can then pick up on the HTTP request and see what the return is expecting. For this you just need to use the PHP server variable and grab the parameter HTTP_X_Requested_With.
For this you just need to use the PHP server variable and grab the parameter HTTP_X_Requested_With.
$_SERVER['HTTP_X_REQUESTED_WITH']
if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
{
From Ajax

}else{
Not Ajax

}

Thursday 18 September 2014

Get Latitude,Longitude Coordinates and Address from Postl code or Address Using Javascript and Display a Google Map

In this Article Explain about How to Getting Latitude,Longitude Coordinates and Address using Postal code or location with Javascript.
Hi there! I’m working at the moment on a project, where every user fills in their address when registering on the website they enter postalcode remaing fields automatically filled.

Friday 22 August 2014

How to Backup MySQL Database?

To take a backup of MySQL database or databases, the database must exist in the database server and you must have access to it. The format of the command would be.

# mysqldump -u [username] –p[password] [database_name] > [dump_file.sql]
The parameters of the said command as follows.
[username] : A valid MySQL username. 
[password] : A valid MySQL password for the user. 
[database_name] : A valid Database name you want to take backup. 
[dump_file.sql] : The name of backup dump file you want to generate.

Thursday 31 July 2014

Checking if Cookies are Enabled in Browser

The simplest way to check for cookies is via JavaScript. The following function will return a boolean value -> true if cookies are enabled:, otherwise will return false.
<script >
function are_cookies_enabled()
  {
 var cookieEnabled = (navigator.cookieEnabled) ? true : false;

 if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled)
 { 
  document.cookie="testcookie";
  cookieEnabled = (document.cookie.indexOf("testcookie") != -1) ? true : false;
 }
 return (cookieEnabled);
  }

 var result= are_cookies_enabled();
 alert(result);
</script>

A snippet of code using the function above was executed when you loaded this page. resutl will display true or false

Monday 28 July 2014

Delete image from folder in php

We are using image upload coding image moved on particular folder. after delete that database record data only deleted but image stay on same folder,Following line of code is used to Delet image from folder.
unlink('foldername/'.$imagename);
<?php
if(file_exists('imagesfolder/'.$image_name)){
  unlink('imagesfolder/'.$image_name);
}
?>

Thursday 24 July 2014

Get all dates between two dates using php code.

In this Example giving two dates as "2014-07-24" and "2014-07-31" it return all days between these two dates.
<?php
function getAllDatesBetweenTwoDates($strDateFrom,$strDateTo)
{
    $aryRange=array();

    $iDateFrom=mktime(1,0,0,substr($strDateFrom,5,2),     substr($strDateFrom,8,2),substr($strDateFrom,0,4));
    $iDateTo=mktime(1,0,0,substr($strDateTo,5,2),     substr($strDateTo,8,2),substr($strDateTo,0,4));

    if ($iDateTo>=$iDateFrom)
    {
        array_push($aryRange,date('Y-m-d',$iDateFrom)); // first entry
        while ($iDateFrom<$iDateTo)
        {
            $iDateFrom+=86400; // add 24 hours
            array_push($aryRange,date('Y-m-d',$iDateFrom));
        }
    }
    return $aryRange;
}

$fromDate = '2014-07-24';
$toDate = '2014-07-31';

$dateArray = getAllDatesBetweenTwoDates($fromDate, $toDate);

    print_r($dateArray);

?>
Output will be :

Friday 13 June 2014

Get Facebook Likes Count of a page using Graph API

This small code snippet given below uses FaceBook’s graph api and returns the likes count of the page. There is no need to have the FaceBook access token to call the api and get the result.
<?php
//The following code returns the Number of likes for any facebook page.
 
//Page Id of Knowledgecotner Replace it with your page.
$page_id = "556271807742934";
$likes = 0; //Initialize the count
 
//Construct a Facebook URL
$json_url ='https://graph.facebook.com/'.$page_id.'';
$json = file_get_contents($json_url);
$json_output = json_decode($json);
 
//Extract the likes count from the JSON object
if($json_output->likes){
    $likes = $json_output->likes;
}

//Printing the count
echo $likes.' Facebook Fans';
?>

Tuesday 10 June 2014

How To Display Twitter Followers Count In PHP


Twitter is one of the most used social networking websites on the internet. Twitter API allows you to retrieve info for specific user. All you need to do is to enter the handler of the user. You can easily retrieve a specific Twitter user’s followers count with a small snippet:

Friday 6 June 2014

Php : create pdf from html using mpdf


MPDF
Many php applications need to create pdf of documents like invoice , receipt and even id card etc. In this article we shall create a pdf invoice using the mpdf pdf creation library. Mpdf is made in php without any other external library. Mpdf parses css much better than any other free pdf libraries like tcpdf and creates pdf files which resemble the original html file to a large extent. Along with html to pdf, mpdf can also be used to create 1d barcodes of various formats.

Friday 30 May 2014

Cron Job in ubuntu with php


Hi Friends Today iam working on cron job, it is Easy Process.....

If we put the file in cron, It will run automatically by setting the time limit. Using time limit we have run the file every min/hour/day/month etc.

Monday 12 May 2014

Get User info using JS SDK after login with Facebook


To day iam working with facebook js sdk it is very easy to get user details after user login to facebook.
<script src="http://connect.facebook.net/en_US/all.js"></script>
  <script type="text/javascript">
  FB.init({
      appId  : 'your AppId',
      status : true,
      cookie : true,
      xfbml  : true
  });
                FB.login(function (response) {
   getFBuserData ();
      });
  function getFBuserData () {
                   FB.api('/me', function(data){
                  var userdetails = data.first_name+ data.last_name + data.id+data.gender+data.link+data.birthday+data.email;
                    alert(userdetails);
          
                })
         }
</script>

Friday 9 May 2014

How to install SSL Certificates with Apache 2 on Ubuntu


Step – 1 Create a Certificate Signing Request(CSR file)

A CSR is an encrypted body of text. Your CSR will contain encoded information specific to your company and domain name; this information is known as a Distinguished Name or DN.
In the DN for most servers are the following fields: Country, State (or Province), Locality (or City), Organization, Organizational Unit, and Common Name.


Saturday 3 May 2014

Merge images using php


Iam explain about how to merge images using php
The following lines of code is used to merge images.
<?php
header('Content-Type: image/jpeg');

$backgroundimage = imagecreatefromjpeg('tshirt.jpg');
$overlayimage= imagecreatefrompng('Buy-Now.png');

imagecopy($backgroundimage, $overlayimage, 100, 200, 0, 0, 130, 40);
imagejpeg($backgroundimage, null, 100); 

?>
Before merge Images:












After merge the Images:



Tuesday 29 April 2014

Install,Uninstall/Remove,Update Package through apt-get in Ubuntu


What is apt-get
apt-get is a powerful command-line tool used for package management in Debian Linux distribution. It used to work with Ubuntu’s APT (Advanced Packaging Tool) library to Install/manage individual packages , Remove installed package, Upgrade packages etc.
To install package through apt-get package manager
For installing package, just write apt-get install and mention the name of package.
apt-get install package-name
For example- If i need to install phpmyadmin
apt-get install phpmyadmin
NOTE: if you get permission denied error, then use sudo with this command. To install any package or software in Ubuntu you need root access.
sudo apt-get install phpmyadmin
once you type and enter, it ask password for root user

Wednesday 16 April 2014

PHP 5.4 traits tutorial,example and concept


As of PHP 5.4.0, PHP implements a method of code reuse called Traits.
PHP 5.4 introduces the concept of traits. Until Traits PHP uses Classical inheritance model in which one class can inherit only one class. In simple words Before PHP 5.4 PHP uses single inheritance model , which makes sometimes difficult to reuse the code.

Traits allow developer to reuse sets of methods freely in several independent classes living in different class hierarchies.

Saturday 5 April 2014

How to Download CSV File in PHP

CSV stands for Comma Separated Values. This file format is commonly used to store data, export data from database etc.
Let’s create a CSV with more values. Now we are creating CSV with following header and multiple records.



Wednesday 26 March 2014

How to create lazy loading images using jQuery

How to create lazy loading images using jQuery The Lazy plugin for jQuery load specified images after the page load itself and speed up your loading time,
useful jQuery plugin which can load images on page scroll called lazy loading, if you used high resolution images on your website then it’s a best solution for you to make your web site looks professional. This makes the page load faster and reduce server traffic since the client loads the images in the region what they look at.



Friday 21 March 2014

How to Increase PHP Memory Limit


How to Increase PHP Memory Limit When you saw an error like “Fatal Error: Allowed memory size of xxxxxx bytes exhausted” either in browser or server logs, it means PHP had exhausted the max memory limit. Mostly, this is due to the insufficient memory allocated for PHP script. And in this article, we will talk about how to increase the memory limit of PHP.
Check PHP memory_limit
To see how much memory allocated for you php, you need to create a file on your server (like view_php_info.php), and put following code in it:
<?php phpinfo();?>
Visit it in your browser, you’ll see a table which lists out all the config about current php environment. Search for “memory_limit”, you’ll see:

Saturday 15 March 2014

Extract images and links from website using php


Extract website data using php Web Crawling. The process by which we extract images, hyperlinks, metadata and several other things from a website is called web crawling. So in this tutorial you will learn about how to crawl images and hyperlinks from a website using php.And also I have used here jquery ajax for displaying the results without page refreshing, and its not mandatory.

Wednesday 5 March 2014

Autocomplete with PHP, MySQL and Jquery


Autocomplete with PHP, jQuery and MySQL Autocomplete Php is a cool technic you should learn to make your website or you web application looks cool and also user friendly. As you might have known, autocomplete gives a user a list of nearly same data with what he or she is looking for.


Friday 28 February 2014

Save an image from URL using php


save an image from URL then save it into a directory php Iam Explain about how to save an image form External URL,It is very simple using following code
<?php
  $imageurl ='http://sri-knowledgecorner.rhcloud.com/images/blogicon.jpeg';

  $image=file_get_contents($imageurl);
 
  $imagename = basename($imageurl);//image name
 
  define('DIRECTORY', 'images/'); //save image in images folder

  file_put_contents(DIRECTORY.$imagenam, $image);
?>
Make sure that you have write permission to the directory where you want to store the image.

Tuesday 11 February 2014

Upload and display an image without a page refresh using Javascript and PHP


Upload and display an image Here Iam explain about how to upload an image without a page refresh using an iframe and some javascript.
Bunch of jquery plugins that do this, but you’ll see here that there is nothing really complicated about it and it can easily be achieved with a couple of javascript lines.

The trick to avoid this full page refresh is to use a ‘target’ attribute on the form and have it point to an iframe. As the submit button is clicked, the browser will load up the response in the targeted iframe without refreshing the whole page.

Tuesday 4 February 2014

Top Five Most Used PHP Array Functions for Beginners


Array Functions in PHP There is more than fifty array functions available in PHP.
In this Article Iam explain 5 popular array functions


Friday 31 January 2014

What is memcache and why you use memcache for your website


Memcache with PHP Memcache is Free & open source, high-performance, distributed memory object caching system which improves the website performance In simple words every time your website opens it fetches data from database. Memcache cache this data locally on temporary cache so that every time your website page open it won’t run sql queries to fetch data from DB.

How to Install Memcache in Ubuntu

Thursday 23 January 2014

Difference Between Single And Double Quotes in PHP


Difference Between Single And Double Quotes in PHP In PHP you can specify the strings by using single and double quotes. There are other methods (heredoc and nowdoc (since PHP 5.3.0)) are also used but first two are used mostly.
It is important to know the difference between using single quotes and double quotes. In this post we will see the difference between them and which should be used when


Single Quotes:
When string is specified in single quotes PHP will not evaluate it or interpret escape characters except single quote with backslash (‘) and backslash(\) which has to be escaped.
  <?php
   $name = 'srinu chilukuri';
   $member = 'This is $name';
   echo $member;
     ?>
If echo $member variable it will print the result as it is without interpreted.

output: This is $name

Double Quotes:
In double quoted strings other escape sequences are interpreted as well any variable will be replaced by their value.
  <?php
   $name = 'srinu chilukuri';
   $member = "This is $name";
   echo $member;
     ?>
output: This is srinu chilukuri

Sunday 5 January 2014

What is Filezilla and how to use it ?

What is Filezilla and how to use it?

FileZilla is a free,open source and cross-platform FTP/SFTP client used to upload files to web server from local machine.
FileZilla is a popular FTP/SFTP used by most of people. Its interface and functionality is more user friendly. And main thing is its secure.
i will explain in this article how to upload files to server using FileZilla?

First download the FileZilla from its official website.Download the FileZilla here. Download the FileZilla according to your OS. Once the application has been downloaded install FileZilla and run the application.

Now we have to do some setting to connect to web server.
Launch the FTP client software on your local computer.