java tutorials and useful tips for developer.

Saturday 5 September 2015

How to earn 1000$ from just 2000 visits guaranteed.

Today i am gonna tell you a secret that you never know before and you really like it after read this secret,I bet you will earn 1000$+ if you apply the tricks that i give you in this tutorial.

So now i am gonna uncover this money making secret that's called  "Domain Parking".


Domain Parking is very good side business that give u reasonable money with  no hardworking,I am also do this business from past 2 years,I will give u workable some specific tricks that will help you to run domain parking business successful.


So here are some steps you need to follow:


1: Buy a good domain 

 First you have to buy a good domain name now open your web browser and do some research on worth full domain that has some type-in traffic (Type-in traffic means people write website address on address bar instead of search on google ) for example rss.com its very expensive domain because it has 1000 visits daily by type-in traffic.
find this type of domain and buy from godaddy.com Godaddy is very popular website for domain registration.Now here i give u a trick for buying domain in just 0.99$.

Search n google godayy 0.99$ coupan and you will find coupun code copy it and apply this code into your billing and buy your domain in just 0.99$.

2: Park your Domain 

Bodis.com

Bodis.com is very popular domain parking website you just have to create account and park your domain it has very easy steps you easily create your account.


Here is the Screenshot you will see when you succesfully added your domain 




Now when you type your domain and hit you will see this page which has ads,when people clicks on this ads you will earn money in dollars against every single click.





Your main task is to increase traffic on your parked domain page so more people clicks on your ads I will give you some tricks how to increase traffic on your parked domain.

Increase Traffic:

download some videos related to your domain name for example from above example freefunnyclips.com he downloaded some free clips you have to download videos related to your domain.
Now next step is to use some video editing software i recommend you to use wondershare it is very easy video editing software,Your task is to just add your domain cover at the start and end of the your video in that cover write some catchy statements e-g  for mre videos pictures visit this website whatever you want but it should be very catchy so people visit you parked domain page.


This is an example cover page make your page according to your domain name and add it into you video at start and end.


Now Upload this video on dailymotion and promote this video on your social networks e-g facebook,twitter,google and enjoy your dollars generated with your domain.


If you have some difficulties all over the process feel free to ask me.



Sunday 12 April 2015

How to edit images with photoshop features online.

In this tutorial i will give you a secret that you must know if you a web developer or designer to save your time.It is a great tool for people who do not have photoshop on their systems and they want to edit their pictures using photoshop,So I am going to tell you a very useful site for editing images like croping or resizing images etc.

The site is www.pixlr.com  here is the screen shot fr this websites.






open the image and click on the Launch app showing in the pixlr express tab and start editing pictures enjoy.

Best websites for download full free movies.



In this tutorial i will give you some very useful websites links that are very unique and best for downloading latest bollywood and hollywood movies.

From these sites you can download movies in resumable links and in very small size i-e 300mb or 500mb,So here are the links


1)www.300mbfilms.in(very useful site for latest bollywood movies and hollywood movies)

2)moviesnhacks.com (very useful site for latest bollywood and hollywood movies)

3)urgrove.com (Specially for hollywood movies but also have bollywood movies)

4)300mbfilms.org (Specially for latest bollywood movies )

How to play don bradman cricket 14 on ps3 joystick.

In this tutorial i will give some batting tips that how to play don bradman cricket 14 using ps3 joystick.First of all see this image below and remember the button numbers i-e 1,2 or 5.

As you know don bradman cricket 14 is officially made for xbox and ps3 and after that it released for pc version,So you must have a joystick to play don bradman cricket 14 otherwise it will not run correctly.
So here are some batting tips that i want to give you guys.

-Number 1 button ot analog button 1 is used to change the position of the player on pitch.You can either move player towards left or right side so use this button to change the position.

-When bowler drop the ball from hand then hold the button 1 towards straight and use the number 2 button to play the short where you want i-e if your player is right handed and you want to play left short slide the button 2 towards left while holding the button 1 straight.

Now if you want to play deffenssive short hold the button 9 and use the button 1 and button 2 as we talked before.
Or if you want to play in aggressive mode hold the button 8 and use the button 1 and 2 as we talked before.

So in that way you can easily play don bradman cricket 14 Hope you enjoy thank you.If you have any difficulties while using the buttons feel free to leave comments.

Friday 10 April 2015

2 and 3 column page layout example code.

Screenshot


this is the example of 2 and 3 columns page layout website take help from this example and build websites.

Project code is attached in the link given below download the code.

Projectcode.rar

Student registration form using html and css.

<!doctype html>

<html>
<head>

