Thursday, April 18, 2013

What will happen of your Google Account when you Die ?



What will happened of your Gmail Account when you die ?

Have you think like this before, I don't think so. But as Gmail.com is very popular website for sending email. Google has think that if people die then what to do with his/her data ? Answer came into the mind that Can we give access to another person from user's relative or friends whom he/she trust.

Google has started their search engine before 10 years and become popular. After launching successful search engine google has started a number of products and counting...  Do you aware that how many products are launched by the google ? We will give you brief summary of the same in the forthcoming article.
 
If you have google account and you are using more than 10 Applications from google.com then you have to think that what will happen if you die and your account is locked then you may loose some important conversations or documents as you are using number of google products.

So Finally Google came up with the "Google Inactive" Option. Here you need to setup the person details to whom you would like to give access if you die or you are enable to access your google account for few months or more.

To setup Google Inactive Click here 




Wednesday, April 17, 2013

WhatsApp Messaging : The Most Popular Communication Medium



WhatsApp Messaging : The Most Popular Communication Medium

You all are aware with the Number of messengers available in the market. You may be using Yahoo Chat before a 3-5 Years, Now Its time to Change the Messaging Service. Yahoo chat service is very much popular in the world but people are changing day by day. 

Now a days people has stated new messenger service for computer users  Like Google Hang Out and for smartphone users WhatsApp is very much popular one. I can be sure that most of the Smartphone users are using WhatsApp because of their rich set of functionality and attractive look.

Now Its your time to answer What You Think ?

- WhatsApp 
- Other  

Do you like WhatsApp or Other Application for Chat, Write your answer in comments... 

Tuesday, April 16, 2013

User Defined Exception in Java with Example



User defined Exception in Java


Hello Friends,


 

                        In this article we will see User Defined Exception. User Defined Exception means exception class created by User. Built-in exceptions provided by the Exception and Error classes may not always be enough to trap errors occurring in the program. There may be case where there is a need to create user-defined exceptions. User-defined class should be subclass of the Exception class.

The advantage of sub-classing the exception the Exception class is that the new exception type can be caught separately from other subclasses of Throwable.

Example of User-defined Exception is following,


class UseDefinedException extends Exception{
                String msg = "";
                int marks;
                public UseDefinedException(){

                }
                public UseDefinedException(String str){
                                super(str);
                }
                public String toString(){
                                if(marks <= 50){
                                                msg = "You have failed";
                                }

                                if (marks > 50){
                                                msg = "You have Passed";
                                }
                                return msg;
                }
}

public class Test{
                public static void main(String args[]){
                                Test t = new Test();
                                t.method();
                }
                public void method(){
                                try{
                                                int i=0;

                                                if( i < 50)
                                                                throw new UseDefinedException();

                                }
                                catch(UseDefinedException ude){
                                                System.out.println("User Defined Exception :: "+ude);
                                }
                }
}

It's Output will be,
 



Monday, April 15, 2013

Java Exception | Exceptions Handling Examples | Try Catch Finally Block



Hi Guys,

I am back with the Latest Topics. What is Exception in Java. Handling Exceptions with Examples.



             In this article, we will see Exception. Exception is very important part of any programming language. Basically, an exception is an abnormal behavior existing during a normal execution of a program. For example: When writing to a file if there does not exist required file then an appropriate exception will be thrown by java code.

Exception

          When an error occurred during the execution of a program, an exception occurs. In other words, exception is a run time error. This may happen because of the occurrence of certain events that arise at the time of execution.

            When an exception occurs, the program terminates unexpectedly and control returns to the operating system(OS). For language that do not support exception handling, programmers have to take care of errors manually. It is important to ensure that the program does not terminate unexpectedly due to the occurrence of an exception.

Handling Exception

            Exception Handling is performed to identify errors and prevent program to stop execution due to errors. Whenever an exception occurs in a program where proper exception handling mechanism is not provided, the program aborts programs stops it's execution.

            Error handling in Java is performed with the help of exception-handling model. According to this model, when an error occurs, an exception is thrown. This exception is caught in block of code. Exception have to be caught, otherwise the program is terminated.

            Exception Handling in Java is managed through five keywords: try, catch, throw, throws and finally.  Program Statements that have to be monitored for exceptions, are contained within try block. By catch keyword, the programmer can catch the exception and handle it. To manually throw an exception, the keyword throw is used. The throws clause is used in a method to specify that this method will throw out an exception. The code in finally block gets executed no matter whether an exception is generated or not.


 'try' and 'catch' Block

