Monthly Archive for December, 2006

Page 2 of 3

一半的寂寞

不知道为什么会用“一半的寂寞”为题目,可能我想一半刚刚好,说明现在的我并不是完整的,现在的时间并不是完整的,现在的工作不是完整的,现在天气不是完整,总是,可能一切对我都不是完整的。所以一半就是正确的,而不是否定某某,更不是怀疑某某。不否认自己的过错,也不想拖累,于是一半也是刚刚好好,然而为什么的寂寞的?难道一半的不是一种寂寞吗?

几天和KAKA小王吃饭,他们买房子了,为他们高兴啊,不知道是什么原因,看到他们的笑容自己也是觉得幸福的,我也知道,真正幸福的是他们,或是想想来说,幸福对与这一对是应该的,你可能觉得幸福来的突然,来得简单,来得刚刚好,但对他们来说,幸福就是这个样子的 ;) 居然忘记用手机给他们拍张照片纪念一下。

值得纪念的不单单是他们吧,总是有很多的人都是值得纪念他们的这段时间,比如方哥,哈哈,嘿嘿。恩,是的看到周围的人幸福也是一种幸福。;)

值得纪念是不是还有我?2006年最后一个月的最后一次弱智?我不是观察家,不能正确看待周围的一切,原来,我真的不是。明天又是一周,上班了,发两张买的PSP的图片就睡觉吧。有了PSP,Miniplayer还是要用的~(难道不爽的时候就想买东西?不过PSP是我上个月就打算买的,后来又没有买,不过现在把钱留起来也没有什么用了,还不如用它来缓解一下弱智的神经 :( ) KAKA他们问我下个目标是什么?是DC?我也不知道,于是我说到 ”等我把PSP耍坏了再说吧“,我们都笑了 ;)

psp

psp

psp

psp

給自己的情歌 梁詠琪

gigi
更新日期:2006-12-13 12:49:19
藝人名稱:梁詠琪
專輯名稱:給自己的情歌
發行公司:豐華
音樂型態:Pop

推薦指數:無再聽見梁詠琪,歌聲依然溫暖的如此熟悉,即使經歷了如此多的風風雨雨,即使身邊環境已是漫天芭樂狗血,即使已不再是最初懵懂而天真的小女孩,GiGi仍然繼續唱著屬於她的心聲,屬於她的歌曲。因為音樂最貼近了GIGI的情感,也因為源自於對音樂的喜愛,她始終堅持而努力著。全新專輯「給自己的情歌」是GiGi在2006年底交出的音樂作品,10首歌曲中我們聽到了不一樣的梁詠琪,卻都有著一致濃濃的真實情感,在目前國語流行樂壇與大眾媒體的強烈口味需求之下,這整張專輯可喜的並不特別強調悲傷的基調,雖然主題都圍繞在城市裡每一段交織的愛情氛圍,卻是傷心、掙扎、無奈、寂寞、出口等等所有都會人矛盾又糾結的情緒,透過GiGi特具溫暖質感的聲音表現,讓所有人痛徹心扉、感同身受,因為每首歌所探討的盡皆是都會人關於戀愛、之於生活最真實的心情寫照。或許是不懂戀愛分分合合的道理,或許是希望掙脫忙碌而乏味的日常生活,或許渴望著一段美好的奇遇,也或許是對於生命衷心的感謝,「給自己的情歌」這一張具有都會透視感的情歌專輯,是這幾年來悄悄成長的GiGi獻給樂迷,也送給自己最溫暖的年終禮物。

「給自己的情歌」紀錄著梁詠琪一年來的音樂心情日記,整張專輯由四大製作人李偲菘、馬毓芬、阿弟仔、邁克林擔綱製作;周杰倫、伍家輝、小安;陳鎮川、黃俊郎、徐世珍、易家揚、鄭淑妃、彭學斌等詞曲創作者的聯手打造,在商業通俗中呈現獨特專屬的質感與氣味,營造一種更深刻的意境,單就音樂的本質在聆聽上就自然而然產生感同身受,人性化情感力量的渲染,詞意的精準與深切更完全打動人心。

