Selasa, 05 Mei 2015

Aplikasi Servlet Untuk Menambahkan Dan Mengalikan Dua Bilangan Yang Diinputkan




Untuk membuat Aplikasi Servlet Untuk Menambahkan Dan Mengalikan Dua Bilangan Yang Diinputkan , ada 2 tahap :

1 ) Langkah pertama ,,,,
 Membuat satu file html sebagai form inputan angka yang akan dimasukkan, kemudian beri nama  newhtml.html  
lalu ketikkan kode dibawah ini!

<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <h1>Kalkulator Servlet Untuk Menjumlahkan Atau Mengalikan Dua buah bilangan</h1>
        <form method="GET" action="NewServlet1">
            <input type="text" name="valOne" value="0">
            <input type="text" name="valTwo" value="0">
            <input type="submit" value="ADD">
             </br> </br>
        </form>
        <form method="POST" action="NewServlet1">
            <input type="text" name="valOne" value="0">
           <input type="text" name="valTwo" value="0">
         
            <input type="submit" value="MULTIPLY">
        </form>
     
     
     
    </body>
</html>


2 ) Langkah Kedua ,,,,
     Membuat file servlet , kemudian beri nama NewServlet1.java 

lalu ketikkan kode dibawah ini!

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Goldfriet
 */
public class NewServlet1 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, String str)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        String txt = "";
        try {
            if (str != null) {
                txt = str;
            }
            /* TODO output your page here. You may use following sample code. */
            out.println("<!DOCTYPE html>");
            out.println("<html>");
            out.println("<head>");
            out.println("<title>Servlet FirstServlet</title>");
            out.println("</head>");
            out.println("<body>");
            out.println("<h1>Servlet FirstServlet at " + request.getContextPath() + "</h1>");
            out.println("<p>");
            out.println("<h2>");
            out.println("Hello :).... ");
            out.println("<p>");
            out.println("Hasilnya Adalah " + txt);
            out.println("</h2>");
            out.println("<form method=\"GET\" action=\"FirstServlet\">");
         
         
        } finally {
            out.close();
        }
    }
    // <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 {
        int rslt;
        String result = null;
        String paramOne = null;
        String paramTwo = null;

        paramOne = request.getParameter("valOne");
        paramTwo = request.getParameter("valTwo");
        rslt = Integer.parseInt(paramOne) + Integer.parseInt(paramTwo);
        result = String.valueOf(rslt);

        processRequest(request, response, result);
    }

    /**
     * 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 {
        int rslt;
        String result = null;
        String paramOne = null;
        String paramTwo = null;

        paramOne = request.getParameter("valOne");
        paramTwo = request.getParameter("valTwo");

        rslt = Integer.parseInt(paramOne) * Integer.parseInt(paramTwo);
        result = String.valueOf(rslt);
        processRequest(request, response, result);
    }

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

Setelah itu simpan, kemudian silahkan dijalankan newhtml.html    , jika berhasih hasilnya akan seperti dibawah ini...





Kamis, 16 April 2015

Program Untuk Mencari 20 Angka Terbesar

Dibawah ini adalah program untuk mencari 20 angka terbesar dalam bahasa pemograman java ..

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Goldfriet
 */import java.io.*;
    public class program_pencari_20angka_terbesar
    {
    public static void main(String[] args)
    {
      BufferedReader dataIn=new BufferedReader (new InputStreamReader (System.in));

    int angka []=new int[30];
        //Array untuk menampung data yang akan di inputkan

    try {
            for (int k=0;k<angka.length;k++)
            {
   System.out.println("Inputkan barisan karakter ke-"+k+":");
   angka[k]=Integer.parseInt(dataIn.readLine());
        }
    }catch(IOException e)
    {
            System.out.println("Error");
    }
    System.out.println ("######## 20 Bilangan Terbesar Adalah ######## ");
    Urutkan(angka);
 
    for (int c=0;c<20;c++)
    //membuat counter  
       System.out.println(angka[c]+"");
    //Menampilkan 20 bilangan terbesar
    }
public static void Urutkan (int bil[])
        {
    int n =bil.length;
    int i,j=0;
    for (i=1;i<n;i++)
        for (j=n-1; j>=i;j--)
            if (bil [j] > bil [j-1])
                {
                int temp = bil [j];
                bil [j]= bil [j-1];
                bil [j-1]=temp;

}
    }
 
}

