Archive for the ‘Uncategorized’ Category.

光棍节安排

早上吃2根油条,撇开吃;坐两趟11路车,上班一趟,下班一趟;中午11点11分准时吃饭;吃饭用2双筷子,左手一双,右手一双;吃完饭1点11分睡11分钟;逛街带拐杖一付,一个肩膀顶一个.唱卡拉OK只唱:林志炫的《单身情歌》刘若英的《一辈子的孤单》;陈升的《把悲伤留给自己》迪克牛仔 的《我这个你不爱的人》梁静茹的《分手快乐》晚上邀4个光棍打麻将,只胡4条;晚上11点11分准时睡。

看看以下几句话发生了什么

1
2
3
4
5
String str = null;
System.out.println(str); //输出null
System.out.println(str.toString()); //输出Exception in thread "main" java.lang.NullPointerException
System.out.println(str == null); //输出true
System.out.println(null); //The method println(char[]) is ambiguous for the type PrintStream

第五行直接输出null肯定不对,但是为什么第二行可以,第三行就不行?

JAVA多线程之JVM的线程总数

理论上来说,JVM不限制线程的个数,但是这取决于JVM的内存资源,不能无限制创建线程,如果超出,则会抛出java.lang.OutOfMemoryError的异常!以我的本本为例子,内存4G,JVM的内存99M of 163M的时候就抛出了

new Thread:7246
Exception in thread “main” java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Unknown Source)
at com.asiainfo.corejava.ThreadDemo.main(ThreadDemo.java:8)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
public class ThreadT extends Thread {
	private String threadName;
	public String getThreadName() {
		return threadName;
	}
	public void setThreadName(String threadName) {
		this.threadName = threadName;
	}
	public ThreadT(String threadName) {
		this.threadName = threadName;
	}
	@Override
	public void run() {
		while(true){
			System.out.println(threadName);
			try {
				Thread.sleep(100000L);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
1
2
3
4
5
6
7
8
9
public class ThreadDemo {
	public static void main(String[] args) {
		int count= 0;
		while(true){
			ThreadT t = new ThreadT("new Thread:"+(++count));
			t.start();
		}
	}
}

发现一个电子书下载的好地方

发现一个电子书下载的好地方,可能广告多一点,但资源还是很不错的!
http://www.infoxa.com/asp/book/view_lb.asp?page=1&lb=&sublb=&px=rq&jjl=5851

可以在try…catch中返回

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public class Test2 {
	public String tst(){
		try{
			String str = null;
			System.out.println(str.length());
		}catch(NullPointerException e){
			System.out.println("null!!!");
			return "str is null";
		}
		return "heh";
	}
}
 
 
public class Test1 {
	public static void main(String[] args) {
		Test2 tst2 = new Test2();
		String ret = tst2.tst();
		System.out.println(ret);
	}
}

输出:

null!!!
str is null

WCG2009总决赛比赛场次

11月11日
18:30 魔兽争霸III Sky Vs Yaws

11月12日
12:30 魔兽争霸III Fly100% Vs Hasuhasi
13:00 魔兽争霸III Infi Vs LongWalk
13:30 星际争霸 Stork Vs Fengzi
14:00 星际争霸 Jaedong Vs Draco
14:30 反恐精英 Fnatic Vs wNv
15:30 FIFA足球 Cookie Vs Reulreusyu
16:00 魔兽争霸III Grubby Vs TeRRoR
16:30 魔兽争霸III Grubby Vs Who
17:00 星际争霸 Strok Vs BRAT_OK
17:30 星际争霸 ToodMing Vs Jaedong

11月13日
12:30 魔兽争霸III Moon Vs Stud
13:00 魔兽争霸III Sky Vs Majic
13:30 星际争霸 Bisu Vs Bruce
14:00 星际争霸 Pj Vs DIMAGA
14:30 反恐精英 K23 Vs Esq
15:30 FIFA足球 KrOne Vs Xaxotun
16:00 魔兽争霸III Lyn Vs Yaws
16:30 魔兽争霸III Moon Vs Maniac
17:00 星际争霸 White-Ra Vs IdrA
17:30 星际争霸 Bisu Vs Pj
如有变动,以现场播出为准。

谁控制了你的互联网

很久以前,有一句话流传甚广——“在互联网上,没人知道你是一条狗。” 到现在,你到底是“狗”还是“猫”,或许并不由你决定,而是一只无形的手在背后操控着。笔者并非危言耸听,这一切都是事实,只不过你从未察觉…… Continue reading ‘谁控制了你的互联网’ »

关于永久链接的几个观点

看到论坛上有人在讨论使用什么样的永久链接比较好(REF)
一种比较推崇的做法是使用/%postname%/这种形式,其次是/%category%/%postname%,还有人直接使用/%post_id%的形式。帖子里还讨论到,链接比较短的有利于SEO,像/%year%/%monthnum%/%day%/%postname%/这种链接几乎不被人推崇。 Continue reading ‘关于永久链接的几个观点’ »

自动更新就一定好吗?

客户端软件的更新一定要负责,不能把未经过充分测试的版本推送给用户!即使是经过充分测试,也不能保证完全没有问题。所以,一个软件的自动更新不能太频繁,否则就完全有把用户当小白鼠的嫌疑,是不值得使用的。相反的,一个软件很长时间不更新照样使用,说明这个软件很健壮,很稳定。

彻底告别邮件客户端 转向web mail

之后会写一些心得,主要是关于如何使用web mail的。