Insert Plugin Tag Clouds Keren

August 22nd, 2009

Sebelum memulai bercerita tentang instalasi plugin ini, pastikan bahwa hosting yang anda gunakan tidak di subdomainnya wordpress(bukan di: xxx.wordpress.com). Karena jika hosting anda di server nya wordpress, maka fasilitas untuk installasi plugin dan lain2 tidak akan muncul.
Sekarang saya asumsikan anda memiliki domain sendiri. Berikut ini tahapan dalam installasi:

  • Masuk ke wp-admin (ex: windu.net16.net/wp-admin)
  • Pada bagaian Plugin, pilih Add New
  • Anda akan masuk ke halaman Install Plugins, kemudian masukan kata kunci wp-cumulus pada text box pencarian
  • Anda akan masuk ke halaman hasil pencarian, kemudian pada kolom action klik install
  • Pojok kanan atas, pilih Install Now
  • Di halaman Connection Information masukan semua informasi yang diminta. Kalau Anda lupa informasi ini, buka ke cpanel, kemudian lihat pada bagian ftp account. Host Name, isi dengan host anda (ex: windu.net16.net), username: username ftp anda (lihat cpanel), Password: password ftp (lihat cpanel). Connection Type: pilih FTP. Proceed
  • Activate Plugin

Begitu juga jika anda menginginkan installasi plugin lainnya. gunakan cara yang sama seperti installasi plugin wp-cumulus ini. Akan tetapi ada beberapa plugin lain yang harus melakukan setting dulu. Selamat mencoba..

Java (Programming Language) II

August 21st, 2009

Java Platform

Main articles: Java Platform and Java Runtime Environment

One characteristic of Java is portability, which means that computer programs written in the Java language must run similarly on any supported hardware/operating-system platform. This is achieved by compiling the Java language code, not to machine code but to Java bytecode – instructions analogous to machine code but intended to be interpreted by a virtual machine (VM) written specifically for the host hardware. End-users commonly use a Java Runtime Environment (JRE) installed on their own machine for standalone Java applications, or in a Web browser for Java applets.

Standardized libraries provide a generic way to access host specific features such as graphics, threading and networking.

A major benefit of using bytecode is porting. However, the overhead of interpretation means that interpreted programs almost always run more slowly than programs compiled to native executables would, and Java suffered a reputation for poor performance. This gap has been narrowed by a number of optimization techniques introduced in the more recent JVM implementations.

Implementation

Sun Microsystems officially licenses the Java Standard Edition platform for Linux, Mac OS X, and Solaris[citation needed]. Although, in the past Sun has licensed Java to Microsoft, the license has expired and has not been renewed.[15] Through a network of third-party vendors and licensees,[16] alternative Java environments are available for these and other platforms.

Sun’s trademark license for usage of the Java brand insists that all implementations be “compatible”. This resulted in a legal dispute with Microsoft after Sun claimed that the Microsoft implementation did not support RMI or JNI and had added platform-specific features of their own. Sun sued in 1997, and in 2001 won a settlement of $20 million as well as a court order enforcing the terms of the license from Sun.[17] As a result, Microsoft no longer ships Java with Windows, and in recent versions of Windows, Internet Explorer cannot support Java applets without a third-party plugin. Sun, and others, have made available free Java run-time systems for those and other versions of Windows.

Platform-independent Java is essential to the Java EE strategy, and an even more rigorous validation is required to certify an implementation. This environment enables portable server-side applications, such as Web services, servlets, and Enterprise JavaBeans, as well as with embedded systems based on OSGi, using Embedded Java environments. Through the new GlassFish project, Sun is working to create a fully functional, unified open-source implementation of the Java EE technologies.

Sun also distributes a superset of the JRE called the Java Development Kit (commonly known as the JDK), which includes development tools such as the Java compiler, Javadoc, Jar and debugger.

Performance

Main article: Java performance

Comparing the performance of a Java program to an equivalent one written in another programming language (such as C, C++, or Object Pascal) is complicated by the fact that the target platform of Java’s bytecode compiler is the Java platform, and the bytecode is either interpreted or compiled into machine code by the JVM. Very different and hard-to-compare scenarios raise from these two different approaches: static vs. dynamic compilations and recompilations, the availability of precise information about the runtime environment, and others.

Programs written in Java have had a reputation for being slower and requiring more memory than those written in some other languages.[18] However, Java programs’ execution speed has improved significantly due to the introduction of Just-In Time compilation (in 1997/1998 for Java 1.1),[19][20][21] the addition of language features supporting better code analysis,[clarification needed] and optimizations in the Java Virtual Machine itself (such as HotSpot becoming the default for Sun’s JVM in 2000).

See also: JStik

Automatic Memory Management

See also: Garbage collection (computer science)

