Archive for September, 2009

English learning

Tuesday, September 15th, 2009

It hurts to love someone and not be loved in return. But what is more painful is to love someone and never find the courage to let that person know how you feel.
只有付出的爱是痛苦的,但比这更痛苦是爱一个人却没有勇气让那人知道你的感情。

A sad thing in is when you meet someone who means a lot to you,only to find out in the end that it was never meant to be and you just have to let go.
生命中令人悲伤的一件事是你遇到了一个对你来说很重要的人,但却最终发现你们有缘无份,因此你不得不放手。

The best kind of friend is the kind you can sit on a porch swing with,never say a word,and then walk away feeling like it was the best conversation you’ve ever had.
最好的朋友就是那种能和你促膝而坐,彼此不说只字片语,分别时却感到这是你有过的最好的一次交流!

It’s true that we don’t know what we’ve got until we lose it, but it’s also true that we don’t know what we’ve been missing until it arrives.
的确只有当我们失去时才知道曾拥有的是什么,同样,只有当我们拥有了才知道曾经失去了什么。

It takes only a minute to get a crush on someone,an hour to like someone,and a day to love someone- but it takes a time to forget someone.
迷上某人只需一分钟,喜欢上某人需要一小时,爱上某人则要一天,然而,忘记某人却是一辈子的事情。

Don’t go for looks;they can deceive. Don’t go for ;even that fades away. Go for someone who makes you smile because it takes only a smile to make a dark day seem bright.
别倾心于容貌,因为它具有欺骗性,也别倾心于财富,它也会消散,倾心于那个能带给你笑容的人吧,因为一个笑容能使漫漫长夜如白昼般明亮。

Dream what you want to dream;go where you want to go;be what you want to be,because you have only one and one chance to do all the things you want to do.
做你想做的梦吧,去你想去的地方吧,成为你想成为的人吧,因为你只有一次生命,一个机会去做所有那些你想做的事。

Always put yourself in the other’s shoes. If you feel that it hurts you,it probably hurts the person too.
要设身处地的为别人着想, 如果一双鞋你穿着夹脚, 别人的感觉可能也一样。

A careless word may kindle strife;a cruel word may wreck a ;a timely word may level ;a loving word may heal and bless.
无心快语可能引发争执,无情之词可能折损生命,适时温语可能消弭压力,而关爱之声可能治愈心灵。

The happiest of people don’t necessarily have the best of everything they just make the most of everything that comes along their way.
幸福之人并非拥有一切,只是尽力享受生活的赐予。

Love begins with a smile,grows with a kiss,ends with a tear. When you were born,you were crying and everyone around you was smiling. Live your so that when you die,you’re the one smiling and everyone around you is crying.
爱情以笑开始,以吻转浓,以泪结束。当你哭着降临人世时,身边的每个人都在为此欢笑,好好生活吧,这样你就能含笑离开人世,而身边的每个人都在为此哭泣。

Dreamwevear & Regular Expression

Friday, September 4th, 2009

We often use dw to  find and replace something.

If we can use powerful regular expression freely in dw , yeehhh,many hard work will become simple.

Just like:

If u want to replace all sentence like: “something  is wrong          +122-21″   to “something is wrong (+122-21)”,u can

find:(.*)(\s\s\s*)(\+.*)

and replace with: $1($3);
it mean:

u can get the “something is wrong “  with “(.*)”

(\s\s\s*)” means the blanks in “ong          +12

(\+.*)” means “+122-21

$1 means the first sub-expression in ‘(.*)

$2 means the second sub-expression in ‘(\s\s\s*)

$3 means the third sub-expression in ‘(\+.*)

${i} means the {i}’s sub-expression ,it’s useful in your replacing.

Be careful when u decide to use it , and make sure u have tested it in one draft file.

Powerful Regular Expression:

http://intranet.theadventus.com/knowledge/index.php/Regular_Expression


Ajax learning

Friday, September 4th, 2009

1.For  FF and IE we can use:

========================

以支持多种浏览器的方式创建 XMLHttpRequest 对象

/* Create a new XMLHttpRequest object to talk to the Web server */
var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
    xmlHttp = false;
  }
}
@end @*/
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();

}
=====================

2.open the url with :get or post

xmlHttp.open("GET", url, true);

If u want to use 'POST' like:

xmlHttp.open("POST", url, true);
U should add use like :
----------
  // Open a connection to the server
  xmlHttp.open("POST", url, true);
  // Setup a function for the server to run when it's done
  xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  //post method need this sentence
  xmlHttp.onreadystatechange = updatePage;
  // Send the request
  xmlHttp.send(postStr);
----------

3.Five Steps:五个步骤

=========

0:请求没有发出(在调用 open() 之前)。
1:请求已经建立但还没有发出(调用 send() 之前)。
2:请求已经发出正在处理之中(这里通常可以从响应得到内容头部)。
3:请求已经处理,响应中通常有部分数据可用,但是服务器还没有完成响应。
4:响应已完成,可以访问服务器响应并使用它。

=========
But Firefox and IE can only get: 1,2,3,4
Safari can only get:2,3,4

4.boldness error:莫名其妙的错误

If you add both "action=''" and "onsubmit=''" in one form like:

<form name="user" method="post" onsubmit="add_remember_date()" action='<?=site_url('/admin/action');?>'>

u can get some boresome error.
Suggest:u can cancel action like:

<form name="user" method="post"  onsubmit="add_remember_date()">

I am sure that there is no question.

5.About documet.user.submit();

If u have such sentence below in your code and want to use documet.user.submit():

<input type=”button” id=”submit”>

some error will happen ,so u can change id=’submit’ to id = ’submit_’

“submit” as the id name can take this error,so u should change to another name


About JavaScript

Friday, September 4th, 2009

1.If I want to delete the blank of one sentence like ‘trim’ in java, I can only use

str   =   str.replace(/^\s+|\s+$/g,”");

2.If I want to add ,edit and delete nodes in  one page,I can use:

appendChild()

removeChild()

replaceChild()

3.Just like “print_r” in php,we can use the function below to list array in js:

// just like print_r in php
function list(array){
for(var i =0 ;i<array.length;i++){
document.write(”array["+i+"]:”+array[i]+”   “);

}
if(i==array.length-1){
document.write(”<br><hr>”);
}

}

—–

4.Get URL:

var url = document.URL;

5.About eval()

var test = array(’test1′,’test2′);

var out =”test”;

var output = eval(out);

Now output is : array(’test1′,’test2′);

=========

Powerful Javascript——Javascirpt is Powerful

guoliang is here!

Wednesday, September 2nd, 2009

This is real guoliang.

p8270296

Hello world!

Wednesday, September 2nd, 2009

Welcome to TAC Blogs. This is your first post. Edit or delete it, then start blogging!