Java Tutorial,Java Programs,Java interview Questions,JSP Tutorial,Servlet Tutorial,Spring Tutorial,Mysql Tutorial,java interview question,jsp interview question,spring interview question,mysql interview question,cassandra tutorial,guava tutorial,guava example,javascript tutorial,ajax example,python tutorial
Showing posts with label spark. Show all posts
Showing posts with label spark. Show all posts
Saturday, 30 May 2015
how to install spark on ubuntu
Step 1:
download spark click here
or
use this command
wget http://download.igniterealtime.org/spark/spark_2_6_3.tar.gz
step 2:
Now extract tar file Using this command
tar -zxvf spark_2_7_0.tar.gz
and it makes Spark folder
Step 3:
Now go to in Spark folder and run this Command
Dell-System-Inspiron-N4110:~/Spark$ ./Spark
After this you can see spark windows
Saturday, 4 April 2015
Get Roster List From XMPP IM with Smack API in Java Application
package com.javaproficiency.demo;
import java.util.Collection;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.RosterEntry;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
public class GETRoster {
public static void main(String[] args) {
GETRoster getRoster = new GETRoster();
XMPPConnection connection = getRoster.Connect();
// Login User
getRoster.loginUser(connection);
// Get Roster Of Login User
Roster roster = connection.getRoster();
Collection<RosterEntry> entries = roster.getEntries();
for (RosterEntry entry : entries) {
System.out.println("name=" + entry.getName() + "userName="
+ entry.getUser());
}
connection.disconnect();
}
public void loginUser(XMPPConnection connection){
try {
connection.login("userName","Password");
} catch (XMPPException e) {
e.printStackTrace();
}
}
/**
*
* @return XMPP Connection
*/
public XMPPConnection Connect() {
ConnectionConfiguration config = new ConnectionConfiguration(
"localhost", 5222);
/*
* ConnectionConfiguration config = new ConnectionConfiguration(
* "192.163.2.200", 5222);
*/
XMPPConnection connection = new XMPPConnection(config);
try {
connection.connect();
} catch (XMPPException e) {
e.printStackTrace();
}
return connection;
}
}
import java.util.Collection;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.Roster;
import org.jivesoftware.smack.RosterEntry;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
public class GETRoster {
public static void main(String[] args) {
GETRoster getRoster = new GETRoster();
XMPPConnection connection = getRoster.Connect();
// Login User
getRoster.loginUser(connection);
// Get Roster Of Login User
Roster roster = connection.getRoster();
Collection<RosterEntry> entries = roster.getEntries();
for (RosterEntry entry : entries) {
System.out.println("name=" + entry.getName() + "userName="
+ entry.getUser());
}
connection.disconnect();
}
public void loginUser(XMPPConnection connection){
try {
connection.login("userName","Password");
} catch (XMPPException e) {
e.printStackTrace();
}
}
/**
*
* @return XMPP Connection
*/
public XMPPConnection Connect() {
ConnectionConfiguration config = new ConnectionConfiguration(
"localhost", 5222);
/*
* ConnectionConfiguration config = new ConnectionConfiguration(
* "192.163.2.200", 5222);
*/
XMPPConnection connection = new XMPPConnection(config);
try {
connection.connect();
} catch (XMPPException e) {
e.printStackTrace();
}
return connection;
}
}
Login to XMPP IM with Smack for Java applications
Maven dependency
<dependency>
<groupId>jivesoftware</groupId>
<artifactId>smack</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>jivesoftware</groupId>
<artifactId>smackx</artifactId>
<version>3.1.0</version>
</dependency>
package com.javaproficiency.demo;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
public class LoginSmack {
public static void main(String[] args) {
LoginSmack loginSmack=new LoginSmack();
XMPPConnection connection=loginSmack.Connect();
try {
connection.login("Username","Password");
} catch (XMPPException e) {
e.printStackTrace();
}
System.out.println("Login Successfully");
}
/**
*
* @return XMPP Connection
*/
public XMPPConnection Connect() {
ConnectionConfiguration config = new ConnectionConfiguration(
"localhost", 5222);
/*
* ConnectionConfiguration config = new ConnectionConfiguration(
* "192.163.2.200", 5222);
*/
XMPPConnection connection = new XMPPConnection(config);
try {
connection.connect();
} catch (XMPPException e) {
e.printStackTrace();
}
return connection;
}
}
<dependency>
<groupId>jivesoftware</groupId>
<artifactId>smack</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>jivesoftware</groupId>
<artifactId>smackx</artifactId>
<version>3.1.0</version>
</dependency>
package com.javaproficiency.demo;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
public class LoginSmack {
public static void main(String[] args) {
LoginSmack loginSmack=new LoginSmack();
XMPPConnection connection=loginSmack.Connect();
try {
connection.login("Username","Password");
} catch (XMPPException e) {
e.printStackTrace();
}
System.out.println("Login Successfully");
}
/**
*
* @return XMPP Connection
*/
public XMPPConnection Connect() {
ConnectionConfiguration config = new ConnectionConfiguration(
"localhost", 5222);
/*
* ConnectionConfiguration config = new ConnectionConfiguration(
* "192.163.2.200", 5222);
*/
XMPPConnection connection = new XMPPConnection(config);
try {
connection.connect();
} catch (XMPPException e) {
e.printStackTrace();
}
return connection;
}
}
Openfire Server Tutorial
How To Install Openfire XMPP Server On Ubuntu
How to install Spark IM client in ubuntu
Smack API
1. Connecting to XMPP IM with Smack for java Application
2. Login to XMPP IM with Smack for java applications
3. Get Roster List From XMPP IM With Smack
4 . How to add roster in xmpp.
4 . How to add roster in xmpp.
5 . How to remove Roster or Friend in xmpp server
7. create group
8. add in group
9. delete user
10. vcard save
11. vcard get
Subscribe to:
Posts (Atom)

