diff --git a/resources/Sublime/Anaconda.sublime-settings b/resources/Sublime/Anaconda.sublime-settings index 4eb9906..033d41e 100644 --- a/resources/Sublime/Anaconda.sublime-settings +++ b/resources/Sublime/Anaconda.sublime-settings @@ -1,12 +1,12 @@ { - "anaconda_linter_underlines": false, + // "anaconda_linter_underlines": false, "auto_formatting": true, - "complete_all_parameters": true, - "complete_parameters": true, + // "complete_all_parameters": true, + // "complete_parameters": true, "pep8_ignore": [ "E501" ], - "python_interpreter": "python", + "python_interpreter": "D:\\works\\Python35\\python.exe", "suppress_explicit_completions": true, "suppress_word_completions": true } \ No newline at end of file diff --git a/src/main/java/osc/git/eh3/dfd.java b/src/main/java/osc/git/eh3/dfd.java new file mode 100644 index 0000000..6278fd3 --- /dev/null +++ b/src/main/java/osc/git/eh3/dfd.java @@ -0,0 +1,58 @@ +package osc.git.eh3; + +/** + * Created by lixiangrong on 2016/12/23. + */ +public class dfd { + public static void main(String[] args) { + + } + public void printCircle(int[][] matrix, int startX, int startY, int endX, int endY) { + // only one column left + if (startY == endY) { + for (int i = startX; i <= endX; i++ ) { + System.out.println(matrix[i][endY]); + } + return; + } + // only one row left + if (startX == endX) { + for (int i = startY; i <= endY; i++ ) { + System.out.println(matrix[startX][i]); + } + return; + } + for (int i = startY; i < endY; i++ ) { + System.out.println(matrix[startX][i]); + } + for (int i = startX; i < endX; i++ ) { + System.out.println(matrix[i][endY]); + } + for (int i = endY; i > startY; i-- ) { + System.out.println(matrix[endX][i]); + } + for (int i = endX; i > startX; i-- ) { + System.out.println(matrix[i][startY]); + } + + } + + public void printMatrix(int[][] matrix) { + + if (matrix == null) { + return; + } + int startX = 0; + int startY = 0; + int endY = matrix[0].length - 1; + int endX = matrix.length - 1; + + while ((startX <= endX) && (startY <= endY)) { + printCircle(matrix, startX, startY, endX, endY); + startX++; + startY++; + endX--; + endY--; + } + } +} diff --git a/src/main/java/osc/git/eh3/test/TestDecodeHex.java b/src/main/java/osc/git/eh3/test/TestDecodeHex.java index edff179..6e655f3 100644 --- a/src/main/java/osc/git/eh3/test/TestDecodeHex.java +++ b/src/main/java/osc/git/eh3/test/TestDecodeHex.java @@ -8,7 +8,7 @@ import org.apache.commons.codec.binary.Hex; public class TestDecodeHex { // 十六进制转字符串 public static void main(String[] args) throws Exception { - String data = "E7A7AFE69E81E58AA0E5BFABE7A791E68A80"; + String data = "E88194E7B3BBE4BABAE6B7BBE58AA0E5A4B1E8B4A5"; System.out.println(new String(Hex.decodeHex(data.toCharArray()), "utf-8")); System.out.println(Hex.encodeHexString("测试粗我".getBytes())); diff --git a/src/main/java/osc/git/eh3/thread/TestSingleThreadExecutor.java b/src/main/java/osc/git/eh3/thread/TestSingleThreadExecutor.java new file mode 100644 index 0000000..0790c70 --- /dev/null +++ b/src/main/java/osc/git/eh3/thread/TestSingleThreadExecutor.java @@ -0,0 +1,40 @@ +package osc.git.eh3.thread; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +class MyThread extends Thread { + private String name; + + + public MyThread(String name) { + this.name = name; + } + + + @Override + public void run() { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + System.out.println(name + "正在进行。。。。。"); + } +} + + +public class TestSingleThreadExecutor { + public static void main(String[] args) { + ExecutorService executorService = Executors.newSingleThreadExecutor(); + Thread t1 = new MyThread("t1"); + Thread t2 = new MyThread("t2"); + Thread t3 = new MyThread("t3"); + Thread t4 = new MyThread("t4"); + executorService.execute(t1); + executorService.execute(t2); + executorService.execute(t3); + executorService.execute(t4); + executorService.shutdown(); + } +} \ No newline at end of file diff --git a/src/main/java/osc/git/eh3/thread/ThreadPoolExecutorTest.java b/src/main/java/osc/git/eh3/thread/ThreadPoolExecutorTest.java new file mode 100644 index 0000000..0552bad --- /dev/null +++ b/src/main/java/osc/git/eh3/thread/ThreadPoolExecutorTest.java @@ -0,0 +1,27 @@ +package osc.git.eh3.thread; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +/** + * Created by lixiangrong on 2016/12/22. + */ +public class ThreadPoolExecutorTest { + public static void main(String[] args) { + ExecutorService cachedThreadPool = Executors.newCachedThreadPool(); + for (int i = 0; i < 10; i++) { + final int index = i; + //try { + // Thread.sleep(index * 1000); + //} catch (InterruptedException e) { + // e.printStackTrace(); + //} + cachedThreadPool.execute (new Runnable() { + public void run() { + //System.out.println(index); + System.out.println(Thread.currentThread().getName()); + } + }); + } + } +}