Java uses an automatic garbage collector to manage memory in the object lifecycle. The programmer determines when objects are created, and the Java runtime is responsible for recovering the memory once objects are no longer in use. Once no references to an object remain, the unreachable object becomes eligible to be freed automatically by the garbage collector. Something similar to a memory leak may still occur if a programmer’s code holds a reference to an object that is no longer needed, typically when objects that are no longer needed are stored in containers that are still in use. If methods for a nonexistent object are called, a “null pointer exception” is thrown.[22][23]

One of the ideas behind Java’s automatic memory management model is that programmers be spared the burden of having to perform manual memory management. In some languages memory for the creation of objects is implicitly allocated on the stack, or explicitly allocated and deallocated from the heap. Either way the responsibility of managing memory resides with the programmer. If the program does not deallocate an object, a memory leak occurs. If the program attempts to access or deallocate memory that has already been deallocated, the result is undefined and difficult to predict, and the program is likely to become unstable and/or crash. This can be partially remedied by the use of smart pointers, but these add overhead and complexity.

Garbage collection may happen at any time. Ideally, it will occur when a program is idle. It is guaranteed to be triggered if there is insufficient free memory on the heap to allocate a new object; this can cause a program to stall momentarily. Explicit memory managment is not possible in Java.

Java does not support C/C++ style pointer arithmetic, where object addresses and unsigned integers (usually long integers) can be used interchangeably. This allows the garbage collector to relocate referenced objects, and ensures type safety and security.

As in C++ and some other object-oriented languages, variables of Java’s primitive types are not objects. Values of primitive types are either stored directly in fields (for objects) or on the stack (for methods) rather than on the heap, as commonly true for objects (but see Escape analysis). This was a conscious decision by Java’s designers for performance reasons. Because of this, Java was not considered to be a pure object-oriented programming language. However, as of Java 5.0, autoboxing enables programmers to proceed as if primitive types are instances of their wrapper classes.

Syntax

Main article: Java syntax

The syntax of Java is largely derived from C++. Unlike C++, which combines the syntax for structured, generic, and object-oriented programming, Java was built almost exclusively as an object oriented language. All code is written inside a class and everything is an object, with the exception of the intrinsic data types (ordinal and real numbers, boolean values, and characters), which are not classes for performance reasons.

Java suppresses several features (such as operator overloading and multiple inheritance) for classes in order to simplify the language and to prevent possible errors and anti-pattern design.

Java uses the same commenting methods as C++. There are two different styles of comment: a single line style marked with two forward slashes, and a multiple line style opened with a forward slash asterisk (/*) and closed with an asterisk forward slash (*/).

Example:

//This is an example of a single line comment using two forward slashes

/* This is an example of a multiple line comment using the forward slash
   and asterisk. This type of comment can be used to hold a lot of information
   but it is very important to remember to close the comment. */

Examples

HelloWorld

/*
 * Outputs "Hello, world!" and then exits
 */

public class HelloWorld {
   public static void main(String[] args) {
       System.out.println("Hello, world!");
   }
}

By convention, source files are named after the public class they contain, appending the suffix .java, for example, HelloWorld.java. It must first be compiled into bytecode, using a Java compiler, producing a file named HelloWorld.class. Only then can it be executed, or ‘launched’. The java source file may only contain one public class but can contain multiple classes with less than public access and any number of public inner classes.

A class that is declared private may be stored in any .java file. The compiler will generate a class file for each class defined in the source file. The name of the class file is the name of the class, with .class appended. For class file generation, anonymous classes are treated as if their name was the concatenation of the name of their enclosing class, a $, and an integer.

The keyword public denotes that a method can be called from code in other classes, or that a class may be used by classes outside the class hierarchy. The class hierarchy is related to the name of the directory in which the .java file is.

The keyword static in front of a method indicates a static method, which is associated only with the class and not with any specific instance of that class. Only static methods can be invoked without a reference to an object. Static methods cannot access any method variables that are not static.

The keyword void indicates that the main method does not return any value to the caller. If a Java program is to exit with an error code, it must call System.exit() explicitly.

The method name “main” is not a keyword in the Java language. It is simply the name of the method the Java launcher calls to pass control to the program. Java classes that run in managed environments such as applets and Enterprise Java Beans do not use or need a main() method. A java program may contain multiple classes that have main methods, which means that the VM needs to be explicitly told which class to launch from.

The main method must accept an array of String objects. By convention, it is referenced as args although any other legal identifier name can be used. Since Java 5, the main method can also use variable arguments, in the form of public static void main(String... args), allowing the main method to be invoked with an arbitrary number of String arguments. The effect of this alternate declaration is semantically identical (the args parameter is still an array of String objects), but allows an alternate syntax for creating and passing the array.

