Ionic ngCordova social-sharing


ionic start ionic-ngcordova-social-sharing blank
cd ionic-ngcordova-social-sharing
bower install ngCordova
cordova platform add android
cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git
in index.html change to following:
<head>
...
< script src="lib/ngCordova/dist/ng-cordova.js" > < /script >
...
</head>
....
<body ng-controller="AppCtrl" >
....
<ion-content>
<textarea placeholder="Comments" ng-model="comments"></textarea>
<button class="button button-full button-positive" on-click="share()" on-tap="share()">
Share
</button>
<button class="button button-full button-positive" on-tap="shareByEmail()">
Share By Email
</button>

</ion-content>

...
</body>
...

in app.js change following:

angular.module('starter', ['ionic','ngCordova'])
...
.run(...
...
).controller('AppCtrl', function($scope, $cordovaSocialSharing) {$scope.comments = "";
$scope.share = function() {
$cordovaSocialSharing
.share($scope.comments, "My comment") // Share via native share sheet
.then(function(result) {
// Success!
}, function(err) {
// An error occured. Show a message to the user
});
}
$scope.shareByEmail = function() {

$cordovaSocialSharing
.shareViaEmail($scope.comments, "My comment", "someone@example.com")
.then(function(result) {
// Success!
}, function(err) {
// An error occurred. Show a message to the user
});
}
});

ionic build --android

ionic run --emulator

Install Hortonworks Hadoop with Ambari on Docker


name@host:/#docker run --name=data1 --hostname=data1 -it ubuntu /bin/bash

name@host:/#docker run --name=data2 --hostname=data2 -it ubuntu /bin/bash

name@host:/#docker run --name=name --hostname=name --link data1:data1 --link data2:data2 -it ubuntu /bin/bash

name@host:/#docker run --name=ambari --hostname=ambari --link data1:data1 --link data2:data2 --link name:name -it ubuntu /bin/bash

name@host:/#sudo bash -c "curl https://raw.githubusercontent.com/jpetazzo/pipework/master/pipework > /usr/local/bin/pipework"

name@host:/#sudo chmod u+x /usr/local/bin/pipework

name@host:/#sudo apt-get install iproute2

name@host:/#sudo /usr/local/bin/pipework br1 data1 192.168.0.50/24

name@host:/#sudo /usr/local/bin/pipework br1 data2 192.168.0.51/24

name@host:/#sudo /usr/local/bin/pipework br1 name 192.168.0.53/24

name@host:/#sudo /usr/local/bin/pipework br1 ambari 192.168.0.54/24

root@data1:~#passwd
Enter new UNIX password:root

root@data1:~#apt-get install ssh

root@data1:~#sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config

root@data1:~#/etc/init.d/ssh start
root@data1:~#ssh-keygen
root@data1:~#apt-get update

root@data2:~#passwd
Enter new UNIX password:root

root@data2:~#apt-get install ssh

root@data2:~#sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config

root@data2:~#/etc/init.d/ssh start
root@data2:~#ssh-keygen
root@data1:~#apt-get update

root@name:~#passwd
Enter new UNIX password:root

root@name:~#apt-get install ssh

root@name:~#sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config

root@name:~#/etc/init.d/ssh start
root@name:~#ssh-keygen

root@ambari:~#passwd
Enter new UNIX password:root

root@ambari:~#apt-get install ssh

root@ambari:~#sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config

root@ambari:~#/etc/init.d/ssh start
root@ambari:~#ssh-keygen

root@name:~# scp /root/.ssh/id_rsa.pub root@data1:/tmp
root@name:~# scp /root/.ssh/id_rsa.pub root@data2:/tmp

root@data1:~#cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys
root@data1:~#chmod 700 ~/.ssh
root@data1:~#chmod 600 ~/.ssh/authorized_keys

root@data2:~#cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys
root@data2:~#chmod 700 ~/.ssh
root@data2:~#chmod 600 ~/.ssh/authorized_keys

root@ambari:~# scp /root/.ssh/id_rsa.pub root@name:/tmp
root@ambari:~# scp /root/.ssh/id_rsa.pub root@data1:/tmp/ambari_id_rsa.pub
root@ambari:~# scp /root/.ssh/id_rsa.pub root@data2:/tmp/ambari_id_rsa.pub

