Google+ insable: 2010

2010-12-30

解决一种MSN运行缓慢的情况

最近加装虚拟机软件,带来了副作用,MSN慢到无法接受 ,
比如随便打开一个聊天窗口,大概要两、三分钟,
按下表情符号接近于就直接当掉,要过相当长的时间才会恢复响应,
或者是打字会奇慢无比,过几秒才会出现
点下去居然也要一段时间窗口才会出现…


解决办法就是
把局域网络IP设为自动取得
原因就是MSN在启动对话Session的时候
会先判别是不是内网的使用者
(不需要经过因特网,直接透过局域网传播信息)
但若设了一个假的局域网络IP(虚拟机软件的原因,ip需要做相应的调整)
封包送出去便卡在那边等待回传信息,
但因为是假的IP,所以不会有回传信息出现,直到Timeout以后他才会改用因特网的方式通讯..
所以使用者其实是在一直等待Timeout,速度必然会很慢。

2010-10-25

I will persist. I will win

In the Orient young bulls are tested for the fight arena in a certain manner. Each is brought to the ring and allowed to attack a picador who pricks them with a lance. The bravery of each bull is then rated with care according to the number of times he demonstrates his willingness to charge in spite of the sting of the blade. Henceforth will I recognize that each day I am tested by life in like manner. If I persist, if I continue to try, if I continue to charge forward, I will succeed.
在古老的东方,挑选小公牛列竞技场格斗有一定的程序、它们被带进场地,向手持长矛的斗牛士攻击,裁判以它受激后再向斗牛士进攻的次数多寡来评定这只公牛的勇敢程度。从今往后。我须承认,我的生命每天都在接受类似的考验。如果我坚韧不拔,勇往直前,迎接挑战。那么我一定会成功。
I will persist until I succeed.
坚持不懈。直到成功。

I was not delivered unto this world in defeat, nor does failure course in my veins. I am not a sheep waiting to be prodded by my shepherd. I am a lion and I refuse to talk, to walk, to sleep with the sheep. I will hear not those who weep and complain, for their disease is contagious. Let them join the sheep. The slaughterhouse of failure is not my destiny.
我不是为了失败才来到这个世界上的,我的血管里也没有失败的血液在流动。我不是任人鞭打的羔羊,我是猛狮,不与羊群为伍。我不想听失意者的哭泣,抱怨者的牢骚,这是羊群中的瘟疫,我不能被它传染。失败者的屠宰场不是我命运的归宿。
I will persist until I succeed.
坚持不懈,直到成功。

The prizes of life are at the end of each journey, not near the beginning; and it is not given to me to know how many steps are necessary in order to reach my goal. Failure I may still encounter at the thousandth step, yet success hides behind the next bend in the road. Never will I know how close it lies unless I turn the corner.
生命的奖赏远在旅途终点,而非起点附近。我不知道要走多少步才能达到目标。踏上第一千步的时候,仍然可能遭到失败。但成功就藏在拐角后面,除非拐了弯,我永远不知道还有多远。
Always will I take another step. If that is of no avail I will take another, and yet another. In truth, one step at a time is not too difficult.
再前进一步,如果没有用,就再向前一步。事实上,每次进步一点点并不太难。
I will persist until I succeed.
坚持不懈,直到成功。

Henceforth, I will consider each day's effort as but one blow of my blade against a mighty oak. The first blow may cause not a tremor in the wood, nor the second, nor the third. Each blow, of itself, may be trifling, and seem of no consequence. Yet from childish swipes the oak will eventually tumble. So it will be with my efforts of today.
从今往后,我承认每天的奋斗就像对参天大树的一次砍击,头几刀可能了无痕迹。每一击者似微不足道,然而,累积起来,巨树终会倒下。这恰如我今天的努力。
I will be liken to the raindrop which washes away the mountain; the ant who devours a tiger; the star which brightens the earth; the slave who builds a pyramid. I will build my castle one brick at a time for I know that small attempts, repeated, will complete any undertaking.
就像冲洗高山的雨滴,吞噬猛虎的蚂蚁,照亮大地的星辰,建起金字塔的奴隶,我也要一砖一瓦地建造起自己的城堡,因为我深知水滴石穿的道理,只要持之以恒,什么都可以做到。
I will persist until I succeed.
坚持不懈,直到成功。

