自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(36)
  • 收藏
  • 关注

转载 how to 编写一个Iterator

首先,考虑编写iterator,我们需要基于哪几个方面的考虑:由于迭代器会访问List的私有域,因此,可以有2种方式: 一种的改变List的域的可见性,让其变成public或friendly(默认的可见性,即包可见性)的,不过这违反了良好的面向对象编程的羁绊原则,它要求数据尽可能的隐蔽。 另外一种是为List添加一个内部类或者嵌套类,然后我们来看这2种类的区别...

2013-06-10 10:59:00 126

转载 如何理解java的有符号数

首先我们需要区分的是什么是有符号数和无符号数。有符号和无符号的区别是一个有符号位,另一个没有符号位.没有符号位的数字只能有0和正值,有符号位的数字可以有正零,负零和正数负数.从这里可以看出,有符号和无符号的区别就是是否能表示负数。然后我们再来理解java虚拟机所支持的所有整数数据类型-byte,short,int和long,他们都是带符号的二进制补码。那么为...

2013-02-25 21:51:00 153

转载 java代码的执行机制(分布式java应用笔记)

先看看jvm规范定义的标准结构:首先我们看看类文件是如何被编译生成的。 从上图中可以看出通过javac编译代码分为3个步骤。我们再来分析这3个步骤:1,分析和输入到符号表(Parse and Enter)Parse的过程为词法和语法分析。词法分析完成的是将代码字符串转变为token序列;语法分析完成的是根据语法由token序列生成抽象语法树。Enter过...

2013-02-23 14:53:00 89

转载 JVM线程资源同步机制(分布式java应用笔记)

首先我们分析下面的代码:int i = 0;public int getNextId(){ return i++;}它的执行步骤为:1,jvm首先在main memory(jvm堆)给i分配一个内存存储场所,并存储其值为0.2,线程启动后,会分配一片working memory 区(通常是操作数栈),当线程执行到return i++时,jvm并不是简单的...

2013-02-21 22:15:00 113

转载 How I Read Programming Books

I studied Electrical Engineering in undergrad and the only programming languages we've had to use in EE were C/C++, Assembly, and Matlab. After going to aStartupWeekendevent and getting intere...

2013-02-19 17:13:00 102

转载 Read Code

We programmers are weird creatures. We love writing code. But when it comes to reading it we usually shy away. After all, writing code is so much more fun, and reading code is hard — sometimes al...

2013-01-16 23:56:00 171

转载 插入排序:直接插入排序与希尔排序

