Installing PEAR on osx

Assuming you have php installed and working already. And I am using osx 10.6. Obtaining the installation package/script. curl http://pear.php.net/go-pear.phar > go-pear.phar Then run it sudo php go-pear.phar It will then ask you for the path settings. I suggest installing pear at the /usr/local dir, but this is really your preference. In my case, I entered 1, then changed the $prefix to “/usr/local/pear”. The paths below #1 should automatically change accordingly. Then enter to install. ...

July 4, 2011 · 2 min · birdchan

IMEI

If you need to obtain your IMEI # for some reasons, here is how. No, you don’t need the original box of your phone. ;) BTW, I am using an iphone 4 with at&t. Fire up your phone app, then go to the Keypad tab, then punch in *#06# and a screen should automatically pop up with your IMEI #. Actually… upon more research, for iphone 4 users, it’s actually a lot simpler. Just go to Settings -> General -> About, then scroll down to find out your IMEI and ICCID #s. ...

July 3, 2011 · 1 min · birdchan

MySQL TEXT field types

The maximum amount of data that can be stored: TINYTEXT256 bytesTEXT65,535 bytes64kbMEDIUMTEXT16,777,215 bytes16MBLONGTEXT4,294,967,295 bytes~4GB

July 1, 2011 · 1 min · birdchan

讓護士告訴你

最近有一篇文章在Facebook, twitter上頻頻被轉,Nurse reveals the top 5 regrets people make on their deathbed,它的原文是一名叫Bronnie Ware的護士寫的。Bronnie Ware專門照顧那些臨終病人,所以有機會聽到很多人臨終前說出他們一生裡最後悔的事。她作了一個概括,有5件事是大多數人最後悔的。 很好奇為什麼這麼多人轉載它,也許,因為這是一種你永遠無法提前經歷的事吧。你不會時常面對別人的死亡,你更不怎麼時常有機會聽到一個臨終前的人告訴你他最後悔的事是什麼。而即便你聽到,你又會覺得自己來日方長。我們似乎永遠無法感同身受;也許,只有我們自己的生命到了盡頭時,我們才會意識到自己究竟錯過了什麼,最後悔什麼。 1. 我希望當初我有勇氣過自己真正想要的生活,而不是別人希望我過的生活。 這是所有後悔的事中最常聽到的。 心理學上有個理論,較之那些我們做過的事,人們後悔的往往是那些沒做的事。所以當人們在生命盡頭往回看時,往往會發現有好多夢想應該實現,卻沒有實現。你的生活方式、你的工作、你的感情、你的伴侶,其實我們多少人過著的是別人希望你過的生活,而不是自己真正想要的生活——又可能,一直以來你把別人希望你過的生活當作是你想要的生活。 當你疾病纏身時,才發現其實自己應該而且可以放下很多顧慮追求你要的生活,似乎已經晚了一點。 2. 我希望當初我沒有花這麼多精力在工作上。 Ware說這是她照顧過的每一個男病人會說的話。因為工作,他們錯過了關注孩子成長的樂趣,錯過了愛人溫暖的陪伴,這是他們最深的後悔與愧疚。其實對於現在的職業女性來說,這也將成為一個問題。 如果把你的生活變簡單些,你也許會發現自己在做很多你以為你需要做其實不需要你做的事。騰出那些事占的空間,可能你會過得開心一點。 3. 我希望當初我能有勇氣表達我的感受。 太多的人壓抑自己的感受與想法,只是為了“天下太平”,不與別人產生矛盾。漸漸他們就成了中庸之輩,無法成為他們可以成為的自己。其實,有很多疾病與長期壓抑憤怒與消極情緒有關。 也許當你直言不諱,你會得罪某些人。但可能從此以後因為你的中肯,你們不打不相識;又或者翻臉,正好讓你擺脫這種需要你壓抑自己感受才能維持的累人關系。不管哪一種結果,你都是贏家,不是嗎?——不過當然,直言不諱還是有底線的。 4. 我希望當初我能和朋友保持聯系。 老朋友的好,我們總要到自己有事了的時候才會想到。 多少人因為自己忙碌的生活忽略了朋友忽略了曾經閃亮的友情。很多人臨終前終於放下錢、放下權,卻放不下心中的情感與牽掛。朋友也好,愛人也罷,其實生命最後的日子裡,他們才是我們最深的惦念。 5. 我希望當初我能讓自己活過開心點。 也許有點出乎意料,但這一條也在前5之中。很多人直到生命的最後才發現,“快樂是選擇”。 他們在自己既定習慣和生活方式中太久了,習慣了掩飾,習慣了偽裝,習慣了在人前堆起笑臉。就像五月天的那首歌,“你不是真正的快樂,你的笑只是你給的保護色”。他們以為是生活讓他們不快樂,其實是他們自己讓自己不快樂了。 是只有臨終的時候才會發現,別人怎麼看你又有什麼關系呢,傻也好,怪也罷,能有真心的笑,比什麼都值得。 【網路轉載,歡迎分享】

