博文

目前显示的是 2013的博文

Java多重继承

记忆里,JAVA中类是不充许多重继承的,但是今天看Spring的东西,发现他一个类继承很多,那会没有注意,现在才发现都是接口,这也就是经常在书中看到的通过实现多个接口来达到多重继承,


Java 多线程(一)

Java多线程在JDK1.5 之前有2种实现方式,一种为实现接口runable ,一种为继承Thread


jdk1.5 引入Executor,通过静态方法cachedThreadPool,fixThreadPool,SigleThreadpool产生ExecutorService

最后ExecutorService.execute 执行线程。


获取有返回值的线程,Callable


Maven 配置

Unzip the distribution archive, i.e. apache-maven-3.0.5-bin.zip to the directory you wish to install Maven 3.0.5. These instructions assume you chose C:\Program Files\Apache Software Foundation. The subdirectory apache-maven-3.0.5 will be created from the archive. Add the M2_HOME environment variable by opening up the system properties (WinKey + Pause), selecting the "Advanced" tab, and the "Environment Variables" button, then adding the M2_HOME variable in the user variables with the value C:\Program Files\Apache Software Foundation\apache-maven-3.0.5. Be sure to omit any quotation marks around the path even if it contains spaces. Note: For Maven   2.0.9, also be sure that the M2_HOME doesn't have a '\' as last character. In the same dialog, add the M2 environment variable in the user variables with the value %M2_HOME%\bin.Optional: In the same dialog, add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, e.g. the …

Obj.toString()和String.valueOf(Obj)的区别

如果object为空,   Obj.toString() ,会出现Exception in thread "main" java.lang.NullPointerException


每日总结

String.format %s 替换字符串

ex:
 String.format("Test %s","suessful")

匹配字符串,使用忽略大小写的方法。


SQl:

oracle 获取当前时间 sysdate, 日期转换方法to_date("1900-01-01","YYYY-mm-dd")

MSSQl  getdate ,covent

mysql  now   dataformat("1900-01-01","%y-%m-%d")


Code Complete (1)

Chapter 18

18.1

表驱动法,

编码中,可以适当的将IF条件写入表中,来达到减少代码量,提供可读性和维护性。



18.2

直接访问表。

Androidpn推送

基于XMPP的推送服务

Logback

pom.xml


     <!--通用日志接口-->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.2</version>
        </dependency>

     <!--commons-log to slf4j-->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>1.7.2</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>1.0.9</version>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.0.9</version>
        </depende…

Apache Mina

importjava.io.IOException;importjava.net.InetSocketAddress;importjava.nio.charset.Charset;importorg.apache.mina.core.service.IoAcceptor;importorg.apache.mina.core.session.IdleStatus;importorg.apache.mina.filter.codec.ProtocolCodecFilter;importorg.apache.mina.filter.codec.textline.TextLineCodecFactory;importorg.apache.mina.filter.logging.LoggingFilter;importorg.apache.mina.transport.socket.nio.NioSocketAcceptor;publicclassMinaTimeServer{privatestaticfinalintPORT=9123;publicstaticvoidmain(String[]args)throwsIOException{IoAcceptoracceptor=newNioSocketAcceptor(); // 日志拦截器 acceptor.getFilterChain().addLast("logger",newLoggingFilter());acceptor.getFilterChain().addLast("codec",newProtocolCodecFilter(newTextLineCodecFactory(Charset.forName("UTF-8"))));acceptor.setHandler(newTimeServerHandler());acceptor.getSessionConfig().setReadBufferSize(2048);acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE,10);acceptor.bind(newInetSocketAddress(PO…

数据库表行列转置

图片
Select name,   SUM( DECODE ( subject,’语文’, result,0 )) 城语文,   SUM( DECODE ( subject,’数学’, result,0 )) 数学,   SUM( DECODE ( subject,’物理’, result,0 )) 物理  FROM cj  GROUP BY name;注:在不使用聚合函数的时候,group by 子句中必须包含所有的列。除聚集函数外的列必须全部包含在子句中。