GiGi’s Blog: http://www.wretch.cc/blog/gigimusic

使用Skype在ubuntu上通话

Skype安装Skype For Debian的最新版本(我安装的是1.3.0.53)

1
2
$wget http://skype.com/go/getskype-linux-deb
$sudo dpkg -i skype_debian-1.3.0.53-1_i386.deb

注意因为在Ubuntu/Debian系统中可能会因为SCIM输入法或者其他原因导致无法启动Skype,可以用下面的启动方式解决

1
2
$ export LANG=c
$ QT_IM_MODULE=xim skype

或者在KDE环境下安装 qtimm 软件包。不过注意使用第一种方法会造成个别中文字符显示的不完整。至少可以使用SKYPE通话啦,输入法和中文的问题相信很快会解决的。

Javascript document.write

对于javascript的初学者来说,document.write 是一个非常实用的函数,它可以把Javascript中的变量等写入到HTML上

1
2
3
4
5
<script type="text/javascript">
var name = "Hege"
document.write(name)
document.write("<h1>"+name+"</h1>")
</script>

JavaScript Cookies

What is a Cookie?
A cookie is a variable that is stored on the visitor’s computer. Each time the same computer requests a page with a browser, it will send the cookie too. With JavaScript, you can both create and retrieve cookie values.

Examples of cookies:

  • Name cookie – The first time a visitor arrives to your web page, he or she must fill in her/his name. The name is then stored in a cookie. Next time the visitor arrives at your page, he or she could get a welcome message like “Welcome John Doe!” The name is retrieved from the stored cookie
  • Password cookie – The first time a visitor arrives to your web page, he or she must fill in a password. The password is then stored in a cookie. Next time the visitor arrives at your page, the password is retrieved from the cookie
  • Date cookie – The first time a visitor arrives to your web page, the current date is stored in a cookie. Next time the visitor arrives at your page, he or she could get a message like “Your last visit was on Tuesday August 11, 2005!” The date is retrieved from the stored cookie

Create and Store a Cookie
In this example we will create a cookie that stores the name of a visitor. The first time a visitor arrives to the web page, he or she will be asked to fill in her/his name. The name is then stored in a cookie. The next time the visitor arrives at the same page, he or she will get welcome message.

First, we create a function that stores the name of the visitor in a cookie variable:

1
2
3
4
5
6
7
function setCookie(c_name,value,expiredays)
{
  var exdate=new Date()
  exdate.setDate(exdate.getDate()+expiredays)
  document.cookie=c_name+ "=" +escape(value)+
  ((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

The parameters of the function above hold the name of the cookie, the value of the cookie, and the number of days until the cookie expires.

In the function above we first convert the number of days to a valid date, then we add the number of days until the cookie should expire. After that we store the cookie name, cookie value and the expiration date in the document.cookie object.

Then, we create another function that checks if the cookie has been set:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    }
  }
return ""
}

The function above first checks if a cookie is stored at all in the document.cookie object. If the document.cookie object holds some cookies, then check to see if our specific cookie is stored. If our cookie is found, then return the value, if not – return an empty string.

Last, we create the function that displays a welcome message if the cookie is set, and if the cookie is not set it will display a prompt box, asking for the name of the user:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function checkCookie()
{
username=getCookie('username')
if (username!=null && username!="")
  {alert('Welcome again '+username+'!')}
else
  {
  username=prompt('Please enter your name:',"")
  if (username!=null && username!="")
    {
    setCookie('username',username,365)
    }
  }
}

All together now:
Continue reading ‘JavaScript Cookies’

点击浏览器的后退按钮后表单内容的控制

为什么我在点击浏览器的后退按钮后,所有字段的信息都被清空了?

这是由于在表单提交页面中使用了 session_start 函数。该函数会强制当前页面不被缓存。解决办法为,在你的 session_start 函数后加入

