弘扬传统文化,你我皆有责任著作权声明:此英文版《八荣八耻》版权归 北京外文局 所有 Eight-honor and Eight-shame (八荣八耻) Honor to those who love the motherland, and shame on those who harm the motherland. 以热爱祖国为荣、以危害祖国为耻 Honor to those who serve the people, and shame on those who betray the people. 以服务人民为荣、以背离人民为耻 Honor to those who quest for science, and shame on those who refuse to be educated. 以崇尚科学为荣、以愚昧无知为耻 Honor to those who are hardworking, and shame on those who indulge in comfort and hate work. 以辛勤劳动为荣、以好逸恶劳为耻 Honor to those who help each other, and shame on those who seek gains at the expense of others.
今天遇到这样一道题目:求自然数n以内的质数经过观察以后,我觉得可以以下方式来求解:将已求解的质数放入结果数组,判断下一个数是否是质数,只要将它除以质数结果数组,如果都不能被整除,那么这个数也是一个质数,放入结果数组中。/* * PrimeNumber.java * * Created on 2006年8月12日, 下午6:05 * * This class is under Gnu GPL. */package primenumber;import java.io.IOException;/** * Get prime numbers. * * @author <a href="guangquanzhang@gmail.com">guangquanzhang</a> */public class PrimeNumber { /** Creates a new instance of PrimeNumber */ public PrimeNumber() { } /** * @param n natural number, 1-n
虽然有关IOC的话题最近几年炒的火热,但一直没有去看、去了解这方面的东西。前天听了别人的讲解,恍然大悟,这其实在实际工作中或多或少的使用过。理解起来不复杂,但是我们却没有将其提升至理论,可见,跟IT高水平国家的程序员相比,我们欠缺的不仅仅是技能,更多的是独立而深入的思考。 Think different ...
This article aims to introduce the notion of Inversion Of Control
(IoC) and how it can streamline application design. We will look at the
different types
of IoC frameworks. By showing how IoC can result in simpler, more
flexible code, you'll also be able to see why IoC has attracted so much
interest of late.
The Theory of IoC
The best way to describe what IoC is about, and what benefits it can provide,
is to look at a simple example. The following JDBCDataManger class is used to
manage our application's accessing of the database. This application is currently
using raw JDBC for persistence. To access the persistence store via JDBC, the JDBCDataManger will need a DataSource object. The standard appro
1。使用java.util.Properties类的load()方法 示例: InputStream in = lnew BufferedInputStream(new FileInputStream(name)); Properties p = new Properties(); p.load(in);
3。使用java.util.PropertyResourceBundle类的构造函数 示例: InputStream in = new BufferedInputStream(new FileInputStream(name)); ResourceBundle rb = new PropertyResourceBundle(in);
4。使用class变量的getResourceAsStream()方法 示例: InputStream in = JProperties.class.getResourceAsStream(name); Properties p = new Properties