The Java launcher launches Java by loading a given class (specified on the command line or as an attribute in a JAR) and starting its public static void main(String[]) method. Stand-alone programs must declare this method explicitly. The String[] args parameter is an array of String objects containing any arguments passed to the class. The parameters to main are often passed by means of a command line.

Printing is part of a Java standard library: The System class defines a public static field called out. The out object is an instance of the PrintStream class and provides many methods for printing data to standard out, including println(String) which also appends a new line to the passed string.

The string “Hello, world!” is automatically converted to a String object by the compiler.

A more comprehensive example

// OddEven.java
import javax.swing.JOptionPane;

public class OddEven {
    // "input" is the number that the user gives to the computer
    private int input; // a whole number("int" means integer)

    /*
     * This is the constructor method. It gets called when an object of the OddEven type
     * is being created.
     */
    public OddEven() {
    //Code not shown
    }

    // This is the main method. It gets called when this class is run through a Java interpreter.
    public static void main(String[] args) {
        /*
         * This line of code creates a new instance of this class called "number" (also known as an
         * Object) and initializes it by calling the constructor.  The next line of code calls
         * the "showDialog()" method, which brings up a prompt to ask you for a number
         */
        OddEven number = new OddEven();
        number.showDialog();
    }

    public void showDialog() {
        /*
         * "try" makes sure nothing goes wrong. If something does,
         * the interpreter skips to "catch" to see what it should do.
         */
        try {
            /*
             * The code below brings up a JOptionPane, which is a dialog box
             * The String returned by the "showInputDialog()" method is converted into
             * an integer, making the program treat it as a number instead of a word.
             * After that, this method calls a second method, calculate() that will
             * display either "Even" or "Odd."
             */
            input = new Integer(JOptionPane.showInputDialog("Please Enter A Number"));
            calculate();
        } catch (NumberFormatException e) {
            /*
             * Getting in the catch block means that there was a problem with the format of
             * the number. Probably some letters were typed in instead of a number.
             */
            System.err.println("ERROR: Invalid input. Please type in a numerical value.");
        }
    }

    /*
     * When this gets called, it sends a message to the interpreter.
     * The interpreter usually shows it on the command prompt (For Windows users)
     * or the terminal (For Linux users).(Assuming it's open)
     */
    private void calculate() {
        if (input % 2 == 0) {
            System.out.println("Even");
        } else {
            System.out.println("Odd");
        }
    }
}
  • The import statement imports the JOptionPane class from the javax.swing package.
  • The OddEven class declares a single private field of type int named input. Every instance of the OddEven class has its own copy of the input field. The private declaration means that no other class can access (read or write) the input field.
  • OddEven() is a public constructor. Constructors have the same name as the enclosing class they are declared in, and unlike a method, have no return type. A constructor is used to initialize an object that is a newly created instance of the class.
  • The calculate() method is declared without the static keyword. This means that the method is invoked using a specific instance of the OddEven class. (The reference used to invoke the method is passed as an undeclared parameter of type OddEven named this.) The method tests the expression input % 2 == 0 using the if keyword to see if the remainder of dividing the input field belonging to the instance of the class by two is zero. If this expression is true, then it prints Even; if this expression is false it prints Odd. (The input field can be equivalently accessed as this.input, which explicitly uses the undeclared this parameter.)
  • OddEven number = new OddEven(); declares a local object reference variable in the main method named number. This variable can hold a reference to an object of type OddEven. The declaration initializes number by first creating an instance of the OddEven class, using the new keyword and the OddEven() constructor, and then assigning this instance to the variable.
  • The statement number.showDialog(); calls the calculate method. The instance of OddEven object referenced by the number local variable is used to invoke the method and passed as the undeclared this parameter to the calculate method.
  • input = new Integer(JOptionPane.showInputDialog("Please Enter A Number")); is a statement that converts the type of String to the primitive type int by taking advantage of the wrapper class Integer.

Java (Programing Language)

August 21st, 2009

“Java language” redirects here. For the Indonesian spoken language, see Javanese language.
Not to be confused with JavaScript.
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems’ Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java applications are typically compiled to bytecode (class file) that can run on any Java virtual machine (JVM) regardless of computer architecture.

The original and reference implementation Java compilers, virtual machines, and class libraries were developed by Sun from 1995. As of May 2007, in compliance with the specifications of the Java Community Process, Sun made available most of their Java technologies as free software under the GNU General Public License. Others have also developed alternative implementations of these Sun technologies, such as the GNU Compiler for Java and GNU Classpath.

History

See also: Java (Sun) history and Java version history

James Gosling initiated the Java language project in June 1991 for use in one of his many set-top box projects. The language, initially called Oak after an oak tree that stood outside Gosling’s office, also went by the name Green and ended up later renamed as Java, from a list of random words. Gosling aimed to implement a virtual machine and a language that had a familiar C/C++ style of notation.

