`
Alrale
  • 浏览: 60796 次
  • 来自: fantasy
社区版块
存档分类
最新评论
文章列表
// ex1 public class Singleton {   private Singleton(){}   private static Singleton instance = new Singleton();     public static Singleton getInstance() {     return instance;       } } //ex2 public class Singleton {   private static Singleton instance = null;   public static synchron ...
float f = 123.456f; float f1 = new BigDecimal(f).setScale(2,BigDecimal.ROUND_HALF_UP).floatValue(); float f2 = Math.round(f * 100) / 100f; float f3 = new Float(new DecimalFormat(".##").format(f)).floatValue();  
如果IT的历史,是以人为主体串接起来的话,那么肯定少不了Doug Lea。这个鼻梁挂着眼镜,留着德王威廉二世的胡子,脸上永远挂着谦逊腼腆笑容,服务于纽约州立大学Oswego分校计算器科学系的老大爷。 说他是这个世界上对Java影响力最大的个人,一点也不为过。因为两次Java历史上的大变革,他都间接或直接的扮演了举足轻重的脚色。一次是由JDK 1.1到JDK 1.2,JDK1.2很重要的一项新创举就是Collections,其Collection的概念可以说承袭自Doug Lea于1995年发布的第一个被广泛应用的collections;一次是2004年所推出的Tiger。Tiger广纳了1 ...
一.SQL语言的使用1.IN 操作符    用IN写出来的SQL的优点是比较容易写及清晰易懂,这比较适合现代软件开发的风格。    但是用IN的SQL性能总是比较低的,从ORACLE执行的步骤来分析用IN的SQL与不用IN的SQL有以下区别:    ORACLE试 ...
Web components usually use PrintWriter to produce responses; PrintWriter automatically encodes using ISO-8859-1. Servlets can also output binary data using OutputStream classes, which perform no encoding. An application that uses a character set that cannot use the default encoding must explicitly se ...
SUN官方解释(见《The Java EE 5 Tutorial 》) Response and Page Encoding You also use the contentType attribute to specify the encoding of the response. For example, the date application specifies that the page should be encoded using UTF-8, an encoding that supports almost all locales, using the followin ...
解决ORA-12560: TNS: 协议适配器错误 造成ORA-12560: TNS: 协议适配器错误的问题的原因有三个:1.监听服务没有起起来。 2.数据库实例没有起起来。 3.注册表问题。 运行-->regedit 然后进入HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0 将该环境变量ORACLE_SID设置为数据库实例的SID
Struts2 five core components (actions, interceptors, value stack/ OGNL, result type)   all: The controller is implemented with a Struts2 dispatch servlet filter as well as interceptors. the model is implemented with actions,and the view as a combination of result types and results,The value stack and ...
Here are some of the features that may lead you to consider struts2 : 1, Action based framework 2, Mature with a vibrant developer and user community 3, Annotation and XML configuration options 4, POJO-based actions that are easy to test 5, Spring,SiteMesh and Tiles integration 6, OGNL expression lan ...
copy from YuLimin “Nearly 80 to 85 percent of database performance problems arise from the application database's design or the application's own code. Good transaction throughput requires an application designed from the database up, with performance and scalability in mind.” ----DB2 Magazine ...

Jdbc demo

    博客分类:
  • Java
String url = "jdbc:mysql://127.0.0.1:3306/mysql"; String username = "root"; String password = "123456"; try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection(url,username,password); String sql = "select * from table& ...
  远程过程调用(RPC)是一个协议,程序可以使用这个协议请求网络中另一台计算机上某程序的服务而不需知道网络细节。(过程调用有时也称作函数调用,或子例行程序调用。)RPC使用client/server模型。请求程序是client,而服务提供程序则为server。就像一般的本地过程调用一样,RPC是一个同步操作,直到远程过程结果返回请求程序才可以挂起。尽管如此,使用轻质进程或线程时,它们共享同一地址空间,是允许多个RPC并发执行的。   当使用RPC的程序语句被编译成可执行程序时,一个存根将会被包括在编译的代码中,它相当于远程过程代码的代表。   当程序运行,过程调用发生,存根收到请求并将其转 ...
[img]/upload/attachment/42963/5ca6873d-8bac-3f18-a2ec-b967a224ee56.gif" alt="" width="568" height="404[/img]
public class WriterAppender extends AppenderSkeleton WriterAppender() This default constructor does nothing. WriterAppender(Layout layout, java.io.OutputStream os) Instantiate a WriterAppender and set the output destination to a new OutputStreamWriter initialized with os as its Ou ...
前面几个都是概念,现在是实战 Log4j支持两种格式的配置文件:XML格式和Java的property格式. log4j.properties 置于classes下   # root log4j.rootLogger=debug, stdout, R log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout # Pattern to output the caller's file name and line number. ...
Global site tag (gtag.js) - Google Analytics