JASYPT / CATATAN</>↗Jasypt10 Apr 2009
This code demonstrate how to use the StandardPBEByteEncryptor class to encrypt and decrypt bytes information. package org.kodejava.jasypt; import org.jasypt.encryption.pbe.StandardPBEByteEncryptor; import java.util.Arrays; public class ByteEncryptorDemo { public static void main(String[] args) { String text = "The quick brown fox jumps over the lazy dog"; System.out.println("Text = " + Arrays.toString(text.getBytes())); StandardPBEByteEncryptor encryptor = new StandardPBEByte...
JASYPT / CATATAN</>↗Jasypt08 Apr 2009
This example is showing you how to use the Jasypt API to write a simple code to do string encryption and decryption. In this example we are going to use the BasicTextEncryptor class which use the PBEWithMD5AndDES algorithm. This class is an implementation of the TextEncryoptor interface. You can download the library from their website, […]
CORE API / CATATAN</>↗Core API06 Apr 2009
This example show you how to use java.text.MessageFormat class to format a message that contains numbers. package org.kodejava.text; import java.text.MessageFormat; import java.util.Locale; public class MessageFormatNumber { public static void main(String[] args) { // Set the Locale for the MessageFormat. Locale.setDefault(Locale.US); // Use the default formatting for number. String message = MessageFormat.format("This is a {0} and […]
CORE API / CATATAN</>↗Core API02 Apr 2009
Here we demonstrate how to use the java.text.MessageFormat class to format a message contains time information. package org.kodejava.text; import java.util.Date; import java.util.Calendar; import java.util.Locale; import java.text.MessageFormat; public class MessageFormatTime { public static void main(String[] args) { Date today = new Date(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.HOUR, 7); Date next7Hours = calendar.getTime(); // We want the […]
CORE API / CATATAN</>↗Core API29 Mar 2009
This example demonstrate how you can use the java.text.MessageFormat class to format a message with a date information in it. package org.kodejava.text; import java.util.Date; import java.util.Calendar; import java.util.Locale; import java.text.MessageFormat; public class MessageFormatDate { public static void main(String[] args) { Date today = new Date(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, 7); Date nextWeek = calendar.getTime(); […]
APACHE POI / CATATAN</>↗Apache POI25 Mar 2009
The code below check if the first cell of an Excel file contains a date value. In Excel the cell type for date is returned as HSSFCell.CELL_TYPE_NUMERIC, to make sure if it contains a date we can use a utility method DateUtil.isCellDateFormatted(Cell cell), this method will check if the cell value is a valid date. […]