随笔分类 -  学习笔记

Unicode中跟汉字相关的一些内容的总结陈词
摘要:UniHan 这几天琢磨着怎么方便的给汉字注音,因为要知道具体哪些Unicode是给汉字用的,就读了读Unicode的官方文档.目前unicode已经发展到了7.0.不看不知道,发现Unicode的定义中颇有些有趣的内容,写下了给大家分享下,也算是个笔记. Unicode中跟汉字相关统称为UniH... 阅读全文

posted @ 2014-09-29 16:33 learner 阅读(4699) 评论(1) 推荐(2)

C#: the sample usage of c# template
摘要:1. class definition with constraints1classTest<T,V>whereV:MyType{2publicStringname;3publicTvalue;4publicvirtualvoidprint(){5Console.WriteLine("{0}={1}",name,value);6}//print()7}//class2. inherited class definition with constraint( my use constraint)12classTest2<T1,T2>:Test<T 阅读全文

posted @ 2012-10-23 23:41 learner

Memo: How to use UMDH to detect memory leak
摘要:1. Download windows debug tools from MS 2. Based on the app type (x86 or x64), add path : C:\Program Files (x86)\Windows Kits\8.0\Debuggers\x86(or x64) 3. For all the dlls and exes I wanna detect: run a. Gflags –i <dll name or exe name> +ust 4. Find you *.pdb, make sure it exist in _NT_SYMBOL_ 阅读全文

posted @ 2012-09-28 10:41 learner

build curl on windows using visual studio
摘要:1. download curl-7.27.0.zip2. unzip to a folder3. tried to used the provided make file, not working on windows 7 + visual studio 2010, decided to make a vc project by myself4. create a new vc project file called vc-curl, add the relative c++ files (based on the make file), include the folders, etc, 阅读全文

posted @ 2012-09-20 14:59 learner

compile openssl on windows
摘要:1. download SSL http://www.cnblogs.com/sliencer/admin/ftp://ftp.openssl.org/snapshot/openssl-1.0.2-stable-SNAP-20120920.tar.gz2. unpack to a folder3. download nasm from http://www.nasm.us/pub/nasm/releasebuilds/2.10.05/win32/ based on instructions of INSTALL.W32 under SSL4. put nasm to PATH : set pa 阅读全文

posted @ 2012-09-20 14:43 learner

java: redirect System.out to a file
摘要:1PrintStreamprintStream=newPrintStream(newFileOutputStream(newFile("somename.txt")));2System.setOut(printStream);3System.setErr(printStream); 阅读全文

posted @ 2012-05-24 15:38 learner

start jvm from c++ using jni
摘要:copy some of this from oracle sample code:1int_tmain(intargc,_TCHAR*argv[])2{3JavaVM*jvm;/*denotesaJavaVM*/4JNIEnv*env;/*pointertonativemethodinterface*/5JavaVMInitArgsvm_args;/*JDK1.1VMinitializationarguments*/6JavaVMOptionoptions[2];7vm_args.version=0x00010001;/*Newin1.1.2:VMversion*/8/*Getthedefa 阅读全文

posted @ 2012-05-24 15:36 learner

java: print out jvm properties
摘要:Print all jvm properties, including version, architecture, etc1packagecom.my.test;23importjava.util.Properties;45publicclassHelloWorld{67/**8*@paramargs9*/10publicstaticvoidmain(String[]args){11//System.out.println("HelloWorld!");12Propertiesprops=System.getProperties();13for(ObjectpropKey 阅读全文

posted @ 2012-05-01 23:23 learner

linux 笔记: mysql : connect with jdbc
摘要:1importjava.sql.Connection;2importjava.sql.DriverManager;3importjava.sql.ResultSet;4importjava.sql.SQLException;5importjava.sql.Statement;678publicclassHello{910/**11*@paramargs12*@throwsClassNotFoundException13*@throwsSQLException14*/15publicstaticvoidmain(String[]args)throwsClassNotFoundException, 阅读全文

posted @ 2012-03-26 00:22 learner

linux 笔记: mysql : basic commands
摘要:login mysql1. login without passwordmysql -h hostname -u rootormysql -u root2. promp passwordmysql -u root -p3. input password in command linemysql -u root -pMYPASSWORDormysql -u root --password=MYPASSWORD4. login to a database(like mysql)mysql -u root -pXXXX mysql*********************************** 阅读全文

posted @ 2012-03-25 23:32 learner

linux 笔记: mysql : install and primary usage
摘要:install --sudo apt-get install mysql-serversudo apt-get install mysql-cliententer my sql query tool:mysql --user=root --password=xxxcommands:-- show all databasesshow databases;-- change databaseUSE mysql;-- check how many users are there in current databaseselect host,user,password from user;-- add 阅读全文

posted @ 2012-03-25 16:38 learner

linux: change owner
摘要:# change owner of all the fies under dirNamechown -R username dirName#change owner and the file group of all the files under dirNamechown -R username:groupName dirName 阅读全文

posted @ 2012-03-22 23:27 learner

java jni笔记
摘要:在java中定义native method public native void set_intValue(int selfHashCode, int v);从java中生成C++用头文件 javah -jni -classpath bin -d hdr HelloWorldC++ project的配置 include目录 c:\Program Files\Java\jdk1.7.0_02\includeinclude目录 c:\Program Files\Java\jdk1.7.0_02\include\win32include目录 对应javaclass.h的位置C++中基本类型 JNIE 阅读全文

posted @ 2012-03-14 21:58 learner

java笔记– 用socket做的一个简单的http client
摘要:import java.io.File;import java.io.FileOutputStream;import java.io.InputStream;import java.io.OutputStream;import java.net.*;import java.nio.charset.Charset;import java.nio.file.Files;import java.util.Scanner;public class TestSocket_Client { public static void main(String[] args) throws Exception { 阅读全文

posted @ 2012-03-11 13:23 learner

java笔记 - 输出NetworkAddress, InetAddress, NetworkInterface相关的信息
摘要:import java.net.*;import java.util.*;import org.junit.Test;public class TestSocket_AddressesAndInterfaces { @Test public void NetworkInterfaceStaticMethodsExample () throws Exception { Enumeration<NetworkInterface> interfaceList = null; interfaceList = NetworkInterface.getNetworkInterfaces(); 阅读全文

posted @ 2012-03-11 13:22 learner

java笔记 - 如何用socket做一个简单的http server
摘要:功能, 接受input, 将httpheader 返回 import java.io.*;import java.util.*;import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.TimeUnit;import java.net.*;public class TestSocket_Server { class MySocketHandler implements Runnable { @Override public vo... 阅读全文

posted @ 2012-03-11 13:22 learner

java 笔记: concurrency 之 thread state
摘要:线程有4中状态: New, Runnable, Blocked, Dead 当调用Sleep时, 线程进入Blocked状态直到超时 当调用Wait(),将进入block状态直到超时或得到notify(), notifyAll(), signal(), signalAll() 当线程进行i/o操作时, 线程进入Blocked状态 当线程调用一个synchronized method时并且此method不可用时, 将进入block 注意:suspend()和resume(),stop()已经不再使用,易引起deadlock 如何中断一个线程: 如果有thread实例, 可... 阅读全文

posted @ 2012-03-04 21:09 learner

java 笔记 :创建anonymous类的实例
摘要:import java.lang.reflect.InvocationTargetException;import java.lang.reflect.Method;public class Test_Anonymous { public static void main(String[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { Object o = new IRun(. 阅读全文

posted @ 2012-03-04 21:08 learner

java 笔记: concurrency 之 synchronization
摘要:1. 当某个method需要同步访问时, 可以用synchronized来修饰 import static org.junit.Assert.*;import java.util.ArrayList;import java.util.List;import java.util.Random;import java.util.concurrent.Callable;import java.util.concurrent.ExecutionException;import java.util.concurrent.ExecutorService;import java.util.concurre. 阅读全文

posted @ 2012-03-04 21:06 learner

java 笔记 : 多线程处理–runnable & callable
摘要:1. runnable interface – this interface could be called by Thread() or ExecutorServiceimport static org.junit.Assert.*;import java.util.Random;import org.junit.Test;public class Test_runnable { @Test p... 阅读全文

posted @ 2012-03-04 12:17 learner

导航