Sun released the first public implementation as Java 1.0 in 1995. It promised “Write Once, Run Anywhere” (WORA), providing no-cost run-times on popular platforms. Fairly secure and featuring configurable security, it allowed network- and file-access restrictions. Major web browsers soon incorporated the ability to run Java applets within web pages, and Java quickly became popular. With the advent of Java 2 (released initially as J2SE 1.2 in December 1998), new versions had multiple configurations built for different types of platforms. For example, J2EE targeted enterprise applications and the greatly stripped-down version J2ME for mobile applications. J2SE designated the Standard Edition. In 2006, for marketing purposes, Sun renamed new J2 versions as Java EE, Java ME, and Java SE, respectively.

In 1997, Sun Microsystems approached the ISO/IEC JTC1 standards body and later the Ecma International to formalize Java, but it soon withdrew from the process. Java remains a de facto standard, controlled through the Java Community Process. At one time, Sun made most of its Java implementations available without charge, despite their proprietary software status. Sun generated revenue from Java through the selling of licenses for specialized products such as the Java Enterprise System. Sun distinguishes between its Software Development Kit (SDK) and Runtime Environment (JRE) (a subset of the SDK); the primary distinction involves the JRE’s lack of the compiler, utility programs, and header files.

On 13 November 2006, Sun released much of Java as free and open source software under the terms of the GNU General Public License (GPL). On 8 May 2007 Sun finished the process, making all of Java’s core code available under free software / open-source distribution terms, aside from a small portion of code to which Sun did not hold the copyright.

Principles

There were five primary goals in the creation of the Java language:[13]

  1. It should be “simple, object oriented, and familiar”.
  2. It should be “robust and secure”.
  3. It should be “architecture neutral and portable”.
  4. It should execute with “high performance”.
  5. It should be “interpreted, threaded, and dynamic”.

Evangelism

While much of Sun’s direct revenue from Java comes from licensing and JCP membership dues, some believe that Java is primarily a vehicle to promote hardware server and/or Solaris OS sales for Sun internally, and Sun’s vice-president Rich Green has said that Sun’s ideal role with regards to Java is as an “evangelist”.

Algorithm

August 21st, 2009

algorithm schemaIn mathematics, computing, linguistics, and related subjects, an algorithm is an effective method for solving a problem using a finite sequence of instructions. Algorithms are used for calculation, data processing, and many other fields.

Each algorithm is a list of well-defined instructions for completing a task. Starting from an initial state, the instructions describe a computation that proceeds through a well-defined series of successive states, eventually terminating in an final ending state. The transition from one state to the next is not necessarily deterministic; some algorithms, known as probabilistic algorithms, incorporate randomness.

A partial formalization of the concept began with attempts to solve the Entscheidungsproblem (the “decision problem”) posed by David Hilbert in 1928. Subsequent formalizations were framed as attempts to define “effective calculability” (Kleene 1943:274) or “effective method” (Rosser 1939:225); those formalizations included the Gödel-Herbrand-Kleene recursive functions of 1930, 1934 and 1935, Alonzo Church’s lambda calculus of 1936, Emil Post’s “Formulation 1” of 1936, and Alan Turing’s Turing machines of 1936–7 and 1939.

Etymology

Al-Khwārizmī, Persian astronomer and mathematician, wrote a treatise in 825 AD, On Calculation with Arabic Numerals. (See algorism). It was translated into Latin in the 12th century as Algoritmi de numero Indorum (al-Daffa 1977), whose title was likely intended to mean “Algoritmi on the numbers of the Indians”, where “Algoritmi” was the translator’s rendition of the author’s name; but people misunderstanding the title treated Algoritmi as a Latin plural and this led to the word “algorithm” (Latin algorismus) coming to mean “calculation method”. The intrusive “th” is most likely due to a false cognate with the Greek ἀριθμός (arithmos) meaning “number”.

Why algorithms are necessary: an informal definition

For a detailed presentation of the various points of view around the definition of “algorithm” see Algorithm characterizations. For examples of simple addition algorithms specified in the detailed manner described in Algorithm characterizations, see Algorithm examples.

While there is no generally accepted formal definition of “algorithm”, an informal definition could be “a process that performs some sequence of operations.” For some people, a program is only an algorithm if it stops eventually. For others, a program is only an algorithm if it stops before a given number of calculation steps.

A prototypical example of an “algorithm” is Euclid’s algorithm to determine the maximum common divisor of two integers (X and Y) which are greater than one: We follow a series of steps: In step i, we divide X by Y and find the remainder, which we call R1. Then we move to step i + 1, where we divide Y by R1, and find the remainder, which we call R2. If R2=0, we stop and say that R1 is the greatest common divisor of X and Y. If not, we continue, until Rn=0. Then Rn-1 is the max common division of X and Y. This procedure is known to stop always and the number of subtractions needed is always smaller than the larger of the two numbers.