Jika ingin melihat bentuk dalam bentuk pdf silahkan  klik disini
Atau anda bisa download disini

Screen shot output dari program ..

Senin, 15 Desember 2014

CARA UPDATE DRIVER LAPTOP

Untuk bekerja hardware komputer membutuhkan driver sebagai penggerak sehingga dapat menjalan kan fungsinya. tetapi terkadang kita menghadapi kendala terhadap driver komputer yang kita miliki ,salah satu masalah yang sering di jumpai adalah driver komputer sudah out to date atau tidak kompatitibel. Bagi orang IT tentu ini bukan lah suatu persoalan yang susah ,tetapi bagi orang yang tidak mengerti dengan komputer pasti akan kesulitan untuk mengatasi  permasalahan seperti ini. Untuk itu dalam artikel ini saya akan menulis cara mengupdate driver laptop komputer anda . oh iya sistem operasi yang saya gunakan disini adalah sistem operasi windows.
oke!! langsung aja ke TKP
1.masuk ke situs resmi merek laptop anda (contoh : www.hp.com)
Buka control panel (pastikan anda sudah terkoneksi ke jaringan internet).
2. masuk ke jendela device manager.
3. kemudian cara driver yang ingin anda update.
4.klik kanan pada nama driver yang ingin di update lalu klik update driver.
5.tunggu sampai proses update selesai.
6.klik close



URGENT !!!

KALO MAU COPAS SERTAKAN SUMBERNYA,,,,

Selasa, 21 Oktober 2014

Process and Project



1) waterfall models

Making the waterfall model of software starts with project feasibility analysis, requirements analysis and planning process Then proceed with the design and coding followed code.setelah finished typing test was done and when the program has passed the test of the installation program is done and thereafter the maintenance phase .
The workmanship in every late-stage software required workers who have been certified to guarantee the results of each stage.
        waterfall model of relatively simple model and easy to do, but this model also has some disadvantages such as:
- The possible need for a frozen system that causes no
  kompatitibel with hardware.
-pembekuan needs of the system has resulted in the problem specification
hardware.
-situation like this is very dangerous if it happens to run out of funds at the time of the project.
-it can be triggered the requirement.
-need official documents in the end of each stage.


2) Prototyping

prototytping made ​​to overcome the weaknesses of the waterfall model.In Prototyping design, coding, and testing, each phase is done very formally or thoroughly. Protyping stages starting with requirements analysis, design, code, and test phase of the program requirements system.Dengan freezing prototyping can be overcome.

3) Iterative Development

Iterative Development merupakann combination of the waterfall model and prototyping, along with the addition capabily to
the system until the full system is implemented a. on the development process of iteration is known.

4) Rational Unified Process
  This process is also known iteration process. there are several
  phase in this process;
- Inception Phase
- Elaboration Phase
- Construction Phase
- Phase Transitions

5) timeboxing Model
in this model there is a time limit for each stage in the project.

Kamis, 09 Oktober 2014

INTERNET OF THINGS

Internet of Things, atau dikenal juga dengan singkatan IoT, merupakan sebuah konsep yang bertujuan untuk memperluas manfaat dari konektivitas internet yang tersambung secara terus-menerus. Adapun kemampuan seperti berbagi data, remote control, dan sebagainya, termasuk juga pada benda di dunia nyata. Contohnya bahan pangan, elektronik, koleksi, peralatan apa saja, termasuk benda hidup yang semuanya tersambung ke jaringan lokal dan global melalui sensor yang tertanam dan selalu aktif.[1]
Pada dasarnya, Internet of Things mengacu pada benda yang dapat diidentifikasikan secara unik sebagai representasi virtual dalam struktur berbasis Internet. Istilah Internet of Things awalnya disarankan oleh Kevin Ashton pada tahun 1999 dan mulai terkenal melalui Auto-ID Center di MIT.

Pada bulan Juni 2009 Ashton berkomentar.

Senin, 20 Januari 2014

CERITA ANAK


 THE LAMB AND THE WOLF
One day,the wolf was slaking his thirst at a stream.When he chanced to see lamb,also drinking,at some distance down the stream.Outraged,he growled,you are muddying my drinking water,now I will kill you!The lamb protested,”but sir,how can I muddy your drinking water?