<style>

            body{


            background: lightgray;
            margin: 0 auto;
            font-family: arial;
            }

            h1{

            color: brown;
            text-align: center;
            }
      label{

      color: #777;
      width: 10%;
      display: inline-block;

      }

      #container{


      padding: 20px;
      width: 60%;
      margin: 0 auto;
      margin-top: 1%;
      margin-bottom: 1%;
      background-color: white;
      }

   .userinput{

    padding-top: 7px;
    padding-bottom: 7px;
    padding-left: 5px;
    padding-right: 5px;
    margin-bottom: 30px;

   }
   label{

    color: brown;
    font-size: 14px;
   }
   textarea{
color: brown;
    font-size: 14px;


   }

   select{

    color: brown;
   }
 

   .sampleBtn{
     
       background-color: #f1f1f1;
       width: 20%;
       height: 35px;
       font-size: 16px;

   }
   .sampleBtn:hover{

         color: white;
         background-color: brown;
         cursor: pointer;
   }
</style>

</head>

<body>
<div id="container">
<h1> Student Registration Form </h1>

<form method="GET" action="register.jsp">

<div class="userinput">
<label> First Name  </label>
<input type="text" name="firstName" value="" />
</div>

<div class="userinput">
<label> Last Name  </label>
<input type="text" name="lastName" value="" />
</div>

<div class="userinput">
<label> Email </label>
<input type="text" name="email" value="" />
</div>

<div class="userinput">
<label> Gender </label>
<input type="radio" name="gender" value="m"/> Male
<input type="radio" name="gender" value="f" /> Female
</div>

<div class="userinput">
<label> Choose Subjects </label>
<input type="checkbox" name="subject" value="OOP"/> OOP
<input type="checkbox" name="subject" value="DB" checked/> Database
<input type="checkbox" name="subject" value="Web"/> Web Technologies
<input type="checkbox" name="subject" value="Android"/> Android Dev.
</div>

<div class="userinput">
<label>Comments </label>
<textarea name="comments" palceholder="Search here" rows="7" cols="40"></textarea>
</div>

<div class="userinput">
<label>City </label>
<select name="city">
<option value="1">Lahore</option>
<option value="2">Karachi</option>
<option value="3">Islamabad </option>
</select>
</div>

<div style="text-align:center">
<input type="reset" class="sampleBtn"/>
<input type="submit" class="sampleBtn"/>
</div>

</form>

</div>

</body>

</html>

Screenshot



login form creation code using database and java.

you must created table with name admin with attribute name and pass,then copy this code and enjoy the login form using jsp.

code for form in html and css
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package StudentSystem;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Faraz
 */
@WebServlet(name = "LoginServlet", urlPatterns = {"/LoginServlet"})
public class LoginServlet extends HttpServlet {

    /**
     * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
     * methods.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
     
         Connection conn=null;
          String image=null;
                             String name=null;
                              String occup=null;
                               String batch=null;
                             ResultSet rs;
        String uname=request.getParameter("name");
        String pass=request.getParameter("pass");
       
       
           try {
         
            try {
                Class.forName("com.mysql.jdbc.Driver");
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(SaveStudentServlet.class.getName()).log(Level.SEVERE, null, ex);
            }

            conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/student_data","root","badmash");


         String sql="select * from admin where name='"+uname+"' and pass='"+pass+"' ";
         //String sql2="insert into student (id,fname) values (5,'zeeshan')";
        rs= conn.createStatement().executeQuery(sql);
        boolean status=rs.next();
        if(status==true){
                               
                                   image=rs.getString("image");
                                    name=rs.getString("name");
                                     occup =rs.getString("occupation");
                                      batch =rs.getString("batch");
                                     
                                 
                             
             Admin ad=new Admin(name,occup,batch,image);  
           
                            AdminCopy.setAbo(ad);
                            request.setAttribute("admin", ad);
                           
                            request.getRequestDispatcher("dashboard.jsp").forward(request, response);
           
        }
        else{
           
           request.setAttribute("error","Username/Password Incorrect");
           request.getRequestDispatcher("login.jsp").forward(request, response);

        }
         
        } catch (SQLException ex) {
            Logger.getLogger(SaveStudentServlet.class.getName()).log(Level.SEVERE, null, ex);
        }
        finally{
            try {
             
                conn.close();
            } catch (SQLException ex) {
                Logger.getLogger(SaveStudentServlet.class.getName()).log(Level.SEVERE, null, ex);
            }
            }
       
    }

    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /**
     * Handles the HTTP <code>GET</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /**
     * Handles the HTTP <code>POST</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>

}


code for handling request coming from this form after clicking the submut button.




/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package StudentSystem;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Faraz
 */
@WebServlet(name = "LoginServlet", urlPatterns = {"/LoginServlet"})
public class LoginServlet extends HttpServlet {