We can derive clues to the issues involved and an informal meaning of the word from the following quotation from Boolos & Jeffrey (1974, 1999) (boldface added):

No human being can write fast enough or long enough or small enough to list all members of an enumerably infinite set by writing out their names, one after another, in some notation. But humans can do something equally useful, in the case of certain enumerably infinite sets: They can give explicit instructions for determining the nth member of the set, for arbitrary finite n. Such instructions are to be given quite explicitly, in a form in which they could be followed by a computing machine, or by a human who is capable of carrying out only very elementary operations on symbols (Boolos & Jeffrey 1974, 1999, p. 19)

The words “enumerably infinite” mean “countable using integers perhaps extending to infinity.” Thus Boolos and Jeffrey are saying that an algorithm implies instructions for a process that “creates” output integers from an arbitrary “input” integer or integers that, in theory, can be chosen from 0 to infinity. Thus we might expect an algorithm to be an algebraic equation such as y = m + n — two arbitrary “input variables” m and n that produce an output y. As we see in Algorithm characterizations — the word algorithm implies much more than this, something on the order of (for our addition example):

Precise instructions (in language understood by “the computer”) for a “fast, efficient, good” process that specifies the “moves” of “the computer” (machine or human, equipped with the necessary internally-contained information and capabilities) to find, decode, and then munch arbitrary input integers/symbols m and n, symbols + and = … and (reliably, correctly, “effectively”) produce, in a “reasonable” time, output-integer y at a specified place and in a specified format.

The concept of algorithm is also used to define the notion of decidability. That notion is central for explaining how formal systems come into being starting from a small set of axioms and rules. In logic, the time that an algorithm requires to complete cannot be measured, as it is not apparently related with our customary physical dimension. From such uncertainties, that characterize ongoing work, stems the unavailability of a definition of algorithm that suits both concrete (in some sense) and abstract usage of the term.

Expressing Algorithm

Algorithms can be expressed in many kinds of notation, including natural languages, pseudocode, flowcharts, and programming languages. Natural language expressions of algorithms tend to be verbose and ambiguous, and are rarely used for complex or technical algorithms. Pseudocode and flowcharts are structured ways to express algorithms that avoid many of the ambiguities common in natural language statements, while remaining independent of a particular implementation language. Programming languages are primarily intended for expressing algorithms in a form that can be executed by a computer, but are often used as a way to define or document algorithms.

There is a wide variety of representations possible and one can express a given Turing machine program as a sequence of machine tables (see more at finite state machine and state transition table), as flowcharts (see more at state diagram), or as a form of rudimentary machine code or assembly code called “sets of quadruples” (see more at Turing machine).

Sometimes it is helpful in the description of an algorithm to supplement small “flow charts” (state diagrams) with natural-language and/or arithmetic expressions written inside “block diagrams” to summarize what the “flow charts” are accomplishing.

Representations of algorithms are generally classed into three accepted levels of Turing machine description (Sipser 2006:157):

  • 1 High-level description:
“…prose to describe an algorithm, ignoring the implementation details. At this level we do not need to mention how the machine manages its tape or head”
  • 2 Implementation description:
“…prose used to define the way the Turing machine uses its head and the way that it stores data on its tape. At this level we do not give details of states or transition function”
  • 3 Formal description:
Most detailed, “lowest level”, gives the Turing machine’s “state table”.
For an example of the simple algorithm “Add m+n” described in all three levels see Algorithm examples.

Computer Algorithm

In computer systems, an algorithm is basically an instance of logic written in software by software developers to be effective for the intended “target” computer(s), in order for the software on the target machines to do something. For instance, if a person is writing software that is supposed to print out a PDF document located at the operating system folder “/My Documents” at computer drive “D:” every Friday at 10PM, they will write an algorithm that specifies the following actions: “If today’s date (computer time) is ‘Friday,’ open the document at ‘D:/My Documents’ and call the ‘print’ function”. While this simple algorithm does not look into whether the printer has enough paper or whether the document has been moved into a different location, one can make this algorithm more robust and anticipate these problems by rewriting it as a formal CASE statement[1] or as a (carefully crafted) sequence of IF-THEN-ELSE statements[2]. For example the CASE statement might appear as follows (there are other possibilities):