I will never consider defeat and I will remove from my vocabulary such words and phrases as quit, cannot, unable, impossible, out of the question, improbable, failure, unworkable, hopeless, and retreat; for they are the words of fools. I will avoid despair but if this disease of the mind should infect me then I will work on in despair. I will toil and I will endure. I will ignore the obstacles at my feet and keep mine eyes on the goals above my head, for I know that where dry desert ends, green grass grows.
我绝不考虑失败,我的字典里不再有放弃,不可能、办不到、没法子、成问题、失败,行不通、没希望、退缩…这类愚蠢的字眼。我要尽量避免绝望,一旦受到它的威胁,立即想方设法向它挑战。我要辛勤耕耘,忍受苦楚。我放眼未来,勇往直前,不再理会脚下的障碍。我坚信,沙漠尽头必是绿洲。
I will persist until I succeed.
坚持不懈,直到成功。

I will remember the ancient law of averages and I will bend it to my good. I will persist with knowledge that each failure to sell will increase my chance for success at the next attempt. Each nay I hear will bring me closer to the sound of yea. Each frown I meet only prepares me for the smile to come. Each misfortune I encounter will carry in it the seed of tomorrow's good luck. I must have the night to appreciate the day. I must fail often to succeed only once.
我要牢牢记住古老的平衡法则,鼓励自己坚持下去,因为每一次的失败都会增加下一次成功的机会。这一次的拒绝就是下一次的赞同,这一次皱起的眉头就是下一次舒展的笑容。今天的不幸,往往预示着明天的好运。夜幕降临。回想一天的遭遇。我总是心存感激。我深知,只有失败多次,才能成功。
I will persist until I succeed.
坚持不懈,直到成功。

I will try, and try, and try again. Each obstacle I will consider as a mere detour to my goal and a challenge to my profession. I will persist and develop my skills as the mariner develops his, by learning to ride out the wrath of each storm.
我要尝试,尝试,再尝试。障碍是我成功路上的弯路,我迎接这项挑战。我要像水手一样,乘风破浪。
I will persist until I succeed.
坚持不懈,直到成功。

Henceforth, I will learn and apply another secret of those who excel in my work. When each day is ended, not regarding whether it has been a success or a failure, I will attempt to achieve one more sale. When my thoughts beckon my tired body homeward I will resist the temptation to depart. I will try again. I will make one more attempt to close with victory, and if that fails I will make another. Never will I allow any day to end with a failure. Thus will I plant the seed of tomorrow's success and gain an insurmountable advantage over those who cease their labor at a prescribed time. When others cease their struggle, the mine will begin, and my harvest will be full.
从今往后,我要借鉴别人成功的秘诀。过去的是非成败,我全不计较,只抱定信念,明天会更好。当我精疲力歇时,我要抵制回家的诱惑,再试一次。我一试再试。争取每一天的成功,避免以失败收场。我要为明天的成功播种,超过那些按部就班的人。在别人停滞不前时,我继续拼搏,终有一天我会丰收。“
I will persist until I succeed.
坚持不懈,直到成功。

Nor will I allow yesterday's success to lull me into today's complacency, for this is the great foundation of failure. I will forget the happenings of the day that is gone, whether they were good or bad, and greet the new sun with confidence that this will be the best day of my life.
我不因昨日的成功而满足,因为这是失败的先兆。我要忘却昨日的一切,是好是坏,都让它随风而去。我信心百倍,迎接新的太阳,相信“今天是此生最好的一天”。
So long as there is breath in me, that long will I persist. For now I know one of the greatest principles of success; if I persist long enough I will win.
只要我一息尚存,就要坚持到底,因为我已深知成功的秘诀。
I will persist. I will win.
坚持不懈,终会成功。