1
header("Cache-control: private");

注意在本行之前你的PHP程序不能有任何输出。

还有基于 session 的解决方法,在 session_start 前加上

1
2
3
session_cache_limiter('nocache'); // 清空表单
session_cache_limiter('private');  //不清空表单,只在session生效期间
session_cache_limiter('public');  //不清空表单,如同没使用session一般

JavaScript的Cookie操作函数

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
//获得Cookie解码后的值
function GetCookieVal(offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
  endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}


//设定Cookie值
function SetCookie(name, value) {
  var expdate = new Date();
  var argv = SetCookie.arguments;
  var argc = SetCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;
  if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 ));
  document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
  +((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))
  +((secure == true) ? "; secure" : "");
}


//删除Cookie
function DelCookie(name) {
  var exp = new Date();
  exp.setTime (exp.getTime() - 1);
  var cval = GetCookie (name);
  document.cookie = name + "=" + cval + "; expires="+ exp.toGMTString();
}


//获得Cookie的原始值
function GetCookie(name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen)
  {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
    return GetCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

Ruby on Rails Windows安装问题

Ruby on Rails使用Windows上安装Ruby on Rails的时候,在使用gem安装Rails的时候遇到这样的问题

1
gem install rails --include-dependencies

错误提示找不到 ssleay32.dllzlib.dll,这时候需要下载下面这几个文件放到 \ruby-version\bin 这个目录下

DBD::mysql安装问题

在安装perl的DBD::mysql模块的时候遇到一些问题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$ perl -MCPAN -e shell
[....]
 Can't exec "mysql_config": No such file or directory at Makefile.PL line 76.
 
 Cannot find the file 'mysql_config'! Your execution PATH doesn't seem
 not contain the path to mysql_config. Resorting to guessed values!
 Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
 Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
 Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
 Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
 Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
 Can't exec "mysql_config": No such file or directory at Makefile.PL line 454.
 Failed to determine directory of mysql.h. Use
 [....]

进入DBD::mysql的代码安装目录

1
2
3
4
5
$ cd $HOME/.cpan/build/DBD-mysql-3.0008
$ perl --mysql_config=$MYSQL_PREFIX_DIR/bin/mysql_config
$ make
$ make test
$ make install

这样就安装成功了

Perl安装问题

Perl在测试服务器上安装perl5.8.8

1
2
$./configure.gnu --codefix=$HOME/local
make

结果出错啦~

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
make[1]: Leaving directory `/home/.salk/ndw/src/perl-5.8.6/x2p'

        Making B (dynamic)
opendir(./../../../../..): Permission denied at ../../lib/File/Find.pm line 597
Use of chdir('') or chdir(undef) as chdir() is decodecated at ../../lib/File/Find.pm line 741.
opendir(./..): Permission denied at ../../lib/ExtUtils/MakeMaker.pm line 165
Couldn't change to directory /home/.salk/ndw/C: No such file or directory at Makefile.PL line 18
Writing Makefile for B
Warning: No Makefile!
make[1]: Entering directory `/home/.salk/ndw/src/perl-5.8.6/ext/B'
make[1]: *** No rule to make target `config'.  Stop.
make[1]: Leaving directory `/home/.salk/ndw/src/perl-5.8.6/ext/B'
make config failed, continuing anyway...
make[1]: Entering directory `/home/.salk/ndw/src/perl-5.8.6/ext/B'
make[1]: *** No rule to make target `all'.  Stop.
make[1]: Leaving directory `/home/.salk/ndw/src/perl-5.8.6/ext/B'
make: *** [lib/auto/B/B.so] Error 2

1
$make minitest

来测试,结果在98.5%的地方出错了,没有办法,GOOGLE上搜索了一下,结果是编译的地方出错了,在 /tmp 下面编译一点问题都没有,看来是不是以后都要改变一下编译的习惯了? ;)

1
/tmp$ ./configure.gnu --codefix=$HOME/local && make && make test && make install