CASE 1: IF today’s date is NOT Friday THEN exit this CASE instruction ELSE
CASE 2: IF today’s date is Friday AND the document is located at ‘D:/My Documents’ AND there is paper in the printer THEN print the document (and exit this CASE instruction) ELSE
CASE 3: IF today’s date is Friday AND the document is NOT located at ‘D:/My Documents’ THEN display ‘document not found’ error message (and exit this CASE instruction) ELSE
CASE 4: IF today’s date is Friday AND the document is located at ‘D:/My Documents’ AND there is NO paper in the printer THEN (i) display ‘out of paper’ error message and (ii) exit.

Note that CASE 3 includes two possibilities: (i) the document is NOT located at ‘D:/My Documents’ AND there’s paper in the printer OR (ii) the document is NOT located at ‘D:/My Documents’ AND there’s paper in the printer.

The sequence of IF-THEN-ELSE tests might look like this:

TEST 1: IF today’s date is NOT Friday THEN done ELSE TEST 2:
TEST 2: IF the document is located at ‘D:/My Documents’ THEN display ‘document not found’ error message ELSE TEST 3:
TEST 3: IF there is NO paper in the printer THEN display ‘out of paper’ error message ELSE print the document.

These examples’ logic grants precedence to the instance of “NO document at ‘D:/My Documents’ “. Also observe that in a well-crafted CASE statement or sequence of IF-THEN-ELSE statements the number of distinct actions — 4 in these examples: do nothing, print the document, display ‘document not found’, display ‘out of paper’ — equals the number of cases.

Because a computational machine equipped with unbounded memory and the ability to execute CASE statements or a sequence of IF-THEN-ELSE statements together with just a few other instructions is Turing complete, anything that is computable will be computable by this machine. Thus this form of algorithm is fundamental to computer programming in all its forms (see more at McCarthy formalism).

Implementation

Most algorithms are intended to be implemented as computer programs. However, algorithms are also implemented by other means, such as in a biological neural network (for example, the human brain implementing arithmetic or an insect looking for food), in an electrical circuit, or in a mechanical device.

Example

One of the simplest algorithms is to find the largest number in an (unsorted) list of numbers. The solution necessarily requires looking at every number in the list, but only once at each. From this follows a simple algorithm, which can be stated in a high-level description English prose, as:

High-level description:

  1. Assume the first item is largest.
  2. Look at each of the remaining items in the list and if it is larger than the largest item so far, make a note of it.
  3. The last noted item is the largest in the list when the process is complete.

(Quasi-)formal description: Written in prose but much closer to the high-level language of a computer program, the following is the more formal coding of the algorithm in pseudocode or pidgin code:

Algorithm LargestNumber
  Input: A non-empty list of numbers L.
  Output: The largest number in the list L.

  largest ← L0
  for each item in the list L≥1, do
    if the item > largest, then
      largest ← the item
  return largest

Daftar Kode Smiley

August 21st, 2009

Ketika menulis komentar di sebuah blog atau sedang chating, biasanya akan lebih interaktif, jika kita menambahkan icon smiley. Smiley ini biasanya digunakan untuk memperkuat maksud tulisan kita. Biasanya seseorang menghafalkan beberapa kode untuk membuat smiley. Smiley yang sering dipakai biasanya hanya itu2 saja, (karena keterbatasan menghapal). Nah berikut ini akan saya berikan Daftar kode smiley. Untuk mencobanya anda dapat menuliskan kode tersebut di komentat artikel ini :D

icon text text full text icon full text
smile :) :-) :smile: lol :lol:
biggrin :D :-D :grin: redface :oops:
sad :( :-( :sad: cry :cry:
surprised :o :-o :eek: evil :evil:
eek 8O 8-O :shock: twisted :twisted:
confused :? :-? :???: rolleyes :roll:
cool 8) 8-) :cool: exclaim :!:
mad :x :-x :mad: question :?:
razz :P :-P :razz: idea :idea:
neutral :| :-| :neutral: arrow :arrow:
wink ;) ;-) :wink: mrgreen :mrgreen:

*kode kode di atas diambil dari link ini

Menghitung Waktu Eksekusi Program di Java dan C

August 20th, 2009

Method yang digunakan adalah:

Java: System.nanoTime();

C: clock();

Java

/**
 *
 * @author windu purnomo
 */
public class RunTime {

    public static void main(String[] args) {
        double start = System.nanoTime();
        int l = 0;
        for(int i=0; i<1000; i++){
            for(int j=0; j<1000; j++){
                for(int k=0; k<1000; k++){
                    l++;
                }
            }
        }
        double finish = System.nanoTime();
        System.out.println("waktu eksekusi program: "+(finish-start));
    }
}

C

#include <stdio.h>
#include <conio.h>
#include <time.h>

main(){
       int a, b, i, j;
       double start = clock();
       for(i=0; i<10000; i++){
          for(j=0; j<10000; j++){
              for(a=0; j< 1000; j++){}
          }
       }
       double stop = clock();
       printf("waktu eksekusi Program: %f", (stop-start));
       getch();
       return 0;
}