2010-10-16

Double Ninth Festival 九九重阳节

The 9th day of the 9th lunar month is the traditional Chongyang Festival, or Double Ninth Festival. It usually falls in October in the Gregorian calendar. In an ancient and mysterious book Yi Jing, or The Book of Changes, number "6" was thought to be of Yin character, meaning feminine or negative, while number "9" was thought to be Yang, meaning masculine or positive. So the number nine in both month and day create the Double Ninth Festival, or Chongyang Festival. Chong in Chinese means "double." Also, as double ninth was pronounced the same as the word to signify "forever", both are "Jiu Jiu," the Chinese ancestors considered it an auspicious day worth celebration. That's why ancient Chinese began to celebrate this festival long time ago.
农历九月九日,为传统的重阳节。因为古老的《易经》中把“六”定为阴数,把“九”定为阳数,九月九日,日月并阳,两九相重,故而叫重阳,也叫重九,古人认为是个值得庆贺的吉利日子,并且从很早就开始过此节日。

The custom of ascending a height to avoid epidemics was passed down from long time ago. Therefore, the Double Ninth Festival is also called "Height Ascending Festival". The height people will reach is usually a mountain or a tower. Ancient literary figures have left many poems depicting the activity. Even today, people still swarm to famous or little known mountains on this day.
在古代,民间在重阳有登高的风俗,故重阳节又叫“登高节”。相传此风俗始于东汉。唐代文人所写的登高诗很多,大多是写重阳节的习俗;杜甫的七律《登高》,就是写重阳登高的名篇。登高所到之处,没有划一的规定,一般是登高山、登高塔。

On this day, people will eat Double Ninth Gao (or Cake). In Chinese, gao (cake) has the same pronunciation with gao (height). People do so just to hope progress in everything they are engaged in. There is no fixed ways for the Double Ninth Cake, but super cakes will have as many as nine layers, looking like a tower.
在这一天,人们还有吃“重阳糕”的习俗。在汉语里,“糕”与“高”同音,”,人们会用“吃糕”代替“登高”,祝愿百事俱高。重阳糕又称花糕、菊糕、五色糕,制无定法,较为随意。最高的有九层,像一个塔。

The Double Ninth Festival is also a time when chrysanthemum blooms. China boasts diversified species of chrysanthemum and people have loved them since ancient times. So enjoying the flourishing chrysanthemum also becomes a key activity on this festival. Also, people will drink chrysanthemum wine. Women used to stick such a flower into their hair or hang its branches on windows or doors to avoid evilness.
重阳节正是一年的金秋时节,菊花盛开,民间还把农历九月称为“菊月”,在菊花傲霜怒放的重阳节里,观赏菊花成了节日的一项重要内容,当然,人们也会喝一些菊花酒。女人会把茱萸插在头上或挂在门口,可以避难消灾。


九月九日忆山东兄弟
王维


独在异乡为异客,每逢佳节倍思亲。
遥知兄弟登高处,遍插茱萸少一人。

Double Ninth, Missing My Shandong Brothers
Wang Wei


As a lonely stranger in the strange land,
Every holiday the homesickness amplifies.
Knowing that my brothers have reached the peak,
All but one is present at the planting of flowers

登高
杜甫


风急天高猿啸哀,渚清沙白鸟飞回。
无边落木萧萧下,不尽长江滚滚来。
万里悲秋常作客,百年多病独登台。
艰难苦恨繁霜鬓,潦倒新停浊酒怀。

Ascend
Du fu

In a sharp gale from the wide sky apes are whimpering
Over the clear lake and white sand birds are flying homeward
Immensity of leaves rustling fell
The never-ending Yangtze river rolling on
I have come thousands of miles miles away, sad now with autumn
And with my hundred years of woe, I climb this height alone.
Ill fortune has laid a bitter frost on my temples,
Heart-ache and weariness are a thick dust in my wine.

