`
mabusyao
  • 浏览: 247714 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论
文章列表

Junit 的模式

Junit的Composite模式, 跟享元模式很接近: TestSuite 里面包含一个或多个Test,而TestSuite和TestCase均继承自Test接口,这样就可以使TestSuite中既可以包含TestCase,也可以包含TestSuite自身。
  < These  MySQL  Data  Types Can  always  be  converted  to  these  Java  types CHAR,  VARCHAR,  BLOB,  TEXT,  ENUM,  and  SET java.lang.String,  java.io.InputStream,  java.io.Reader,  java.sql.Blob,  java.sql.Clob FLOAT,  REAL,  DOUBLE  PRECISION,  NU ...
今天做数据库遇到个问题。 系统有一张ACCESS_FIELD_VALUES表,表示一个UI上面field要显示的values值。在此之前,我们在UI上都是根据FIELD_VALUE_ID进行排序,现在要加一列sequence,表示它的显示顺序。 想想可以以某种方式先排序,然后取行号来初始化FIELD_VALUE_SEQUENCE. 在网上找到个办法取行号: UPDATE ((SELECT ROW_NUMBER() OVER (ORDER BY DISPLAY_VALUE) AS NUMBER, FIELD_VALUE_SEQUENCE FROM APPLWEB.ACCESS_REQUEST ...
去网上查了下,发现泛型Dao的设计比较热门,比较起来也相对通用。 只是因为还没有用上hibernate,所以做了些修改,不提供BaseDao的默认实现(如果是hibnerate下,很多实现可以在一个抽象类里面实现)。 2009-09-09 更新 : 修改了几个方法的返回类型, 添加了一个查询方法。开始感到这个框架的问题, 用了好几个Object 类型的参数了。思考下后面应该怎么改。 package shopping.ibm.dao; import java.sql.Connection; import java.util.ArrayList; import java.util.Li ...
感谢网络提供资源的朋友,自己做了个版本,正在测试,看看是否有问题。 2009-09-08 更新成单例模式 /* * $DatabaseInfo.java 2009-01-20 By Bill Yao $ */ package shopping.servlet.db; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; /** * DatabaseInfo class provided the basic information for DB connection. ...

汉诺塔的变种

1. 有三根柱子,在一根柱子上从下往上按大小顺序摞着n片圆盘。要求把圆盘从下面开始按大小顺序重新摆放在另一根柱子上。并且规定,在小圆盘上不能放大圆盘,在三根柱子之间一次只能移动一个圆盘。 package hanoi; /** * formulas: * T0 = 0 * Tn = Tn-1 + 1 * * closed form: * Tn = 2(n) -1 * * @author yaoh * */ public class SimpleHanoi { public static int count = 0; ...

TheaterVisit

/*Problem StatementYou want to buy two neighboring tickets in the first row of the theater so that one of the tickets is as far from the aisles as possible.You will be given a String describing the first row of the theater where '.' represents an empty seat and 'X' represents an occupied seat. Your t ...

SkipStones

/*Problem StatementWhen a stone is thrown across water, sometimes it will land on the water and bounce rather than falling in right away. Suppose that a stone is thrown a distance of n. On each successive bounce it will travel half the distance as the previous bounce (rounded down to the nearest inte ...

BlockStructure

/*Problem StatementA group of vertical blocks are placed densely one after another on the ground. The blocks each have a width of 1, but their heights may vary. For example, if the heights of the vertical blocks are given as {1,5,5,1,6,1}, the configuration would look like the following picture:    × ...

HardDuplicateRemover

/*Problem StatementWe have a sequence of integers, and we would like to remove all duplicate elements from this sequence. There may be multiple ways to perform this task. For example, given the sequence { 1, 2, 1, 3 }, we could end up with either { 1, 2, 3 } or { 2, 1, 3 } as the remaining sequence, ...

RecurringNumbers

/*Problem StatementA rational number is defined as a/b, where a and b are integers, and b is greater than 0. Furthermore, a rational number can be written as a decimal that has a group of digits that repeat indefinitely. A common method of writing groups of repeating digits is to place them inside pa ...

FactorialSystem

/*Problem StatementIn the factorial number system the value of the first digit (from the right) is 1!, the value of the second digit is 2!, ..., and the value of the n-th digit is n!. This means that any decimal number d can be written in this system as: anan-1...a2a1, whered = an * n! + an-1 * (n-1) ...

SalesRouting

package salesRouting;/*Problem Statement You want to send a group of salespeople from location 0 to location 1, but no two of them can travel through the same location (other than 0 and 1). This removes the possibility of trying to sell a customer the same product twice. Character j of element i (b ...

CraneWork

/*Problem Statement There are three stacks of crates - two of them outside of the warehouse, and one inside the warehouse. We have a crane that can move one crate at a time, and we would like to move all of the crates to the stack inside the warehouse. A heavier crate can never be stacked on top ...

palindrome

package palindrome;/*Problem StatementA palindrome is a string that reads the same forward and backward. A palindrome substring is a contiguous sequence of characters taken from a string that form a palindrome. A palindrome substring of a string is maximal if we can't extend it to get a bigger palind ...
Global site tag (gtag.js) - Google Analytics