root@data1:~#cat /tmp/ambari_id_rsa.pub >> ~/.ssh/authorized_keys
root@data1:~#/etc/init.d/ssh restart
root@data2:~#cat /tmp/ambari_id_rsa.pub >> ~/.ssh/authorized_keys
root@data2:~#/etc/init.d/ssh restart

root@name:~#cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys
root@name:~#/etc/init.d/ssh restart
root@name:~#chmod 700 ~/.ssh
root@name:~#chmod 600 ~/.ssh/authorized_keys

root@ambari:/#apt-get update
root@ambari:/#apt-get install postgresql postgresql-contrib
root@ambari:/#/etc/init.d/postgresql start

root@data1:/#wget -nv http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.1.2/ambari.list -O /etc/apt/sources.list.d/ambari.list

root@data1:/#apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD

root@data1:/#apt-get update

root@data2:/#wget -nv http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.1.2/ambari.list -O /etc/apt/sources.list.d/ambari.list

root@data2:/#apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD

root@data2:/#apt-get update

root@name:/#wget -nv http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.1.2/ambari.list -O /etc/apt/sources.list.d/ambari.list

root@name:/#apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD

root@name:/#apt-get update

root@ambari:/#wget -nv http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.1.2/ambari.list -O /etc/apt/sources.list.d/ambari.list

root@ambari:/#apt-key adv --recv-keys --keyserver keyserver.ubuntu.com B9733A7A07513CAD

root@ambari:/#apt-get update

root@ambari:/#apt-get install ambari-server
root@ambari:/#apt-get install ambari-agent

root@ambari:/#ambari-server setup
// select default answer for all questions during setup

root@ambari:/#ambari-server start

name@host:/#docker inspect -f '{{ .NetworkSettings.IPAddress }}' ambari

172.17.0.17

// open in browser http://172.17.0.17:8080 and login with admin/admin as username/password
// click on Launch Install Wizard button
// enter mycluster as cluster name then click next
// select HDP 2.3 then click next
// in target hosts enter
// name
// data1
// data2
// and

root@ambari:/# cat ~/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAk...47QxOaBp4tIy+9Ezg==
-----END RSA PRIVATE KEY-----

// copy the private key to ssh private key text box
// then click register and Confirm button
// you should see every host is registered successfully , click next button
// in page Choose Services click next button
// in page Assign Masters, select HDFS , YARN + MapReduce2, ZooKeeper,Ambari Metrics , then click next button
// in page Assign Slaves and Clients, select name as name node and data1 as Sname(secondary name node)
// in Assign Slaves and Clients and Customize Services pages, click next button, and after Review page, click Deploy button

Hello World with Play

wget https://downloads.typesafe.com/typesafe-activator/1.3.6/typesafe-activator-1.3.6.zip?_ga=1.140741362.1365550810.1438956173

sudo unzip ~/Downloads/typesafe-activator-1.3.6.zip -d /opt/

export PATH=$PATH:/opt/activator-dist-1.3.6

java -version
java version “1.8.0_45”
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)

sudo chmod o+X /opt/activator-dist-1.3.6/activator

./activator new hello-world-app play-scala

cd hello-world-app

// in app/controllers/Application.scala
// change line
// Ok(views.html.index(“Your new application is ready.”)) -> Ok(“Hello World”)

./activator run

// in browser http://localhost:9000/

// to generate intillig idea project
mkdir -p ~/.sbt/0.13/plugins/
echo ‘addSbtPlugin(“com.github.mpeltonen” % “sbt-idea” % “1.6.0”)’ >>~/.sbt/0.13/plugins/build.sbt
./activator gen-idea

Install Ambari on Ubuntu

apt-get update
apt-get install postgresql postgresql-contrib
apt-get install wget
/etc/init.d/postgresql start
cd /etc/apt/sources.list.d
wget http://public-repo-1.hortonworks.com/ambari/ubuntu14/2.x/updates/2.1.2/ambari.list
apt-key adv –recv-keys –keyserver keyserver.ubuntu.com B9733A7A07513CAD
apt-get install ambari-server // select default answer for all questions
ambari-server setup
sudo ambari-server start