醉花荫
李清照

薄雾浓云愁永昼,瑞脑销金兽。 佳节又重阳,玉枕纱橱,半夜凉初透。
东篱把酒黄昏后,有暗香盈袖。 莫道不销魂,帘卷西风,人比黄花瘦!

To the Tune of Intoxicated Under the Shadow of Flowers
Li Qingzhao


Light mists and heavy clouds,
melancholy the long dreary day.
In the golden censer
the burning incense is dying away.  
It is again time
for the lovely Double-Ninth Festival;
The coolness of midnight
penetrates my screen of sheer silk
and chills my pillow of jade.
    
After drinking wine at twilight
under the chrysanthemum hedge,
My sleeves are perfumed
by the fragrance of the plants.
Oh, I cannot say it is not endearing,
Only, when the west wind stir the curtain,
I see that I am more gracile
than the yellow flowers.

采桑子
毛泽东


人生易老天难老,岁岁重阳。今又重阳,战地黄花分外香。
一年一度秋风劲,不似春光。胜似春光,廖廓江天万里霜。

To the Tune of Tsai Sang Tzu
Mao Zedong


Man ages all too easily, not Nature:
Year by year the Double Ninth returns.
On this Double Ninth,
The yellow blooms on the battlefield smell sweeter.

Each year the autumn wind blows fierce,
Unlike spring's splendour,
Yet surpassing spring's splendour,
See the endless expanse of frosty sky and water.

2010-09-17

PHP中的mysql函数(常用)

1、mysql_connect()-建立数据库连接 
格式: 
resource mysql_connect([string hostname [:port] [:/path/to/socket] [, string username] [, string password]]) 
例: 
$conn = @mysql_connect("localhost", "username", "password") or die("不能连接到Mysql Server"); 
使用该连接必须显示的关闭连接 

2、mysql_pconnect()-建立数据库连接 格式: 
resource mysql_pconnect([string hostname [:port] [:/path/to/socket] [, string username] [, string password]]) 
例: 
$conn = @mysql_pconnect("localhost", "username", "password") or dir("不能连接到Mysql Server"); 
使用该连接函数不需要显示的关闭连接,它相当于使用了连接池 

3、mysql_close()-关闭数据库连接 
例: 
$conn = @mysql_connect("localhost", "username", "password") or die("不能连接到Mysql Server"); 
@mysql_select_db("MyDatabase") or die("不能选择这个数据库,或数据库不存在"); 
echo "已经连接到MyDatabase数据库"; 
mysql_close(); 

4、mysql_select_db()-选择数据库 
格式: 
boolean mysql_select_db(string db_name [, resource link_id]) 
例: 
$conn = @mysql_connect("localhost", "username", "password") or die("不能连接到Mysql Server"); 
@mysql_select_db("MyDatabase") or die("不能选择这个数据库,或数据库不存在"); 

5、mysql_query()-查询MySQL 
格式: 
resource mysql_query (string query, [resource link_id]) 
例: 
$linkId = @mysql_connect("localhost", "username", "password") or die("不能连接到Mysql Server"); 
@mysql_select_db("MyDatabase") or die("不能选择这个数据库,或者数据库不存在"); 
$query = "select * from MyTable"; 
$result = mysql_query($query); 
mysql_close(); 
若SQL查询执行成功,则返回资源标识符,失败时返回FALSE。若执行更新成功,则返回TRUE,否则返回FALSE 

6、mysql_db_query()-查询MySQL 格式: 
resource mysql_db_query(string database, string query [, resource link_id]) 
例: 
$linkId = @mysql_connect("localhost", "username", "password") or die("不能连接到MysqlServer"); 
$query = "select * from MyTable"; 
$result = mysql_db_query("MyDatabase", $query); 
mysql_close(); 
会引起代码混淆,不推荐使用这个函数调用 