插入排序(Insertion Sort)的基本思想是:每次将一个待排序的记录,按其关键字大小插入到前面已经排好序的子文件中的适当位置,直到全部记录插入完成为止。 本节介绍两种插入排序方法:直接插入排序和希尔排序。 直接插入排序基本思想 1、基本思想 假设待排序的记录存放在数组R[1..n]中。初始时,R[1]自成1个有序区,无序区为R[2....

2013-01-16 23:26:00 82

转载 交换排序:冒泡排序与快速排序

冒泡排序:废话不多说,直接上代码,注意2中冒泡方法的不同。 package com.sqtds.algorithm.sort;/** * User: sqtds * Date: 13-1-15 * Time: 下午3:03 */public class Bubble { public static void sort(int[] array){ int i...

2013-01-16 23:08:00 76

转载 java谜题2(细节太多,知道即可)

8,三元运算符 public class DosEquis{ public static void main(String[] args){ char x = 'X'; int i = 0; System.out.println(true ? x : 0); System.out.println(false ? i : x); }...

2013-01-14 23:30:00 108

转载 java谜题(1)

谜题1,奇数性 public static boolean isOdd(int i ){ return i%2==1;}.csharpcode, .csharpcode pre{ font-size: small; color: black; font-family: consolas, "Courier New", courier, monosp...

2013-01-10 23:49:00 64

转载 如何写良好的提交消息

Writing good commit messages Good commit messages serve at least three important purposes: 好的提交消息至少服务于3个重要的目的: To speed up the reviewing process. 加速代码审查的进程。 To help us write a go...

2013-01-07 22:19:00 122

转载 Javascript 面向对象编程

http://coolshell.cn/articles/6441.html/comment-page-1#comments陈皓Javascript是一个类C的语言,他的面向对象的东西相对于C++/Java比较奇怪,但是其的确相当的强大,在Todd 同学的“对象的消息模型”一文中我们已经可以看到一些端倪了。这两天有个前同事总在问我Javascript面向对象的东西,所以,索性...

2013-01-07 15:14:00 81

转载 js原型、继承

前几天看了《再谈js面向对象编程》,当时就请教哈大神,发现文章有的地方可能会造成误导(或者说和ECMA有出入),后来自己翻一翻ECMA,总算找到“标准”的理解……本文适合初学者,特别是对构造函数、原型和原型链概念比较模糊的,大牛请路过,好了,让我们一步步来看看js的原型(链)到底有多神秘……一、函数创建过程在了解原型链之前我们先来看看一个函数在创建过程中做了哪些事情,举一个空函数...

2013-01-06 23:28:00 65

转载 精通javascript笔记(1)

javascript是面向对象的,javascript中的一切都是对象。 变量的类型检测:变量的构造函数最合适。 作用域: 在js里,作用域是由函数划分的,而不是代码块(block)划分的(比如while,if和for语句中间。) 所有属于全局作用域的变量都是window对象的属性(property)。 例如//一个全局作用域下的变量,存储了字符'test'var test = ...

2013-01-05 23:28:00 69

转载 java方法递归调用的陷阱

上个星期修改了短信网关的重启程序,结果这周又遇到了新问题。虽然有时可以重启成功,但是有时候还是重启失败。本地模拟测试怎么都没发现这个问题,趁着闲时的功夫,自己到正式环境将日志分析了一下,发现重启不成功的原因主要在心跳3次后没有收到响应消息,程序不会自动重启,而是不断的继续发送心跳。 看了看代码,没有发现哪里有错啊。想了想,难道是由于方法递归调用的原因?于是自己弄...

2012-12-20 11:53:00 122

转载 学不进去?可以试着这么做……

尽管科学家一个接一个的科研成果让我们对记忆有了越来越多的了解,但直到今天,科学家所发现的所谓大脑的秘密也只是冰山一角,在很大程度上,大脑和记忆仍是神秘的。研究人员认为,记忆是一个过程,并且当你记忆的时候,实际上就是你把保存在大脑中零零碎碎的信息进行重建。但让人不解的是,究竟是什么东西引发大脑开始这个重建过程?这个谜团继续等待科学家们去寻找答案,但有20个事实是已经科学家证实了的。...

2012-12-11 11:19:00 76

转载 A Generic JDBC Abstraction Framework(6)--Modeling RDBMS Operations as Java Objects

A Higher Level of Abstraction: Modeling RDBMS Operations as Java Objects 更高级的抽象:建模rdbms操作为java对象 Using the JdbcTemplate class solves most of the problems we saw with use of raw JDBC, but it's s...

2012-12-10 22:37:00 106

转载 python遍历文件夹读取文件大小

闲来无事,写了个小程序删除内存卡中大于50m的文件 # filename itertaorfilefolder import os import os.path filePath = raw_input('Enter filepath : ') #遍历文件夹 #三个参数:分别返回1.父目录 2.所有文件夹名字(不含路径) 3.所有文件名字 for parent...

2012-12-10 15:59:00 622

转载 A Generic JDBC Abstraction Framework(5)--Using the JdbcTemplate Class

Using the JdbcTemplate Class 用jdbctemplate类 Now that we've looked at the implementation, let's see the com.interface21.jdbc.core package in action. 闲杂我们已经探讨了实现,让我们在应用中理解com.interface21.jdbc.c...

2012-12-09 21:57:00 69

转载 A Generic JDBC Abstraction Framework(4)--Two Levels of Abstraction

Two Levels of Abstraction 抽象的2个级别 Now that we have a powerful, database-agnostic approach to exception handling, let's look at implementing an abstraction framework that will make JDBC much eas...

2012-12-08 23:40:00 321

转载 A Generic JDBC Abstraction Framework(3)--Converting JDBC Exceptions to Generic Exceptions

Converting JDBC Exceptions to Generic Exceptions 转换jdbc异常到通用异常 In the class diagram above, all the classes above the horizontal line are generic. These are the exceptions that calling code will...

2012-12-08 22:26:00 111

转载 A Generic JDBC Abstraction Framework(2)

Exception Handling 异常处理 Exception handling is such an important issue that we should develop a consistent strategy for it before we begin to implement our framework proper. 异常处理是如此的重要,在我们开始实现我...

2012-12-06 23:41:00 91

转载 A Generic JDBC Abstraction Framework

一个通用jdbc抽象框架 It's not enough to understand the JDBC API and the issues in using it correctly. Using JDBC directly is simply too much effort, and too error-prone. We need not just understanding, ...

2012-12-03 23:10:00 67

转载 python学习 ---简明 Python 教程

为什么要用python,开发效率高,可移植. 语法: 字符串: 1,使用单引号(')==使用双引号(")==java双引号(") 2,使用三引号('''或""") ,可以合并多行 3,转义,与java的‘\’类似。注意(在一个字符串中,行末的单独一个反斜杠表示字符串在下一行继续,而不是开始一个新的行。) 4,自然字符串通过给字符串加上前缀r或R来指定。 ...

2012-12-02 22:42:00 74

转载 Continuous Learning---97 Things Every Programmer Should Know

We live in interesting times. As development gets distributed across the globe, you learn there are lots of people capable of doing your job. You need to keep learning to stay marketable. Otherwi...

2012-11-30 22:44:00 104

转载 On ROWNUM and Limiting Results(转载)

By Tom Kytehttp://www.oracle.com/technetwork/issue-archive/2006/06-sep/o56asktom-086197.htmlOur technologist explains how ROWNUM works and how to make it work for you.This issue's Ask Tom c...

2012-11-28 15:45:00 159

转载 一次oracle分页所遇到的问题

昨天做完项目后让测试测试了一把,测试说分页查询貌似不起作用,翻到第4页以后,看到的数据结果都是相同的。当时我就觉得很纳闷,不可能啊,分页组件应该是好的,咋可能有问题呢。带着疑问,我打开了自己的ide,在自己的机器上跑了一把,果然有问题。有问题就要找问题:首先把2条查询结果相同的sql打印出来到数据库中执行:sql1: select * from (select ...

2012-11-28 13:52:00 66

转载 Exception Handling – Checked or Unchecked Exceptions

Using checked exceptions exclusively leads to several problems: 使用checked异常会导致一些问题: Too much code 太多的代码Developers will become frustrated by having to catch checked exceptions that they can't r...

2012-11-27 23:14:00 119

转载 tomcat6 配置 datasource

Tomcat6的服务器配置文件放在 ${tomcat6}/conf 目录底下。我们可以在这里找到 server.xml 和 context.xml。当然,还有其他一些资源文件。但是在在本文中我们只用得上这两个,其他的就不介绍了。如果仅限某个web项目范围内可用,可在web项目的META-INF下添加context.xml。例如webapps\call\META-INF下添加1....

2012-11-27 14:53:00 107

转载 Consider Consolidating Method Parameters

Consider Consolidating Method Parameters 完善方法的参数 Sometimes it's a good idea to encapsulate multiple parameters to a method into a single object. This may enhance readability and simplify callin...

2012-11-26 22:44:00 68

转载 The Observer Design Pattern

观察者模式 Like the use of interfaces, the Observer design pattern can be used to decouple components and enable extensibility without modification (observing the Open Closed Principle). It also cont...

2012-11-25 22:30:00 104

转载 Using Callbacks to Achieve Extensibility

Using Callbacks to Achieve Extensibility 利用回调完成可扩展性 Let's now consider another use of "inversion of control" to parameterize a single operation, while moving control and error handling into a fra...

2012-11-24 23:23:00 72

转载 OO Design Recommendations for J2EE Applications(2)

The Template Method Design Pattern 模板方法 One good use of concrete inheritance is to implement the Template Method design pattern. 类继承的一个好的用法是实现模板方法设计模式 The Template Method design pattern (GoF)...

2012-11-24 12:10:00 90

转载 OO Design Recommendations for J2EE Applications

OO Design Recommendations for J2EE Applications j2ee应用推荐的oo设计 It's possible to design a J2EE application so badly that, even if it contains beautifully written Java code at an individual o...

2012-11-22 23:19:00 149

转载 Chapter 3: Testing J2EE Applications

Summary 总结 Important 重要 Testing should occur throughout the software lifecycle. Testing should be a core activity of software development. 测试必须发生在软件开发的整个生命周期。测试必须是软件开发的一个核心任务。 Test cases s...

2012-11-21 22:13:00 71

转载 this is my first cnblog’s blog

only for test ,thanks !! Test windows live writer. ok ….转载于:https://www.cnblogs.com/sqtds/archive/2012/11/20/2779983.html

2012-11-20 23:31:00 74

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除