Install Apche Ant

August 20th, 2009

Apache Ant adalah tool yang digunakan untuk melakukan proses build. Bahasa pemrograman yang didukung oleh apche ant adalah Java. Ant menggunakan XML (build.xml) untuk melakukan skenario proses build. Ant adalah bagian dari Apache project, dan bersifat open source software.
Installasi Apache Ant

  1. Download Apcahe Ant
  2. Extract File hasil download (misal di: C:\Program Files\Apache Ant)
  3. Lakukan setting class path
    (prosesnya sama seperti setting class path tomcat, pada artikel saya sebelumnya)

Test Apache Ant
Masuk ke command prompt kemudian masuk ke directory tertentu. Kemudian ketik ant. Ada 3 kemungkinan respon yang muncul:
1. Ant belum terinstall, maka akan muncul respon seperti ini:

'ant' is not recognized as internal or external command,
operable program or barch file.

2. Ant sudah terinstall, tapi tidak ada file build.xml.

BuildFile: build.xml does not exist!
Build Failed

3. Ant sudah terinstall, ada file build.xml. Contoh outputny seperti ini:

Buildfile: build.xml

clean:
   [delete] Deleting directory E:\netbeans project\WebServiceAdministrator\bogor\build

prepare:
    [mkdir] Created dir: E:\netbeans project\WebServiceAdministrator\bogor\build
    [mkdir] Created dir: E:\netbeans project\WebServiceAdministrator\bogor\build\lib
    [mkdir] Created dir: E:\netbeans project\WebServiceAdministrator\bogor\build\DinasPendudukBogorTimur
    [mkdir] Created dir: E:\netbeans project\WebServiceAdministrator\bogor\build\DinasPendudukBogorTimur\META-INF

generate.service:
     [copy] Copying 1 file to E:\netbeans project\WebServiceAdministrator\bogor\build\DinasPendudukBogorTimur\META-INF
      [jar] Building jar: E:\netbeans project\WebServiceAdministrator\bogor\build\DinasPendudukBogorTimur.aar
     [copy] Copying 1 file to E:\Program Files\apache-tomcat-6.0.20_base\webapps\axis2\WEB-INF\services

BUILD SUCCESSFUL

Perbedaan Web Server dan Application Server

August 20th, 2009



Web server memberikan layanan untuk tampilan pada web browser, sedangkan Application server menyediakan operasi yang bisa dipanggil oleh aplikasi client. Singkatnya kita bisa katanan bahwa Web Server secara eksklusif menghandel HTTP request, sedangkan Application Server memberikan layanan bussiness logic untuk suatu aplikasi yang dimungkinkan melalui beberapa protokol, termasuk bisa juga lewat HTTP.

Web Server

Web server memberikan layanan permintaan melalui protokol HTTP. Ketika Web server menerima sebuah reques via HTTP atau HTTP request, dia akan merespon dan memberikan HTTP response, seperti mengirimkan halaman HTML. Dalam memproses request, web server bisa jadi akan merespon dengan halaman statik HTML atau gambar, mengirimkan redirect atau akan memberikan permintaan atau request tersebut ke script program dinamis yang lain seperti CGI, JSP dsb. Jadi pada umumnya, web server akan memberikan respon dalam bentuk halaman HTML umntuk pada akhirnya di tampilkan di web browser.

Nah…carana gini ne… ketika suatu request datang ke suatu web server, maka web server akan melanjutkannya kepada suatu program yang memang dituju untuk menhandel permintaan itu. Perlu diingat bahwa web server tidak menyediakan fungsionalitas apapun, kecuali hanya menyediakan lingkungan atau environment yang memungkinkan program server side script untuk terseksekusi dan memberikan respon balik. Sedangkan yang dilakukan oleh suatu program server side bisa macam2, bisa pemrosesan transaksi, koneksi databse, ataupun juga bisa messaging, redirecting dsb.

Application Server

Untuk application server, ia menyediakan layanan bisnis logic untuk aplikasi client bisa melalui berbagai protokol, termasuk di dalamnya protokol HTTP. Kalau web server intinya pada penerimaan request dan pengiriman kembali respon dalam bentuk halaman web untuk akhirnya ditampilkan kembali di browser, maka untuk aplication server menyediakan akses ke bisnes logic untuk digunakan oleh client. Program aplikasi client dapat menggunakan bisnis logic ini dengan memanggil method yang ada pada suatu objek…atau kalao di dunia struktural si…manggil fungsi atau prosedur lah…

