Posts

Showing posts from 2017

RMI

Image
                                                            For Professionals and Freshers The RMI (Remote Method Invocation) is an API that provides a mechanism to create distributed application in java. The RMI allows an object to invoke methods on an object running in another JVM. The RMI provides remote communication between the applications using two objects  stub  and  skeleton . RMI uses stub and skeleton object for communication with the remote object. A remote object is an object whose method can be invoked from another JVM. Let's understand the stub and skeleton objects: stub The stub is an object, acts as a gateway for the client side. All the outgoing requests are routed through it. It resides at the client side and represents the remote object. When the caller invokes method on the stub object, it does the following tasks: It initiates a connection with remote Virtual Machine (JVM), It writes and transmits (marshals) the parameters to t

Online chat for help /Support for website

Image
      For Freshers and professionals copy and paste above code in your website inside head tag, to add online help  support for website.  <!--Start of Zendesk Chat Script--> <script type="text/javascript"> window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s= d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set. _.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute("charset","utf-8"); $.src="https://v2.zopim.com/?5ISpAX1Ty8OLgcJYGpIoa4HjF8FMjT3n";z.t=+new Date;$. type="text/javascript";e.parentNode.insertBefore($,e)})(document,"script"); </script> <!--End of Zendesk Chat Script-->

Gmail Login For website

Image
         For professionals and Freshers                                                          Type following link on your web browser -                                                   https://console.developers.google.com/apis/credentials 2.Create Auth client id by providing required information  URL- http://localhost:8080 REDIRECT URL - http:localhost:8080/gmailtest/success.jsp index.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1"     pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> <script src="https://apis.google.com/js/platform.js" async defer></script> <meta name="google-signin-cli

Hibernate example without any deprecated API's

Create your hibernate application and write following logic in main method and run your code.    Configuration cfg = new Configuration();        cfg.configure();         ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(                 cfg.getProperties()).build();         SessionFactory buildSessionFactory = cfg.buildSessionFactory(serviceRegistry);         Session openSession = buildSessionFactory.openSession();         Transaction beginTransaction = openSession.beginTransaction(); ====================== ============================ create  your bean class object . example -     Employee e=new Employee();     e.setId(103);     e.setAge(1011);     e.setName("rahul");     e.setPhone("2374234"); =============================================================     openSession.save(e);     beginTransaction.commit();

WebService - Swing_Servlet Communication

import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; import java.util.logging.Level; import java.util.logging.Logger; public class SwingServlet {   public static void main(String[] args) throws Exception {  String username="raju";  String password="raju123";             URL url=new URL("http://localhost:8080/ServletDemo/LoginServlet?name="+username+"&&password="+password);     String stringToReverse = URLEncoder.encode("http://localhost:8080/ServletDemo/LoginServlet", "UTF-8");         System.out.println(stringToReverse);         URLConnection connection = url.openConnection();         connection.setDoOutput(true);         OutputStreamWriter out = new OutputStreamWriter(                                          connection.getOutputStream());         out.write("name=" + stringToReverse);         out.close();         BufferedReader in = new Buff

Write Json Data -

public class Address {     String city;     int pin;     public String getCity() {         return city;     }     public void setCity(String city) {         this.city = city;     }     public int getPin() {         return pin;     }     public void setPin(int pin) {         this.pin = pin;     }     public Address() {     }     } ==================== public class Employee {     String name;     int age;     Address address;     public String getName() {         return name;     }     public void setName(String name) {         this.name = name;     }     public int getAge() {         return age;     }     public void setAge(int age) {         this.age = age;     }     public Address getAddress() {         return address;     }     public void setAddress(Address address) {         this.address = address;     }     public Employee() {     }     } ==================== public class WriteJson {     public static void main(String[] args) {         Address a=new Address();        

JSON parsing - Reading Json Data

         Json url-    https://jsonplaceholder.typicode.com/users                       Aim - Want to read Json data from this URL .      Step 1-  Download - java-json.jar         Step 2- Create New Java Project and add this jar to your Project.      Step 3- write code : import java.io.InputStream; import java.net.URL; import javax.net.ssl.HttpsURLConnection; import org.json.JSONArray; import org.json.JSONObject; public class EmployeeJSONParser {     public static void main(String[] args) {         String data="";         try{         URL u=new URL("https://jsonplaceholder.typicode.com/users");             HttpsURLConnection conn = (HttpsURLConnection)u.openConnection();             InputStream in = conn.getInputStream();         int ch;         while((ch=in.read())!=-1){             data=data+(char)ch;         }         }         catch(Exception e){            e.printStackTrace();         }                         try{           

Kotlin - Exception Handling - throw keyword

Example-1 : throw Keyword By Using throw keyword we can handover responsibility of Exception handling to the caller Method Java - class Test{ public static void main(String args[]){ throw new ArithmeticException() } } Kotlin : fun main(args:Array<String>){ throw ArithmeticException() } ================================================ in Kotlin there is Nothing like Checked Exception :  It Means We can throw any number of exception from specific Example : JAVA class Test{ public static void main(String args[]){ throw new ArithmeticException(); throw new ArithmeticException(); } } In this example we will get Compile time error , in java it is not possible to throw more than one exception explicitly  from any method , because there is concepts like Checked Exception. Now Come to Kotlin - In kotlin there is no such a concept : you can throw any number of exception from any block , but yes behavior is same ... after executing exception line , execut

Kotlin - Constructor

Kotlin in Universal Informatics

                           Kotlin For freshers and Developers                   UNIVERSAL INFORMATICS                               INDORE               Kotlin For Android Students (1 .5  hr Batch) 1.   History and Features of Kotlin, Introduction and Setup the environment (netbeans , eclipse,stand alone compiler ) 2.   Variables  and Var vs Val  ,  operators  ,  Decision Making ,  Loop Control 3.   Arrays ,  Classes and Object [Object Oriented Programming] 4.   Inheritance  A bstract class   5.   Interface  ,  Exception Handling 6.   Collection (List,Map,Set)  and String 7.   Multithre a ding                  Android StartUp With Kotlin 8.   Setting  up  Kotlin in Android   First Hello World Program In Kotlin , Converting Java Code to Kotlin Code , Kotlin to Java Communication 9.   Basic UI Controls and event listener examples ,  Multiple Activity App with kotlin  , Activities returning results 10.   Android app with ListView , GridView   wit