June 30, 2011 · 1 min · birdchan

DFU

If case you need to put your iphone into the DFU mode, here is a little tutorial: http://www.iclarified.com/entry/index.php?enid=1034.

June 26, 2011 · 1 min · birdchan

SVN Working Copy locked

I had some kind of ssh error when using subversion. I then did a force quit coz it hung for too long. Then when I started svn again but it kept saying my work directory is locked. I am using osx so I did a “Get Info” on my work directory and toggled the “Locked” checkbox but that didn’t help. Someone said do a recursive “/Developer/Tools/SetFile -a l”, but later on I found out that’s a solution for another problem. The root question here for me is, why does svn think that my work directory is locked? ...

June 22, 2011 · 1 min · birdchan

mysql python installation error on osx

I installed MySQL-Python (version 1.2.3 at the time being) from http://sourceforge.net/projects/mysql-python/ on my osx 10.6, python version 2.6.1. Just do the usual “python setup.py build” and “python setup.py install”. However though, in the python cli, when I do “import MySQLdb”, I got some error. >>> import MySQLdb Traceback (most recent call last): File "", line 1, in File "build/bdist.macosx-10.6-universal/egg/MySQLdb/__init__.py", line 19, in File "build/bdist.macosx-10.6-universal/egg/_mysql.py", line 7, in File "build/bdist.macosx-10.6-universal/egg/_mysql.py", line 6, in __bootstrap__ ImportError: dlopen(/Users/birdchan/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib Referenced from: /Users/birdchan/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so Reason: image not found >>> Obviously, the error is “Library not loaded: libmysqlclient.18.dylib”. A quick fix is to simply create a symlink. ...

June 18, 2011 · 1 min · birdchan

DEHP: Di-Ethyl-Hexyl-Phthalate

