Notes by meiu

Displaying notes 1 - 7
Created by meiu on July 22, 2010 22:40:23    Last update: July 22, 2010 22:41:04
Base64 encoding replaces every 3-byte (24bit) sequence with a 4-byte sequence with 6 effective bits in each byte - therefore eliminating un-printable characters. The expansion ratio is 4:3.
Created by meiu on July 22, 2010 20:16:59    Last update: July 22, 2010 20:17:28
By this thread on OTN, JRockit mission control and JRockit real time are exactly the same! JRockit Mission Control x JRockit Real Time But Oracle is offering downloads with two separate links with no explanation what so ever?!
Created by meiu on July 07, 2010 15:16:34    Last update: July 07, 2010 15:17:08
Example: <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> <fmt:formatDate type="both" dateStyle="short" timeStyle="short" value="${notifyDateTime}"/> Full attributes: Attribute Meaning value Date object to be formatted type Format time only ('time'), date only ('date'), or both date and time ('both')? dateStyle Style to format date, e.g., default, short, long, full etc (c.f. JavaDoc for java.text.DateFormat) timeStyle Style for format time, e.g., default, short, long, full etc (c.f. JavaDoc for java.text.DateFormat) pattern User defined pattern, e.g., MM/dd/yyyy timeZone Which time zone to display the date for? var If the var attribute is specified, then a String value containing the formatted date is assigned to the named variable. Otherwise, the <fmt:formatDate> tag will write out the formatting results. scope When the var attribute is present, the scope attribute specifies the scope of the ...
Created by meiu on February 11, 2010 04:34:48
Bring up the System Properties dialog by pressing Windows Logo + Pause/Break . Select the Advanced tab. Click the "Environment Variables" button. Create a new environment variable by clicking New . Edit an existing one by clicking Edit . User specific variables are on the top. System wide variables (effective for all users) are at the bottom.
Created by meiu on February 10, 2010 20:53:27
Step by step procedure to setup OC4J server for Eclipse. Version used is Galileo for Java EE Developers. Initialize OC4J You'll be asked to create a password the first time you run the standalone OC4J server. You need to remember this password and use it in the Eclipse setup. In the following C:\jdev1013_5 is where the JDeveloper suite is installed. cd C:\jdev1013_5\j2ee\home java -jar oc4j.jar Add Server Runtime Environment Go to Windows menu, bring up the Preferences dialog. Select Server -> Runtime Environments, click Add. Select Oracle OC4J Standalone 10.1.3.n, click Next. Enter J2EE home and click Finish. Add a server for OC4J Go to Windows menu, select Show View -> Servers. If Servers menu is not visible, select Other and enter "servers" in the ...
Created by meiu on February 09, 2010 03:26:14    Last update: February 09, 2010 03:26:44
Simple JDBC code for Oracle. import java.sql.*; public class JDBCHelloWorld { public static void main(String args) throws Exception { Connection conn = null; try { // register Oracle JDBC driver with DriverManager Class.forName("oracle.jdbc.driver.OracleDriver"); // get a connection to the database conn = DriverManager.getConnection( "jdbc:oracle:thin:@localhost:1521:XE", "scott", "tiger"); // construct a Statement Statement stmt = conn.createStatement(); // run query ResultSet rs = stmt.executeQuery("SELECT 'Hello World' FROM DUAL;"); // iterate through the result set while (rs.next()) { System.out.println(rs.getString(1)); } } finally { // always close JDBC connection in a finally block! if (conn != null) conn.close(); } } }
Created by meiu on July 29, 2009 19:30:35
Without the break statement, the Java switch/case block looks very deceptive. Code: public class TestCase { public static void main(String[] args) { switch(args.length) { case 0: System.out.println("No arguments"); case 1: System.out.println("One argument"); case 2: System.out.println("Two arguments"); default: System.out.println("The default"); } } } Test: C:\tmp>java TestCase No arguments One argument Two arguments The default C:\tmp>java TestCase 1 One argument Two arguments The default C:\tmp>