ContohSebagai sebuah contoh, bayangkan sebuah alikasi toko online yang harus menyediakan informasi harga dan stok barang secara real time. Seperti yang kebnyakan sudah ada, apliaksi ini bisa didesain dengan sebuah halaman yang terdiri dari form, yang anda bisa memilih product dsb, kemudian setelah anda mensubmit request, akan muncul halamn respon yang berisi daftar arga dan stok barang yang anda pilih. Kemudian anda bisa memilih barang tersebut untuk dimasukkan ke daftar pembelian, atau cukup sekedar melihat saja. Aplikasi ini bisa dikembangkan melalui 2 cara yaitu dengan web server atau dengan application server.

cara 1: menggunakan Web server tanpa application server

Pada cara ini, web server akan menerima request, kemudian melanjutkan request tersebut ke program server side yang sesuai. Dari sini server side program akan mencari informasi harga dan stok dari database atau file. Setelah itu kemudian hasil tersebut diformulasikan dalam format HTML dan dikirimkan kembali ke web browser untuk ditampilkan lagi. Ringkasnya, web server akan memproses HTTP request dan meresponnya dengan HTML page.

cara 2: Web server dengan application server

Kita sekarang dapat meletakkan bisnis logic untuk pencarian harga dan stok pada application server. Ketika client membutuhkan untuk mencari daftar harga dan stok dari suatu barang, dapat langsung mengakses bisnis logic dan memanggil method untuk pencarian ini. Hasil yan gdidapatkan kemudian ditampilkan dalam browser,.

Pada cara ini, application server memberikan layanan business logic untuk pencarian daftar harga dan stok dari suatu produk. Ketika client meminta layana tersebut atau memanggil layana tersebut, application server akan menjalankan program itu dan akan mengirimkan kembali hasilnya ke client. Dan client akan menerima data hasil tersebut. Jadi data tidak dikirimkan dalam format HTML kepada client. Setelah mendapatkan hasil tersebut, maka client dapat menampilkannya dalam browser, tentu dengan formula HTML, tapi ini dilakukan oleh client.

Dengan cara ini maka plikasi pencarian harga untuk suatu barang tersebut lebih re-usable. Kalau ada objek lain yang memanggil, misal bukan pembeli, tetapi kasir, maka aplikasi logic untuk pencarian tersebut tetap bisa digunakan. Berbeda dengan cara no.1 yang mengirimkan hasil ke client sudah dalam bentuk formu HTML, jadi lebih un-re-usable.

Pada umumnya memang di dalam application server sudah ada web server. atau web server merupakan bagian dari application sever. Contoh Appliocation server : WebLogic Server (BEA), JBoss (Red Hat), WebSphere (IBM), JRun (Adobe), Apache Geronimo (Apache Foundation, based on IBM WebSphere), Oracle OC4J (Oracle Corporation), Sun Java System Application Server (Sun Microsystems) and Glassfish Application Server (based on Sun Java System Application Server). Contoh web server: Apache (oleh vendor apache), IIS (Microsoft), GFE (Google) dsb.

dikutip dari http://ifrozi.wordpress.com/2008/01/08/beda-web-server-application-server/

Install Apache Tomcat di Windows

August 20th, 2009


Apache Tomcat adalah servlet container yang di-develop oleh Apache Software Foundation (ASF). Tomcat mengimplementasikan Java servlet dan Java Serper Pages (JSP), dan menydiakan Java HTTP web server environment untuk menjalankan kode java.

Berikut ini langkah-langkah untuk melakukan installasi tomcat di windows, tomcat yang digunakan adalah tomcat versi terbaru ketika tulisan ini dibuat, yaitu Apache Tomcat-6.0.20:

  1. Download Apache Tomcat-6.0.20
  2. Extract file hasil download (misal C:\ProgramFiles\Apache Tomcat-6.0.20)
  3. Setting path untuk folder binary tomcat
    • Klik kanan pada My Computer, kemudian pilih propertise
    • Pilih tab Advanced > Environment Variables
    • Pada panel User variable for… klik button new.
      Isi Variable Name dengan: CATALINA_HOME
      Variable Value:  C:\ProgramFiles\Apache Tomcat-6.0.20
      Klik OK
    • Pada panel System variables pilih CLASSPATH kemudian klik button Edit
      Tambahkan di akhir nilai pada Variable value dengan %CATALINA_HOME%\bin;

Menjalankan Tomcat

Buka command prompt, masuk ke direktory binary tomcat (C:\ProgramFiles\Apache Tomcat-6.0.20\bin) kemudian ketik: startup

Test Tomcat

Buka browser kemudian ketikan: localhost:8080 di url.

Jika berhasil akan tampil halaman seperti ini:

Copy Isi Command Prompt ke Notepad

August 20th, 2009

Klik kanan pada layar command prompt, kemudian pilih Mark
Klik kanan pada header command prompt, kemudian pilih Edit > Copy
Buka Notepad
Kemudian paste pada notepad