    /**
     * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
     * methods.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
     
         Connection conn=null;
          String image=null;
                             String name=null;
                              String occup=null;
                               String batch=null;
                             ResultSet rs;
        String uname=request.getParameter("name");
        String pass=request.getParameter("pass");
       
       
           try {
         
            try {
                Class.forName("com.mysql.jdbc.Driver");
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(SaveStudentServlet.class.getName()).log(Level.SEVERE, null, ex);
            }

            conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/student_data","root","badmash");


         String sql="select * from admin where name='"+uname+"' and pass='"+pass+"' ";
        rs= conn.createStatement().executeQuery(sql);
        boolean status=rs.next();
        if(status==true){
                               
                                   image=rs.getString("image");
                                    name=rs.getString("name");
                                     occup =rs.getString("occupation");
                                      batch =rs.getString("batch");
                                     
                                 
                             
             Admin ad=new Admin(name,occup,batch,image);  
           
                            AdminCopy.setAbo(ad);
                            request.setAttribute("admin", ad);
                           
                            request.getRequestDispatcher("dashboard.jsp").forward(request, response);
           
        }
        else{
           
           request.setAttribute("error","Username/Password Incorrect");
           request.getRequestDispatcher("login.jsp").forward(request, response);

        }
         
        } catch (SQLException ex) {
            Logger.getLogger(SaveStudentServlet.class.getName()).log(Level.SEVERE, null, ex);
        }
        finally{
            try {
             
                conn.close();
            } catch (SQLException ex) {
                Logger.getLogger(SaveStudentServlet.class.getName()).log(Level.SEVERE, null, ex);
            }
            }
       
    }

    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    /**
     * Handles the HTTP <code>GET</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /**
     * Handles the HTTP <code>POST</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    /**
     * Returns a short description of the servlet.
     *
     * @return a String containing servlet description
     */
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>

}



Implementation of many to many relationship in java.

In this tutorial i will show you how to implement many to many relationship in sql when tables are in normalize form.In normalization of a database when two tables have many to many relationship we broke the tables into three tables two tables are original tables and one is a junction table which connects the two tables which have many to many relation.
In that way we break many to many realtion nto 1 to many relation.I will give you an example that clears the concept.

For example you have two entities or tables which are student and courses.Now one student can take many courses and similarly a course is taken by many students so these entities have many to many relation.

Okay lets discuss what are the problems arise if we implement tables as it is without breaking the many to many relationship,So these are the problems that can arise

 -Update anomaly
-Delete anomaly
-Data repetition
-Insert anomaly

To avoid these problems these tables should be normalized by creating the junction table,now these are the steps to normalize these tables.

1)Create a table with name student_course which has the composite primary key of both the id's of student and course table for example if student and courses tables have the attributes.
Student(std_id,name,address)
Courses(cr_id,name)

so the student_course table has the following attribute

student_course(std_id,cr_id , date)

2)In student_course table std_id and cr_id is composite pk which is taken by student and courses tables as a foreign key.

So in that way you succesfully normalized your tables.


Now the main problem is what are the queries to implement this concept which is the very big problem
just follow these simple steps to implement this concept.

1)create table of student with student id as primary key and auto increment.
2)create table of courses with course id as primary key and auto increment.
3)create the junction table using foreign key of student and courses tables id and make it composite pk.
4)First you have to execute the insert query of student table that inserted a record in student table with id 1.
5)insert some courses in courses tables.
6)Now very importantly Execute this query "SET @last_id=LAST_INSERT_ID()"
this query gives you the last inserted id in the student table,So you will use this variable to insert values int the student_courses table.You should run this insert queries in loop so that many courses are registered for one student.

Here are the queries

String sql="insert into student(`fname`,`lname`,`email`,`gender`,`desc`,`subject`,`city`)"+"values('"+fname+"','"+lname+"','"+email+"','"+gender+"','"+desc+"','"+s+"','"+city+"')";


         conn.createStatement().executeUpdate(sql);

         conn.createStatement().executeUpdate("SET @last_id=LAST_INSERT_ID();");

         for(int i=0;i<subject.length; i++){
         String sql2="insert into std_sbj(`std_id`,`sbj_id`)values(@last_id,'"+Integer.parseInt(subject[i])+"')";

        conn.createStatement().executeUpdate(sql2);





How to get values from user in java

In this tutorial i will show you how to code a program in java that takes values from user and then print on console,so lets start.
These are the steps that you follow:
1) I assumed you are able to create a java project in eclipse,after creating the project you see your project on left bar of your eclipse interface,now if you click on the project you will see the folder with name "Source Packages" if you click on this folder it will show you a package with name "Default package",now right click on that and create a new java class with any name,In my case i am going to make a class with name HellowWorld.

2) After creating the class you have to write the following code.For example

             public class HelloWorld{

                     String userinput;

                  public   HellowWorld(){
                         
                           
                             

}
                      //Now we make getter setter for this variable

              public void setUseinput(String up){

                                     userinput=up;
}

public String getUserinput(){

               return userinput;

}

public static void main(String arg[]){

       HellowWorld obj=new HellowWorld();

                     Scanner input=new Scanner(System.in);//this is used for get values from keyboard.

       System.out.println("Enter the String");
       int var=input.nextInt();

     obj.setUserinput(var);
           System.out.println("User entered string"+obj.getUserinput);

}

}

So when you run this program it will take input from keyboard and print on the console.

Categories

Popular Posts

Live Stats

Powered by Blogger.