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.