以下是我們家的一位化工博士朋友對最近台灣塑化劑風波,給我們的一點機會教育。跟大家分享一下。 起雲劑?塑化劑?怎麽活下去? 過去十天(2011年5月 20-29號)轟動臺灣最大的食品污染事件就是有毒物品發現在一些飲料裏面,之後,臺灣方面發現污染擴大達到8000多件產品,而且有些食品還外銷到上 海,香港,東南亞,以及美國。很多朋友還記得小弟我曾經拿過加州理工的化工博士,希望我來解釋一下到底這些化學名詞是什麽東東,以及以後要注意些什麽東 西,該怎麽活下去。首先我要說的是,諸君不要緊張,我在下面希望能夠以最簡單的話語,來告訴大家來龍去脈,請看官喝口水慢慢看: ========================= 什麽是“起雲劑”(Cloud Agent)? 起 雲劑是在製作飲料的過程當中,放入的一種可以食用的添加物。起雲劑的成分是以棕榈油,葵花油,香精,香油,醋酸等做成。目的是爲了要(1)產生乳化的粘稠 感覺,為飲料產生適當的濃度,(2)掩蓋不當的臭味異味。這個做法是快速攪拌,產生以水包油的乳化穩定,造成賣相好看的飲料。 什麽是“塑化劑”(Platicizer)? 在 講塑化劑之前,我先説明一下什麽是“塑膠”。塑膠就是是化學的聚合物。比如常聽到的“聚乙烯”(PE, Poly-Ethylene),或者“聚氯乙烯”(PVC,Poly-Vinyl-Chloride)。PE常見的就是超級市場用的塑膠袋,而PVC常見 的是保鮮膜。那麽爲什麽保鮮膜PVC會有點粘粘的呢?因爲相對于PE塑膠袋,PVC保鮮膜多了“氯”的成分,而因爲這個關係,“氯”這個元素可以讓塑膠增 加黏度。 那麽什麽又是“塑化劑”呢?簡單來説,塑化劑是另一種化學物質,叫做“鄰苯二甲酸 酯”(DEHP, Di-Ethyl-Hexyl-Phthalate)類的衍生物。塑化劑的名字由來,是因爲它常常會用來加入PVC保鮮膜的製造裏面,讓保鮮膜可以撕扯, 可以折疊,可以延展。但塑化劑這種東西對人體是有一定的毒性的,一般而言,人體每日可以承受 1.5 PPM (parts per million)的塑化劑吸收。 我為什麽要在這裡說這麽多有關“塑化劑”的知識?因爲是要讓 各位同學知道,塑化劑在日常的保鮮膜裏面都有。所以下列幾項使用保鮮膜須知,先讓同學們知道:(1)不可用保鮮膜覆蓋食物去微波加熱,因爲塑化劑會釋放出 來,然後溶入食物,(2)使用保鮮膜覆蓋食物的時候,盡量避免其接觸有油脂的食物。這是因爲塑化劑本身是一種有機化學物質,而有機物一般而言會溶解于油脂 裏面,(3)不要加熱塑料物品,因爲包括PVC之内的很多塑膠種類,比如塑膠杯子,還有塑膠玩具,都有加塑化劑。 臺灣這個禮拜到底發生了什麽事情? 簡單來説,在臺灣生産“起雲劑”的廠商,美其名,叫做“香料公司”。這些香料公司做出來的起雲劑,賣給中游及下游的飲料廠商,比如黑松飲料,統一飲料,還有 很多運動飲料公司,以及牛奶,豆漿飲料公司等等。過去這個禮拜,有臺灣的昱伸香料公司被發現,用有毒的“塑化劑”摻入本來應該無毒的“起雲劑”的製作。比 如在益生菌(優格產品)裏面,檢驗出含有600 PPM 的塑化劑,(而我們每個人每天生理的容忍度只是1.5 PPM)。所以這個問題很大。那爲什麽廠商要幹這種事情呢?因爲塑化劑DEHP也可以有起雲劑的作用,但是其成本只有起雲劑棕榈油的五分之一。所以這個昱 伸公司是個黑心廠商。據聞負責人今天已經被抓了。今天的另一個消息是,臺北的另一家“賓漢香料公司”也有類似的嫌疑,現在還在調查當中。賓漢香料可能在奶 油製品裏面有摻入塑化劑,而奶油製品又可能賣入麵包店,蛋糕店做成麵包和蛋糕。 影響所及的產品?什麽可以吃?什麽該考慮暫停購買? 目前盡量避免項目: 罐裝豆漿,所有運動飲料,所有桔子汁,罐裝茶,瓶裝茶,罐裝咖啡,優格產品,麵包,蛋糕,牛奶,奶類製品,冰淇淋等,所有的濃縮果汁,果醬成品等等。還有。。珍珠奶茶 - 包括波霸珍珠的製造,和奶精加料都可能遭受塑化劑的污染。 可以飲用飲料: 白汽水,可樂,自泡茶,現煮咖啡,現煮豆漿(如四海豆漿,永和豆漿,都OK啦) 女士們應該避免的美容產品: 若是你在臺灣,而且你的一切跟“油”有關的美容產品是在過去一年買的話,比如指甲油,卸妝用油等等,我建議都丟掉,過一陣子再買。

June 18, 2011 · 1 min · birdchan

phpMyAdmin navigation frame not resizable

If you have long database table names you may find it frustrating to use phpMyAdmin, having the end portion of many long tables names truncated. There is really no easy way to widen the navigation frame either… Your last option is to horizontally scroll right… Nooooooooooo…. OK, here is a little fix. The problem here is, there is nothing for you to grab to widen the left frame. That’s due to the fact that the frame border is set to 0. So to fix that, open up the index.php file, search for the first occurrence of frameborder, then change the frameborder variable to 1, or anything but 0. ...

June 7, 2011 · 1 min · birdchan

phpMyAdmin timeout after 1440 seconds

I keep getting this timeout error from phpmyadmin: " No activity within 1440 seconds; please log in again". @#%@#$@$@ So I decided to change that setting. Open up your config.inc.php file and add the following line: (If you don’t have config.inc.php, copy from config.sample.inc.php) $cfg['Servers'][$i]['LoginCookieValidity'] = 60 * 60 * 12; The above setting sets the timeout value to 12 hours in phpMyAdmin. If your server crashed and cannot load your phpmyadmin page, check your apache log at /var/log/apache2/error.log. If you got PHP Fatal error: Call to a member function get() on a non-object in /path/to/phpmyadmin/libraries/Header.class.php on line 135, then do a chmod 644 config.inc.php. that should take care of the error. ...

June 6, 2011 · 1 min · birdchan