December 2nd, 2009
Chrome OS 为什么出现

谷歌用上图说明计算机使用和技术的发展趋势,一切皆基于网络。大多数用户而言90%的时间都消耗在浏览器上了,视频、Email、音乐、社交、电子书、Google… 这也就是Chrome OS诞生的原因。* Chrome OS是一个以开源(Chromium项目)代码为基础的(OpenSource)、轻型的(Lightweight)、针对网络应用(Web Centric)的新型操作系统。* 让我着迷的地方在于:使用简单,只需要关心浏览器;所有的用户数据都在互联网的“云上”。
Chrome OS 的架构

*Chrome 浏览器+ 视窗系统 + Linux内核 = Chrome OS*,这个和Android的*应用程序+Android中间件+Linux内核*的架构有些神似,Android属于传统,Chrome是革新。
Chrome OS 的启动过程

Chrome的目标是让人们更加方便的使用互联网应用,力求尽量缩短由上电-启动浏览器的过程。Chrome将这个过程缩短至7s(4s就能到登录界面了)。上图中的对比可以看出,Chrome和传统操作系统的启动过程的差异。启动过程简单的让人难以理解了。
Posted in Learn | 2 Comments »
November 29th, 2009

曾经写过一篇日志 Lost in Yellow. 今天这首歌让我觉得更加的温暖和坚定。
这首歌让我觉得为了挚爱的人,为了幸福的约定,付出生命也是值得。
/ The human race is filled with passion.
Poetry, beauty, romance, love, these are what we stay alive for. /
我相信这是一场考验,我们一起面对,我心坦然。
Posted in heart, ting | 2 Comments »
November 20th, 2009
写代码的朋友往往注重”简单”一词。也许简单的概念在这里等效于优化,等效于清晰干净的设计。简单的算法配合简单的数据结构,实现一项功能,已经是一件很不容易的事情了。如同写作训练的时候,让你用一段文字描述一个场景。要做到既精炼又生动,着实不容易。偶然间读到爱因斯坦的一句名言:
“Everything should be made as simple as possible, but not simpler.”
这“简单”的意义好像又有了更加深刻的含义:
Perfection is reached when there is nothing left to take away. If there is something there that can be removed without effecting the function, then it is an unnecessary complication and should be removed. If you take away too much then you lose information, utility, or clarity. Thus everything has a minimal form.
Posted in Learn | No Comments »
November 12th, 2009
Posted in heart | 4 Comments »
September 17th, 2009
指针是能够存放一个地址的一组存储单元。既然是存储单元,指针当然也有地址和值这两个属性,所以和普通变量一样也存在副本的概念。
看一段代码:
#stdio.h stdlib.h string.h
void GetMemory(char *p, int num);
int main(void){
char *str = NULL;
GetMemory(str,100);
strcpy(str,”This is the message!\n”); //此处会产生 segmengtation fault
printf(str);
return 0;
}
void GetMemory(char *p, int num)
{
p = (char *)malloc(sizeof(char)*num);
}
程序的目的是利用GetMemory 给str动态分配内存,继而strcpy给str赋值。实际执行情况是,GetMemory 创造了str的副本p,并给p分配了内存(内存泄露)。str的数值依然为NULL,继而在调用用strcpy给str赋值时产生段错误。
正确的代码:
#stdio.h stdlib.h string.h
void GetMemory(char **p, int num)
int main(void){
char *str = NULL;
GetMemory(&str,100);
strcpy(str,”This is the message!\n”); /
printf(str);
return 0;
}
void GetMemory(char **p, int num)
{
*p = (char *)malloc(sizeof(char)*num);
}
GetMemory 创造了str地址的副本p,并利用*p修改了str的内容,达到了动态申请内存的目的。
补充例子:
#define ADD(p) {p++;(*p)++;}
Add(int *p) {p++;(*p)++;}
int a[]={0,1,2};
int main()
{
int *p=a;
ADD(p)
ADD(p)
printf(”%d,%d,%d\n”,a[0],a[1],a[2]);
//a[0]=0 a[1]=2 a[2]=3
p=a;
Add(p);
Add(p);
printf(”%d,%d,%d\n”,a[0],a[1],a[2]);
}
Posted in Learn | No Comments »