SERVLET / NOTES</>↗Servlet23 Nov 2006
Servlet is a Java solution for creating a dynamic web application, it can be compared with the old CGI technology. Using Servlet we can create a web application that can display information from a database, receive information from a web form to be stored in the application database. This example shows the very basic of […]
CORE API / NOTES</>↗Core API19 Nov 2006
package org.kodejava.util; import java.util.Arrays; import java.util.Collections; import java.util.List; public class ArrayShuffle { public static void main(String[] args) { // Initialize the contents of our array String[] alphabets = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J"}; // As the Collections.shuffle() method need a list for the parameter // we convert our array into […]
SECURITY / NOTES</>↗Security14 Nov 2006
You are creating a user management system that will keep user profile and their credential or password. For security reason you’ll need to protect the password, to do this you can use the MessageDigest provided by Java API to encrypt the password. The code example below show you an example how to use it. package […]
CORE API / NOTES</>↗Core API09 Nov 2006
Using for-each command to iterate arrays or a list can simplified our code. Below is an example how to do it in Java. The first loop is for iterating array and the second for iterating a list containing a some names. package org.kodejava.lang; import java.util.ArrayList; import java.util.List; public class ForEachExample { public static void main(String[] […]
CORE API / NOTES</>↗Core API05 Nov 2006
package org.kodejava.lang; public class StringToInteger { public static void main(String[] args) { // Some random selected number, could representing a decimal, // hexadecimal or octal number. String myLuckyNumber = "13"; // We convert a string to an integer by invoking parseInt() method // of the Integer class. int number = Integer.parseInt(myLuckyNumber); System.out.println("My lucky number is: […]
ZIP AND GZIP / NOTES</>↗Zip and GZIP03 Nov 2006
package org.kodejava.util.zip; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; public class ZippingFileExample { public static void main(String[] args) { String source = "data.txt"; String target = "data.zip"; try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(target)); InputStream is = ZippingFileExample.class.getResourceAsStream("/" + source)) { if...