7、mysql_result()-获取和显示数据 
格式: 
mixed mysql_result (resource result_set, int row [, mixed field]) 
例: 
$query = "select id, name from MyTable order by name"; 
$result = mysql_query($query); 
for($count=0;$count<=mysql_numrows($result);$count++) 
{ 
$c_id = mysql_result($result, 0, "id"); 
$c_name = mysql_result($result, 0, "name"); 
echo $c_id,$c_name; 
} 
最简单、也是效率最低的数据获取函数 

8、mysql_fetch_row()-获取和显示数据 
格式: 
array mysql_fetch_row (resource result_set) 
例: 
$query = "select id, name from MyTable order by name"; 
$result = mysql_query($query); 
while (list($id, $name) = mysql_fetch_row($result)) { 
echo("Name: $name ($id)
");
 
} 
函数从result_set中获取整个数据行,将值放在一个索引数组中。一般结合list()函数使用 

9、mysql_fetch_array()-获取和显示数据 格式: 
array mysql_fetch_array (resource result_set [, int result_type]) 
例: 
$query = "select id, name from MyTable order by name"; 
$result = mysql_query($query); 
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { 
$id = $row["id"]; 
$name = $row["name"]; 
echo "Name: $name ($id)
";
 
} 
又及: 
$query = "select id, name from MyTable order by name"; 
$result = mysql_query($query); 
while($row = mysql_fetch_array($result, MYSQL_NUM)) { 
$id = $row[0]; 
$name = $row[1]; 
echo "Name: $name ($id)
";
 
} 
result_type的值有: 
MYSQL_ASSOC: 字段名表示键,值为字段内容MYSQL_NUM: 数值索引数组,操作同函数mysql_fetch_ros()
MYSQL_BOTH: 作为数值索引数组又作为关联数组返回。result_type的默认值。 

10、mysql_fetch_assoc()-获取和显示数据 
格式: 
array mysql_fetch_assoc (resource result_set) 
相当于调用 mysql_fetch_array(resource, MYSQL_ASSOC); 

11、mysql_fetch_object()-获取和显示数据 格式: 
object mysql_fetch_object(resource result_set) 
例: 
$query = "select id, name from MyTable order by name"; 
while ($row = mysql_fetch_object($result)) { 
$id = $row->id; 
$name = $row->name; 
echo "Name: $name ($id)
";
 
} 
返回一个对象,在操作上与mysql_fetch_array()相同 

12、mysql_num_rows()-所选择的记录的个数 
格式: 
int mysql_num_rows(resource result_set) 
例: 
query = "select id, name from MyTable where id > 65"; 
$result = mysql_query($query); 
echo "有".mysql_num_rows($result)."条记录的ID大于65"; 
只在确定select查询所获取的记录数时会有用处。 

13、mysql_affected_rows()-受Insert,update,delete影响的记录的个数 
格式: 
int mysql_affected_rows([resource link_id]) 
例: 
$query = "update MyTable set name='CheneyFu' where id>=5"; 
$result = mysql_query($query); 
echo "ID大于等于5的名称被更新了的记录数:".mysql_affected_rows(); 
mysql_affected_rows()获取受INSERT,UPDATE或DELETE更新语句影响的行数。

14、mysql_list_dbs()-获取数据库列表信息 
格式: 
resource mysql_list_dbs([resource link_id]) 
例: 
mysql_connect("localhost", "username", "password"); 
$dbs = mysql_list_dbs(); 
echo "Databases:
";
 
while (list($db) = mysql_fetch_rows($dbs)) { 
echo "$db
";
 
} 
显示所有数据库名称 

15、mysql_db_name()-获取数据库名 格式: 
string mysql_db_name(resource result_set, integer index) 
获取在mysql_list_dbs()所返回result_set中位于指定index索引的数据库名 

16、mysql_list_tables()-获取数据库表列表 
格式: 
resource mysql_list_tables(string database [, resource link_id]) 
例: 
mysql_connect("localhost", "username", "password"); 
$tables = mysql_list_tables("MyDatabase"); 
while (list($table) = mysql_fetch_row($tables)) { 
echo "$table
";
 
} 
该函数获取database中所有表的表名 

17、mysql_tablename()-获取某个数据库表名 
格式: 
string mysql_tablename(resource result_set, integer index) 
例: 
mysql_connect("localhost", "username", "password"); 
$tables = mysql_list_tables("MyDatabase"); 
$count = -1; 
while (++$count < mysql_numrows($tables)) { 
echo mysql_tablename($tables, $count)."
";
 
} 
获取mysql_list_tables()所返回result_set中位于指定index索引的表名 

18、mysql_fetch_field()-获取字段信息 格式: 
object mysql_fetch_field(resource result [, int field_offset]) 
例: 
mysql_connect("localhost", "username", "password"); 
mysql_select_db("MyDatabase"); 
$query = "select * from MyTable"; 
$result = mysql_query($query); 
$counts = mysql_num_fields($result); 
for($count = 0; $count < $counts; $count++) { 
$field = mysql_fetch_field($result, $count); 
echo "
$field->name $field->type ($field->max_length)
"; 
}  
返回的对象共有12个对象属性: 
name: 字段名 
table: 字段所在的表 
max_length:字段的最大长度 
not_null: 如果字段不能为null,则为1,否则0 
primary_key: 如果字段为主键,则为1,否则0 
unique_key: 如果字段是唯一键,则为1, 否则0 
multiple_key: 如果字段为非唯一,则为1,否则0 
numeric: 如果字段为数值则为1,否则0 
blob: 如果字段为BLOB则为1,否则为0 
type: 字段的数据类型 
unsigned: 如果字段为无符号数则为1,否则为0 
zerofill: 如果字段为“零填充”则为1, 否则为0 

19、mysql_num_fields()-获取查询的字段个数 
格式: 
integer mysql_num_fields(resource result_set) 
例: 
$query = "select id,name from MyTable order by name"; 
$result = mysql_query($query); 
echo "这个查询的字段数是:".mysql_num_fields($result)."
";
 

20、mysql_list_fields()-获取指定表的所有字段的字段名 格式: 
resource mysql_list_fields (string database_name, string table_name [, resource link_id]) 
例: 
$fields =mysql_list_fields("MyDatabase", "MyTable"); 
echo "数据库MyDatabase中表MyTable的字段数: ".mysql_num_fields($fields)."
";
 

21、mysql_field_flags()-获取指定的字段选项 格式: 
string mysql_field_flags (resource result_set, integer field_offset) 
例: 
$query = "select id, name from MyTable order by name"; 
$result = mysql_query($query); 
$row=mysql_fetch_wor($row); 

22、mysql_field_len()-获取指定的字段的最大长度 
格式: 
integer mysql_field_len (resource result_set, integer field_offset) 
例: 
$query = "select name from MyTable"; 
$result = mysql_query($query); 
$row = mysql_fetch_row($result); 
echo mysql_field_len($result, 0)."
";
 
如果mysql_field_len($reseult, 0) = 16777215 
那么numer_format(mysql_field_len($result))等于16,777,215 

23、mysql_field_name()-获取字段名 
格式: 
string mysql_field_name (resource result_set, int field_offset) 
例: 
$query = "select id as PKID, name from MyTable order by name"; 
$result = mysql_query($query); 
$row = mysql_fetch_row($result); 
echo mysql_field_name($result, 0); // Result: PKID 

24、mysql_field_type()-获取字段类型 格式: 
string mysql_field_type (resource result_set, int field_offset) 
例: 
$query = "select id, name from MyTable order by name"; 
$result = mysql_query($query); 
$row = mysql_fetch_row($result); 
echo mysql_field_type($result, 0); // Result: int 

25、mysql_field_table()-获取字段所在表名 
格式: 
string mysql_field_table (resource result_set, int field_offset) 
例: 
$query = "select id as PKID, name from MyTable order by name"; 
$result = mysql_query($query); 
$row = mysql_fetch_row($result); 
echo mysql_field_table($result, 0); // Result: MyTable