博文

目前显示的是 十二月, 2013的博文

MVVM & knockout.js

knockout.js helps you simplify dynamic JavaScript UIs using the Model-View-ViewModel (MVVM) pattern. http://learn.knockoutjs.com/#/?tutorial=intro This website is a set of interactive coding exercises to help you quickly learn how to benefit from knockout.js and MVVM.

set & generics in java

        set & generics Set<String> sSet = this.mTables.keySet();         for ( Object obj: sSet ) {           if(obj instanceof Integer ){               int i= (Integer)obj;            }else if(obj instanceof String ){              String s = (String)obj;              System.out.println(s);            }         }

java.util.logging

1 . logging.properties    A -- Default :          My logging.properties file is at C:\Program Files\Java\jdk1.6.0_23\jre\lib.    B -- To read config from a file by using code. InputStream lp = new BufferedInputStream(new FileInputStream( "./config/log.properties")); LogManager .getLogManager(). readConfiguration (lp); lp.close();    C -- To get config from a property. String propString = "myClass.level=FINE"; byte[] propBytes = propString.getBytes(); LogManager.getLogManager().readConfiguration(new ByteArrayInputStream(propBytes)); 1.1 Example:   code :  //   this._log.log(Level.SEVERE, "getConnection:"+DBurl+":"+user, e); Out: SEVERE: getConnection:jdbc:oracle:thin:@127.0.0.1:1521/pdborcl:miis java.sql.SQLRecoverableException: ORA-01033 : ORACLE initialization or shutdown in progress ... ...  Reason : That is the connection to go Oracle12c1.  The DB pdborcl is no...

Minus operator versus 'not exists' for faster SQL query

From: h t t p s : // forums .oracle.com/thread/19816 It really depends on a bunch of factors. A MINUS will do a full table scan on both tables unless there is some criteria in the where clause of both queries that allows an index range scan. A MINUS also requires that both queries have the same number of columns, and that each column has the same data type as the corresponding column in the other query (or one convertible to the same type). A MINUS will return all rows from the first query where there is not an exact match column for column with the second query. A MINUS also requires an implicit sort of both queries NOT EXISTS will read the sub-query once for each row in the outer query. If the correlation field (you are running a correlated sub-query?) is an indexed field, then only an index scan is done. The choice of which construct to use depends on the type of data you want to return, and also the relative sizes of the two tables/queries. If the outer table ...

json and java

Take  a look FastJSON that is  JSON Processor. h t t p : / / c o d e . alibabatech.com/w i k i/display/FastJSON/Overview h t t p s : / / github .com/AlibabaTech/fastjson/ h t t p s : / / github .com/alibaba/fastjson

Runtime.exec() - 01

2. The sub process get inputting message from the main process   // testSubProcess.java import java.io.*; public class testSubProcess{   public static void main(String[] args){     BufferedReader br = new BufferedReader(new InputStreamReader(System.in));     System.out.println("From the main process:"+ br.readLine());   } } //testMainProcess.java import java.io.*; public class testMainProcess{    public static void main(String[] args){       Runtime rt = Runtime.getRuntime();       Process p = rt.exec("java testSubProcess");      //ProcessBuilder pb = new ProcessBuilder("java", "testSubProcess");      //Process p = pb.start();       BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));       bw.flush();       bw.close();    } }

Typed Arrays WebGL

Typed Arrays is from WebGL. IE has supported it. The following url is demo http://ie.microsoft.com/testdrive/HTML5/TypedArrays/

Runtime.exec() -00

1.When Runtime.exec() won't From javaworld.com / javaworld/jw-12-2000/jw-1229-traps.html?page = 4, it is a great document. Navigate yourself around pitfalls related to the Runtime.exec() method By Michael C. Daconta, JavaWorld.com, 12/29/00 Listing 4.5 GoodWindowsExec.java import java.util.*; import java.io.*; class StreamGobbler extends Thread { InputStream is; String type; StreamGobbler(InputStream is, String type) { this.is = is; this.type = type; } public void run() { try { InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line=null; while ( (line = br.readLine()) != null) System.out.println(type + ">" + line); } catch (IOException ioe) { ioe.printStackTrace(); } } } public class GoodWindowsExec { p...