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/




Sunday, 20 September 2015

USB_debuggin_enable

USB dubugging enable for new android mobile - Asus zenfone

http://firstandgeek.com/developer-option-usb-debugging-asus-zenfone-5/

Go to Settings

Click on About

Then Choose Software Information


Tap the Build Number for nearly 10 times, so that for each press, it shows you are near to the developer option. Continue until it unlocks the developer option for you.


After that go to the Settings page again. At the bottom, You could see the developer option as following.

Inside the developer option, there is USB debugging option.

Not only the USB debugging feature, but also Stake Away, Mock Location Allowing, Force RTL layout direction, animation scale, GPU rendering, Strict mode etc can be accessed by simply enabling this Developer option. As I owned Zenfone now, more Zenfone tips and tricks will be updated soon. if you have any problems regarding your Zenfone, kindly mail me and I will give you the answer.

sleep_android_activity

Thread closeActivity = new Thread(new Runnable() {
  @Override
  public void run() {
    try {
      Thread.sleep(3000);
      // Do some stuff
    } catch (Exception e) {
      e.getLocalizedMessage();
    }
  }
});

Showing hint of page on Nav Bar TAB

Nav bar - mouse over- show name of current tab/page show

<a href="index.html" title="Home" ></a>


 <ul class="nav">
       <li><a href="index.html" title="Home">Home</a></li>
            <li><a href="advisoryboard.html">Advisory Board</a></li>
     <li><a href="editorialboard.html">Editorial Board</a></li>
            <li><a href="instructionstoauthor.html">Instructions to Author</a></li>
  <li  class="active"><a href="indexing_listing.html">Indexing And Listing</a></li>  
            <li><a href="current_issues.html">Current Issue</a></li>
     <li><a href="archives.html">Archives</a></li>
  <li><a href="contactus.html">Contact Us</a></li>
      </ul>

jQuery Mobile: Stick footer to bottom of page:

jQuery Mobile: Stick footer to bottom of page:
=================================
add css:
----------
[data-role=page]{height: 100% !important; position:relative !important;}
[data-role=footer]{bottom:0; position:absolute !important; top: auto !important; width:100%;}


Disable Div.jqm-content :

css :
div.jqm-contne{ display:none; }

Fav_Icon_for web site

Convert your image to the ICO format :

http://image.online-convert.com/convert-to-ico

Upload image and set pixel 16x16

convert and download image as ico format..

Add this line in html page after meta Tag and before Css inclusion.

<link rel="icon" type="image/jpg" href="images/fav.ico">

Friday, 24 July 2015

Send mail with attachement in php:

Send mail with attachement in php: (MIME/application-pdf)
===============================================

<?php
$fileatt = "pdf/pdfname 1101.pdf"; // Path to the file                
$fileatt_type = "application/pdf"; // File Type
$fileatt_name = "pdf/pdfname 1101.pdf"; // Filename that will be used for the file as the attachment
$email_from = "user@webapp.net"; // Who the email is from
$email_subject = "Your attached file"; // The Subject of the email
$email_message = "Thanks for visiting mysite.com!  Here is your free file.<br>";
$email_message .= "Thanks for visiting.<br>"; // Message that the email has in it
$email_to = "siteadmin@webapp.net";//$_POST['email']; // Who the email is to
$headers = "From: ".$email_from;
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
   
$headers .= "\nMIME-Version: 1.0\n" .
            "Content-Type: multipart/mixed;\n" .
            " boundary=\"{$mime_boundary}\"";
$email_message .= "This is a multi-part message in MIME format.\n\n" .
                "--{$mime_boundary}\n" .
                "Content-Type:text/html; charset=\"iso-8859-1\"\n" .
               "Content-Transfer-Encoding: 7bit\n\n" .
$email_message .= "\n\n";
$data = chunk_split(base64_encode($data));
$email_message .= "--{$mime_boundary}\n" .
                  "Content-Type: {$fileatt_type};\n" .
                  " name=\"{$fileatt_name}\"\n" .
                  //"Content-Disposition: attachment;\n" .
                  //" filename=\"{$fileatt_name}\"\n" .
                  "Content-Transfer-Encoding: base64\n\n" .
                 $data .= "\n\n" .
                  "--{$mime_boundary}--\n";
$ok = @mail($email_to, $email_subject, $email_message, $headers);
if($ok) {
echo "<font face=verdana size=2><center>You file has been sent<br> to the email address you specified.<br>
Make sure to check your junk mail!<br>
Click <a href=\"#\" onclick=\"history.back();\">here</a> to return to mysite.com.</center>";
} else {
die("Sorry but the email could not be sent. Please go back and try again!");
}
?>

Thursday, 23 April 2015

Set and reset proxy for git and npm connection

 Set and reset proxy for git and npm connection:
--------------------------------------------------
Depending on whether the connection is behind a proxy or not, the proxy settings will need to set/reset correspondingly when using npm and git.

The command to set and reset the proxy are

# Set proxy for npm:
npm config set proxy http://proxy:8080
npm config set https-proxy http://proxy:8080

# Set proxy for git:
git config --global http.proxy http://proxy:8080
git config --global https.proxy http://proxy:8080





# reset proxy for npm
npm config rm proxy
npm config rm https-proxy


# reset proxy for git
git config --global --unset http.proxy
git config --global --unset https.proxy


# get proxy setting fro git

git config --global --list
npm config get list

npm config get proxy
npm config get https-proxy


Thanks for HELP :http://jonathanblog2000.blogspot.com/2013/11/set-and-reset-proxy-for-git-and-npm.html?showComment=1425635909327#c889755258776988581

Redux vs Redux Toolkit vs React Context

  These are often confused. Feature Redux Redux Toolkit Context API Purpose State management Simplifies Redux Shares values in Rea...