文章列表
在现代的操作系统中,有一个很重要的概念――线程,几乎所有目前流行的操作系统都支持线程,线程来源于操作系统中进程的概念,进程有自己的虚拟地址空间以及正文段、数据段及堆栈,而且各自占有不同的系统资源(例如文件、环境变量等等)。与此不同,线程不能单独存在,它依附于进程,只能由进程派生。如果一个进程派生出了两个线程,那这两个线程共享此进程的全局变量和代码段,但每个线程各拥有各自的堆栈,因此它们拥有各自的局部变量,线程在UNIX系统中还被进一步分为用户级线程(由进程自已来管理)和系统级线程(由操作系统的调度程序来管理)。
既然有了进程,为什么还要提出线程的概念呢?因为与创建一个新的进程相比,创建一个线程 ...
- 2009-03-19 15:53
- 浏览 811
- 评论(0)
Hibernate工作原理及为什么要用?
原理:
1. 读取并解析配置文件
2. 读取并解析映射信息,创建SessionFactory
3. 打开Sesssion
4. 创建事务Transation
5. 持久化操作
6. 提交事务
7. 关闭Session
8. 关闭SesstionFactory
为什么要用:
1. 对JDBC访问数据库的代码做了封装,大大简化了数据访问层繁琐的重复性代码。
2. Hibernate是一 ...
- 2009-03-11 21:58
- 浏览 958
- 评论(0)
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Resources;
using System.Threading;
using System.Globalization;
using System.Windows.Forms;
namespace TestLanguage
{
public class SelectLanguage
{
public SelectLangu ...
- 2009-03-09 14:48
- 浏览 987
- 评论(0)
KEY:计算机\HKEY_LOCAL_MACHINE_SOFTWARE\ORACLE_KEY_ORACLINET10G_HOME1\NLS_LANG
值:AMERICAN_AMERICA.WE8ISO8859P1
- 2009-02-27 15:49
- 浏览 886
- 评论(0)
package perpor.jisuan;
public class Combine2 {
public static void main(String[] args) {
int[] a = new int[] { 6, 57, 2, 8, 38, 241, 85, 7, 8, 48, 10, 82, 3 };
int[] b = new int[5];
printArray(insertAndSort(a, b));
}
private static int[] insertAndSort(int[] a, int[] b) {
...
- 2009-02-24 17:21
- 浏览 727
- 评论(0)
package perpor.jisuan;
public class PermuteClass {
/**
* @param args
*/
public static void main(String[] args) {
int[] array1 = new int[] { 1, 3, 6, 8 };
int[] array2 = new int[] { 2, 4, 5, 7 };
printArray(combine(array1,array2));
}
public static int[] combine(int[] ar ...
- 2009-02-24 15:43
- 浏览 1071
- 评论(0)
private static int foo(int i){
if(i<=0){
return 0;
} else if(i==1 || i==2){
return 1;
} else {
return foo(i-1)+foo(i-2);
}
}
- 2009-02-24 11:04
- 浏览 618
- 评论(0)
package cat;
public class MainTest {
/**
* @param args
*/
public static void main(String[] args) {
Cat cat=new Cat();
Mouse ms1=new Mouse("m1",cat);
Mouse ms2=new Mouse("m2",cat);
Master master=new Master("master",cat);
cat.aimAt();
...
- 2009-02-24 11:03
- 浏览 596
- 评论(0)
/**
* 截取字符
*
* @param str
* @param bytes
* @return
*/
public static String SplitString(String str, int bytes) {
//统计字节数
int count = 0;
//返回字符串
StringBuffer reStr = new StringBuffer();
if (str == null) {
return "";
...
- 2009-02-24 10:57
- 浏览 526
- 评论(0)
public static void QuickSort2(int[] data, int left, int right) {
if (left < right) {
int p = part(data, left, right);
QuickSort2(data, left, p - 1);
QuickSort2(data, p + 1, right);
}
}
private static int part(int[] data, int left, int right) {
int middle = data[ri ...
- 2009-02-23 15:42
- 浏览 406
- 评论(0)