Sunday 24 January 2016

Facebook - share Dialog - FB.Ui

Facebook Share Dialog: JavaScript and Angular JS
================================================

Register with Developer.facebook.com as developer in public profile (FB Id/user account Required)

Step:1
=======
list required are:

Domain Name, App Name(APPID), URL, OAuthRedirect Url, Review and status as public, Select platform as Website/Android/iOS...

Step:2
======
Include FB_SDK in index.html:

<script>
    (function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s);
        js.id = id;
        js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.5&appId=654932564610265";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
</script>

step:3
======
Add the facebook connect page - onclick open popup dialog - Required page and section

<li>
  <a target="_blank" ng-click="FBConnect()">
  <img class="fa fa-facebook" src="../../fb.png" /></a>
</li>


step:4
=======

Call or Define Controller method for FB- within controller

$scope.FBConnect = function() {

        FB.ui({
          method: 'share',
          href: 'http://trinet.bornbaby.com/',
          title: 'Bahubali',
          picture: 'http://trinet.bornbaby.com/blog/blog-ps-1.jpg/blog-ps-1.jpg',
          caption: 'Domain Internet',
          description: 'Dialogs provide a simple, consistent interface for applications to interface with users.',

        }, function(response) {});

      }

Auto start XAMPP when linux OS start / login

XAMPP:
=====
Automatically start it on login.
step:1
Open terminal and run following command.
$sudo gedit /etc/init.d/lampp

step:2
paste following code in opened file
#!/bin/bash
/opt/lampp/lampp start
save & close

step:3
run following command to make this script executable
$sudo chmod +x /etc/init.d/lampp

step:4
run following command to install init scripts to all runlevel
$sudo update-rc.d lampp defaults

step:5
restart the system

&
xampp would be start automatically. You can check it by opening
http://localhost in browser




Run Php - xampp in linux

How to run xampp php code in ubuntu:
------------------------------------
In this case you need to be root to start/stop LAMPP and to execute PHP code in it.

step:1
To become root just open the terminal and type the following command
(To avoid conflict stop lampp using this cmd $ /opt/lampp/lampp stop)
$sudo -i (Ntow the system by default as root. In older version ask password)


step:2
$cd /

step:3
ls

step:4
start lampp
$ /opt/lampp/lampp start

step:5
Write code - Terminal cmd
$gedit /opt/lampp/htdocs/FileName.php

New php editor open- Do your code here save and close

step:6
go browser ype:
http://localhost/FileName.php

Step:7
Rewrite the file
open file in terminal using
$ gedit /opt/lamp/htdocs/FileName.php


Note: My php root - www folder is located at computer->opt->lampp->htdocs

Linux - XAMPP

To start xampp in linux ubuntu:
-------------------------------

sudo /opt/lampp/lampp start

sudo /opt/lampp/lampp stop

sudo /opt/lampp/lampp restart

step:1
======
Go on XAMPP site and download XAMPP. URL to download XAMPP is
http://www.apachefriends.org/en/xampp-linux.html

step:2
Let the download complete. Confirm download by opening download folder.

step:3
Open terminal and move to download location. Verify that downloaded Xampp installer file exist there. If you have moved Xampp file in other folder than move that folder which contain Xampp file.

TERMINAL:$cd /home/[Username]/Downloads
TERMINAL:$ls

step:4
Make installer file to executable. Run following command

TERMINAL:$chmod +x xampp-linux-1.8.2-0-installer.run

Installation requires root privilege. Switch to root user. You need to suppply super user password to become root user. Super user is the user account which is created during the installation.

step:5
TERMINAL:$sudo -s -H

step:6
Run installer file
TERMINAL:$./xampp-linux-1.8.2-0-installer.run

step:7
Keep default selected component and click on next
Next->next->next->

step:8
XAMPP is successfully installed. But mysql server would not start automatically. You would get following error while accessing phpmyadmin
TERMINAL:$sudo /opt/lampp/lampp restart

STEP:9
Now access again phpmyadmin
http://localhost/phpmyadmin/