Whenever there is a possibility of an exception being generated in a program, it is better to handle it explicitly. This can be done using the try and catch. The advantage of try and catch keywords are that, they fix the error and prevent the program from terminating abruptly.

It is possible to have multiple catch statements for one try block. The execution of a program can continue once the exception has been handled.

For Ex.

try{

            int num = calculate(9,0);

            System.out.println(num);

}catch(Exception ex){

            ex.printStackTrace();

}



int calculate(int a, int b){

            int num = a/b;

            return num;

}

In above example, exception will generate because, number cannot be divided by zero.
Note: The catch block never executed if no error occurs.


The 'finally' block

            'finally' block is placed after catch block, and it is compulsory executes whether catch block execute or not. The code inside finally block will compulsory execute.

For Example, sometimes we don't close connection with database after query get executed. So, in this case, generally we write close connection code in finally. So, possibilities of error generation due to so many connection instance to database, will be reduced.
            'finally' block will only not execute, if programmer calls System.exit(0); in try block.

For Example,

try{

            Connection conn;

            conn = DBConnection();

}catch(Exception ex){

            ex.printStackTrace();

}finally{

            closeConnection();

}


Multiple catch blocks

Sometimes a single piece of code may generate more than one type of error. In such cases this errors should be separated by multiple catch blocks. Each catch statement is seen in order of appearance and the first one that matches the exception is executed. After one of the catch statements is executed, the rest of the catch statements are ignored.

Following example will illustrate, multiple catch() blocks are used to handle different exceptions.

For Example,

class ExceptionCode{

           

            public void calculate(){

                        try{

                                    int num=0;

                                    int num1 = 42/0;

                        }catch(ArithmaticException ae){

                                    ae.printStackTrace();

                        }catch(Exception ex){

                                    ex.printStackTrace();

                        }

            }



            public static void main(String args[]){

                        ExceptionCode obj = new ExceptionCode();

                        obj.calculate();

            }

}

Friday, April 12, 2013

Asp.net Simple Form Validation Without writing a single line

Hello Friends,
Hope you have learn something new ! 

Now we are available with new post that is : asp.net form validation. For validating your form you need not required to write a single line of code. just drag and drop coding.

Here we have added code for the following validation:
* Empty Field Validation.
* Email Address Validation.
* Range Validation.
* Website URL Validation.
* Two Password verification (verification of two fields)


 

 
Here is the snapshots of the website including downloadable code : 

Click Here To Download Code:
 

Friday, April 5, 2013

Asp.net Simple Login Form With Redirect and Session Management

Hello Friends,

Hope you have enjoyed our previous post.. Now we are coming up with asp.net Login including Session Management and redirect options.

We are having 2 Pages. 1) Login Page and 2) Menu Page

Default Login page will open when you open website, after suppose you try to login with userid: admin and password : admin then you can be redirect to menu or admin panel. Here we have shown another page. If you are trying to enter any other userid or password then home page will gives you error message that invalid userid or password.

Here is the snapshots of the website including downloadable code : 
Click Here to Download Complete Code of Login Page With Session Management and Redirect


Login Page

Login Page : Latest Technology Guide

 Invalid Userid Password Message


Invalid User id Password : Login Page : Latest Technology Guide


 Successful Login Menu page

Menu : Latest Technology Guide


For Downloading full code : Click Here :


Code for Login Button:

  Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        If TextBox1.Text = "admin" And TextBox2.Text = "admin" Then
            Session("login") = "Success" 'store some value into session so that we can check for this value in next page
            Response.Redirect("default2.aspx") 'redirect to menu page
        Else
            Label1.Text = "Invalid Useid or Password"
            Session.Clear() 'clear session values
            Session.Abandon()

        End If

    End Sub


Code for Page Lode in Page2 :
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Session("login") = "Success" Then
            'Load page without any problems.
        Else
            'redirect back to home page for login.
            Response.Redirect("default.aspx")


        End If
    End Sub