Archive

Archive for November, 2011

实习也没如别人口中的容易找

November 19th, 2011 2 comments

面试了两个,到现在都没有回复。ms的过了两周多了,gg的过了一周多。在考虑要不要发邮件问一下。除了这两家,目前没有其他面试。到现在为止,我投的公司也不多。接下来应该采用海投策略,广撒网。找个top 100 software companies in usa的列表,打算按这上面来投简历。之前为了准备那两个面试,花了不少时间看数据结构和算法,还有解题,写代码。面完之后,这些基本上就暂停了,开始忙其他的事。paper还要继续修改,选的课还剩一个final project和report,外加一个presentation。要做的事还是很多的,但俺还是不擅于协调时间,经常做这个丢那个,有待提高。下周就感恩节假期了,没有出去玩的计划,有两件主要的事要做,一是改论文,二是写cis751的final project。有空余时间就继续翻apue,看看cracking coding interview,准备一下final report和presentation。

加油。

Categories: 博士五年 Tags: , , ,

APUE2e Exercise 8.7: close-on-exec flag

November 11th, 2011 No comments
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * exercise8-7.c
 *
 *  Created on: Nov 11, 2011
 *      Author: zhuhuang
 */
 
 
#include <stdio.h>
#include <unistd.h>
#include <dirent.h>
#include <fcntl.h>
 
int main(void)
{
	DIR *dir;
	int filedes1, filedes2;
	int fdflag1, fdflag2;
	struct dirent *direntry;
 
	filedes1 = open("/", O_RDONLY);
 
	//file descriptor flag before calling opendir. it is off.
	fdflag1 = fcntl(filedes1, F_GETFD);
	if(fdflag1 & FD_CLOEXEC)
		printf("filedes1: close-on-exec flag is onn");
	else
		printf("filedes1: close-on-exec flag is offn");
 
	//See Page 234 on APUE2e, opendir function will set the close-on-exec flag for the descriptor filedes
	dir = fdopendir(filedes1);
	while((direntry = readdir(dir)) != NULL)
	{
		printf("%sn", direntry->d_name);
	}
 
	//file descriptor flag after calling opendir. it is on now.
	fdflag1 = fcntl(filedes1, F_GETFD);
	if(fdflag1 & FD_CLOEXEC)
		printf("filedes1: close-on-exec flag is onn");
	else
		printf("filedes1: close-on-exec flag is offn");
 
	//set close-on-exec flag operation on filedes1 won't affect filedes2
	filedes2 = open("/", O_RDONLY);
	fdflag2 = fcntl(filedes2, F_GETFD);
	if(fdflag2 & FD_CLOEXEC)
		printf("filedes2: close-on-exec flag is onn");
	else
		printf("filedes2: close-on-exec flag is offn");
}

APUE2e Exercise 8.2: vfork v.s. fork

November 10th, 2011 No comments
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
 * exercise8-2.c
 *
 *  Created on: Nov 10, 2011
 *      Author: zhuhuang
 */
 
#include <apueerr.h>
 
int glob = 6;
 
int callvfork(void)
{
	int var=88;
	pid_t pid;
 
	//compare the running results using vfork and fork
 
	/* Using fork
	in main first:4656
	before callvfork
	in callvfork parent:4656
	glob: 6, var: 88
	in main second:4656
	after callvfork
	before anothercall
	in anothercall:4656
	after anothercall
	in callvfork child:4661
	in main second:4661
	after callvfork
	before anothercall
	in anothercall:4661
	after anothercall
	*/
 
	/* Using vfork
	in main first:4608
	before callvfork
	in callvfork child:4613
	in main second:4613
	after callvfork
	before anothercall
	in anothercall:4613
	after anothercall
	in callvfork parent:4608
	glob: 7, var: 2077184
	*/
 
	if((pid = fork()) < 0){
		err_sys("vfork error");
	}else if(pid == 0){
		//the increasing of the variables done by the child changes the values in the parent
		glob++;
		printf("in callvfork child:%dn", getpid());
		return 0;
	}
 
	printf("in callvfork parent:%dn", getpid());
	printf("glob: %d, var: %dn", glob, var);  //var is
}
 
int anothercall(void)
{
	int i;
	int buf[100];
 
	for(i=0;i<100;i++)
		buf[i]=1;
 
	printf("in anothercall:%dn", getpid());
}
 
int main(void)
{
	printf("in main first:%dn", getpid());
 
	printf("before callvforkn");
	callvfork();
 
	//Using vfork: child process continues to execute the following code. But parent process doesn't.
	//Using fork: both child and parent processes execute the following code.
	printf("in main second:%dn", getpid());
 
	printf("after callvforkn");
	printf("before anothercalln");
	anothercall();
	printf("after anothercalln");
 
	exit(0);
}
Categories: 书山有路 Tags: , ,

近况:论文和实习

November 6th, 2011 3 comments

之前一个多月主要做了两件事,写论文和找实习。论文写了两版,但老板还不满意,原计划投的会议都pass了。因为我正忙于准备实习面试,和老板说了一下,先把paper放放,专心准备面试,机会难得,过了这村就没这店了。上周三面了ms,30分钟的电面,没有问technical的问题,都是behavior questions。感觉还行吧,但有没有下轮很难说,看造化了。下周三面gg,technical interview,back-to-back,两人面,每个45分钟。这个应该会很tough,bless我自己。等面完gg,会继续改论文,同时多投一些简历。

Categories: 博士五年 Tags: , ,

美帝修车真的很贵

November 6th, 2011 No comments

之前一直听人说来着,但没亲身体验过。周四晚上的时候车子的档位指示表盘失灵了,本来只是某个档位被高亮,结果变成所有档位都高亮了。第二天,周五,发动车子之后,引擎灯亮了,反复发动了几次,都是如此。顿时慌了,决定开去local的dodge dealer那查一下。一路上一直希望着车子不要中途抛锚(过于担心了)。查过之后发现了一堆问题,好多地方都漏油。他们给我列了一张单子,包括有问题的部件和需要的费用:pcm module,valve cover gasket,spark plug tube seal,cable plug,spark plug,exhaust manifold,exhaust manifold gasket,oil paw gasket,oil sending unit。那个pcm module还在warranty之内,换不用钱,不然得自己掏八百多刀。剩下的零件费加人工费要九百多刀,人工费占了一半以上,五百刀左右。咨询了一些人,有些说要换,有些说不用。我也不懂车,但还是保险一点,该修就修吧。车的迈数过了6万了,很多零部件都磨损得差不多了,得换,之前的车主应该没有做过类似的大修。我懒得再跑到其他维修店查问题对比修理费了,已经让dealer给订了零件,下周就送去修。他们把我的车稍微弄了一下,我问他们是否能继续开,说是可以。不过开了一天多,周六晚引擎灯又亮了。决定下周先骑自行车去学校,把车先晾着,不想冒险。

Categories: 生活点滴 Tags: , ,