Monday, December 17, 2007
Premature end of script headers
However, when we access http://www.xxx.com/phpapp, there is 402 or 500 Internal Error.
Checking the backend log, the error message is:
"Premature end of script headers"
Solution: we need to chmod the whole phpapp directory recursively to the following read write access.
Command Line: chmod 745 -R /xxx/public_html/phpapp
Wednesday, December 05, 2007
HTML Color Code
FFF FFF | CCC CCC | 999 999 | 666 666 | 333 333 | 000 000 | FFC C00 | FF9 900 | FF6 600 | FF3 300 | ||||||
99C C00 | CC9 900 | FFC C33 | FFC C66 | FF9 966 | FF6 633 | CC3 300 | CC0 033 | ||||||||
CCF F00 | CCF F33 | 333 300 | 666 600 | 999 900 | CCC C00 | FFF F00 | CC9 933 | CC6 633 | 330 000 | 660 000 | 990 000 | CC0 000 | FF0 000 | FF3 366 | FF0 033 |
99F F00 | CCF F66 | 99C C33 | 666 633 | 999 933 | CCC C33 | FFF F33 | 996 600 | 993 300 | 663 333 | 993 333 | CC3 333 | FF3 333 | CC3 366 | FF6 699 | FF0 066 |
66F F00 | 99F F66 | 66C C33 | 669 900 | 999 966 | CCC C66 | FFF F66 | 996 633 | 663 300 | 996 666 | CC6 666 | FF6 666 | 990 033 | CC3 399 | FF6 6CC | FF0 099 |
33F F00 | 66F F33 | 339 900 | 66C C00 | 99F F33 | CCC C99 | FFF F99 | CC9 966 | CC6 600 | CC9 999 | FF9 999 | FF3 399 | CC0 066 | 990 066 | FF3 3CC | FF0 0CC |
00C C00 | 33C C00 | 336 600 | 669 933 | 99C C66 | CCF F99 | FFF FCC | FFC C99 | FF9 933 | FFC CCC | FF9 9CC | CC6 699 | 993 366 | 660 033 | CC0 099 | 330 033 |
33C C33 | 66C C66 | 00F F00 | 33F F33 | 66F F66 | 99F F99 | CCF FCC | CC9 9CC | 996 699 | 993 399 | 990 099 | 663 366 | 660 066 | |||
006 600 | 336 633 | 009 900 | 339 933 | 669 966 | 99C C99 | FFC CFF | FF9 9FF | FF6 6FF | FF3 3FF | FF0 0FF | CC6 6CC | CC3 3CC | |||
003 300 | 00C C33 | 006 633 | 339 966 | 66C C99 | 99F FCC | CCF FFF | 339 9FF | 99C CFF | CCC CFF | CC9 9FF | 996 6CC | 663 399 | 330 066 | 990 0CC | CC0 0CC |
00F F33 | 33F F66 | 009 933 | 00C C66 | 33F F99 | 99F FFF | 99C CCC | 006 6CC | 669 9CC | 999 9FF | 999 9CC | 993 3FF | 660 0CC | 660 099 | CC3 3FF | CC0 0FF |
00F F66 | 66F F99 | 33C C66 | 009 966 | 66F FFF | 66C CCC | 669 999 | 003 366 | 336 699 | 666 6FF | 666 6CC | 666 699 | 330 099 | 993 3CC | CC6 6FF | 990 0FF |
00F F99 | 66F FCC | 33C C99 | 33F FFF | 33C CCC | 339 999 | 336 666 | 006 699 | 003 399 | 333 3FF | 333 3CC | 333 399 | 333 366 | 663 3CC | 996 6FF | 660 0FF |
00F FCC | 33F FCC | 00F FFF | 00C CCC | 009 999 | 006 666 | 003 333 | 339 9CC | 336 6CC | 000 0FF | 000 0CC | 000 099 | 000 066 | 000 033 | 663 3FF | 330 0FF |
00C C99 | 009 9CC | 33C CFF | 66C CFF | 669 9FF | 336 6FF | 003 3CC | 330 0CC | ||||||||
00C CFF | 009 9FF | 006 6FF | 003 3FF |
Color swatches for the browser safe palette are available free for many popular graphics packages, from www.visibone.com.
Tuesday, December 04, 2007
Firefox extension
https://addons.mozilla.org/en-US/firefox/addon/1985
Firebug
https://addons.mozilla.org/en-US/firefox/addon/1843
WebIDE
http://www.ithome.com.tw/news/88890
HttpFox: An HTTP analyzer addon for Firefox
https://addons.mozilla.org/en-US/firefox/addon/6647
CSSViewer
https://addons.mozilla.org/en-US/firefox/addon/2104
Web Developer
https://addons.mozilla.org/en-US/firefox/addon/60
NoScript
https://addons.mozilla.org/en-US/firefox/addon/722
ScribeFire Blog + HTML Editor
https://addons.mozilla.org/en-US/firefox/addon/1730
FireShot
http://screenshot-program.com/fireshot/
Project Naptha 讓圖片裡的文字可被複製、選取(Chrome 擴充功能)
http://free.com.tw/project-naptha/
Oracle AS Startup & Shutdown script
Environment File: infraenv
export ORACLE_SID=if
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/Infra101202
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:/lib:/usr/lib:/usr/local/lib export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:
$ORACLE_HOME/network/jlib
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:
$ORACLE_HOME/dcm/bin:$ORACLE_HOME/opmn/bin
export TNS_ADMIN=$ORACLE_HOME/network/admin
Start Script:
[oracle@host]$ cat start1012.sh
#1. Start Infra DB.
source infraenv
$ORACLE_HOME/bin/lsnrctl start
SQLDBA="$ORACLE_HOME/bin/sqlplus /nolog"
$SQLDBA <
startup
EOF
#2. Start Infra AS.
$ORACLE_HOME/opmn/bin/opmnctl start
$ORACLE_HOME/opmn/bin/opmnctl startproc
$ORACLE_HOME/bin/emctl startifdown iasconsole
#3. Start Midtier
source asenv
$ORACLE_HOME/opmn/bin/opmnctl start
$ORACLE_HOME/opmn/bin/opmnctl startproc
$ORACLE_HOME/bin/emctl startifdown iasconsole
Stop Script:
[oracle@host]$ cat stop1012.sh
#1. Stop Midtier
source asenv
$ORACLE_HOME/bin/emctl stop iasconsole
$ORACLE_HOME/opmn/bin/opmnctl stopproc
$ORACLE_HOME/opmn/bin/opmnctl shutdown
#2. Stop Infra AS
source infraenv
$ORACLE_HOME/bin/emctl stop iasconsole
$ORACLE_HOME/opmn/bin/opmnctl stopproc
$ORACLE_HOME/opmn/bin/opmnctl shutdown
#3. Stop DB.
SQLDBA="$ORACLE_HOME/bin/sqlplus /nolog"
$SQLDBA <
shutdown immediate
EOF
$ORACLE_HOME/bin/lsnrctl stop
Wednesday, November 28, 2007
折信纸
http://www.wen8.net/html/969.htm
http://tw.myblog.yahoo.com/f0931115850/article?mid=36
http://www.hsm.com.cn/news/2005/1227/68/10858.shtml
http://www.ghh.com/elf/
我还是简单点两边对折就好了... ...
Thursday, November 22, 2007
Create user in MySQL
1. Secure root user account
shell> mysql –u root
mysql> SET PASSWORD FOR 'root'@localhost=PASSWORD('mypass');
2. Create app database and user.
shell> mysql --user=root --password=mypass mysql
mysql> create database mydb;
mysql> GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'localhost' IDENTIFIED BY 'mypass2' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'%' IDENTIFIED BY 'mypass2' WITH GRANT OPTION;
3. Backup database.
mysqldump -u root -pmypass --complete-insert=TRUE -x mydb > mydb.sql
Tuesday, November 20, 2007
斗嘴
状况使人成长。对于这个事件我有很多联想:
1. 如果说资深是权威,那么有些权威是不喜欢被挑战的。
2. 因为他是长辈,或许还有优越感,所以他会对小辈大声驳斥。
3. 公司的管理层都是长辈和优越者呀,所以指令才会由上而下一面倒。
这里有没有存在谁对谁道歉的问题?我觉得由于理由1和2,所以他不会道歉。而且他可能本来就是故意大声教训我,让我闭嘴。而我是就事论事,我也不存在道歉的动机。所以我们两个人都不会道歉的。
不过错肯定是在我,因为我本来就不应该带着斗嘴的目的去忽悠别人,那怕我是就事论事。
我觉得我很不成熟,同时不明白人情世故,太过自以为是了。
真正成功的讨论,是使用言语达到目的,而不使对方恼怒。
Monday, June 18, 2007
Change Rename hostname for Oracle Application Server Midtier
It is ok to change / rename hostname for Oracle Application Server Infrastructure and Midtier. However documentation says it does not support Oracle AS with Metadata Repository.
Simply execute the following command to change hostname for Midtier.
% $ORACLE_HOME/chgip/scripts/chgiphost.sh -mid
The script is clever enough to pick up the host information. So you just need to accept the default prompt 4 times, that's it.
Thursday, June 07, 2007
Oracle SQL command to create user
The following is the simplest way to create an Oracle user:
-- 1. Create Tablespace "MYDB"
CREATE TABLESPACE "MYDB"
LOGGING DATAFILE '/u02/oradata/ora10gdb/mydb.dbf'
SIZE 200M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED;
-- 2. If temporary table space is needed, script to create temporary table space.
CREATE TEMPORARY TABLESPACE "TEMPORARY"
TEMPFILE '/u02/oradata/ora10gdb/TEMPORARY.dbf'
SIZE 50M
EXTENT MANAGEMENT LOCAL
UNIFORM SIZE 10M;
-- 3. Create User "MYDB"
CREATE USER "MYDB" PROFILE "DEFAULT" IDENTIFIED BY "MYDB"
DEFAULT TABLESPACE "MYDB" TEMPORARY TABLESPACE "TEMP" ACCOUNT UNLOCK;
GRANT "CONNECT" TO "MYDB";
GRANT "RESOURCE" TO "MYDB";
Wednesday, April 18, 2007
Upgrade OracleDB
It is interesting that my colleagues simply knew I need to upgrade an existing OracleDB to higher version. But when I asked where do I find the documentation regarding the upgrade, they replied they hit an error before and they solved it but they didn't remember where's the documentation.
Anyway, the summary is, documentation does exist. You may go http://otn.oracle.com/ -> Documentation -> Oracle Application Server -> etc. Please reference the following link for the corresponding OracleDB that is required by SOA Suite 10g installation:
http://download-uk.oracle.com/docs/cd/B31019_01/install.1013/install/reqs.htm#CHDEAICG
% sqlplus sys/password as sysdba
SQL> select version from product_component_version where product like 'Oracle%9i%' or product like 'Oracle%Database%';
The existing OracleDB is 10.1.0.4. How do I upgrade it to 10.1.0.5?
Steps to find patch for upgrading OracleDB:
1. Login http://metalink.oracle.com
2. Go to [Patches & Upgrades] tab.
3. Select "Advanced Search".
4. Search with the following options:
* Product Family: RDBMS Server
* Release: Oracle 10.1.0.4, 10.1.0.5
5. Then, a list of related items are returned.
I want to upgrade OracleDB 10.1.0.4 to 10.1.0.5, which one is the right one? Siva simply suggested me to use "4505133 - Oracle Database Family: Patchset 10.1.0.5 PATCH SET FOR ORACLE DATABASE SERVER". I asked him, how do you know is this one? He replied, you click the readme file, then you'll know everything. Magic. Anyway, I trust him, so I just simply download patch 4505133.
Here you go. Upgrade patch is bundled in OUI (Oracle Universal Installer) format. So we simply shutdown all database processes and execute "./runInstaller". OracleDB will be upgraded beautifully.
Saturday, April 14, 2007
YAH Batch 3 Anniversary
Reception
Student coming.
12 April 2006 was the day all the Batch 3 facilitators got together. So we decided to have an anniversary gathering on same day 14 April 2007. After lunch in Junction 8 food court, Bao Xuan drove May Ying and me together to East Coast Park Island Resort.
Inside chalet
While we were waiting for the rest to arrive in the evening, we have an informative chat. I learned 2 tips to become good boyfriend/husband from Bao Xuan, haha...
Around 6:30pm, more people and food arrived. The buffet was ordered by May Ying. The presentation looked good and the food was tasty. Yue Feng had also prepared Mo Mo Cha Cha dessert.
This was a rare gathering. We had some new friends, husband and wife coming. Everybody ate ate and chat chat. Then, it was ice-breaking cum team-building game time. Soon prepared 3 games, they were (1) Guess who am I? (2) Phoenix Hall of Fame and (3) Memorized Puzzle.
Game1: Guess who am I?
Game2: Phoenix Hall of Fame
Game3: Memorized Puzzle
Aiyo... it was not easy to control the crowd. Players started to act before Soon finished explaining. They argued with the rules or they refused to accept the “prizes”. Haha... quite messy.
Refuse to accept the Prize
As we were facilitators, we had the debrief session after the activities. Somehow somebody had opinions and somehow ended up Soon went on stage to sing. Bee Yew the potential future facilitator was involved also.
After game debrief
Bee Yew and Soon sang on the stage
Finally, the event was ended. Hopefully everybody had a happy and memorable night.
For the complete photo album, visit here:
http://picasaweb.google.com/yangchengsoon/070414YAHBatch3Anniversary
2 tips to become good boyfriend/husband
由于本人性格比较随和,多数事情不太计较。有一次出国旅行找旅店的时候,有朋友十分小心翼翼的审查睡床表面干不干净,窗口对那边,地板脏不脏,房间整体的色调好不好,之类的。我看了简直不可思议,“ 喂,我们不是买房子,只是住旅店一晚,你没有必要如此斤斤计较吧?” 言下之意,就是将就一点。
我一直都不觉得自己这样有什么问题。然而,和一个女性朋友聊天之后,我才明白自己这样是太不体谅别人的性格和习惯了。
那个女性朋友天生就是一个爱干净,爱选择美观的东西,的人。如果床不舒服,冲凉房不干净,她就是睡不着,不愿洗澡,或者干脆不住进去的那种。我心里就想,哎哟,如果我带这样的一个女朋友出门真麻烦。可是!她的先生是怎样反应的?我听了感触良深。
当她和朋友要在外面过夜,她的先生听到是什么地方的时候,他十分预知的告诉她,你在那边是睡不着的啦,还是回家休息吧。哇,太了解自己的妻子了。
而且,如果他们夫妇旅行的时候,她的老公一定花费多一点,住星级旅店。哇,太体谅自己的妻子了。
这个可以学一学。
Tips # 2: 老婆是拿来疼的,不是当家里的佣人。
有时聊天谈论到找对象的时候,有时候有人会提到说,希望自己的妻子能够做家务和照顾老人小孩。
然而我的女性朋友回到丈夫婆家吃饭的时候,她的先生反而会叫他的妹妹洗碗收拾,我的女性朋友是不用动手的。先生的家里人当然会抗议嘛。她的先生就说,老婆是拿来疼的,不是当家里的佣人。
这个例子有点极端,不过做丈夫的想法却很超越。想一想,如果一个男孩子还没有结婚,到处去跟人家说希望他的妻子能够做家务,那么肯定把女孩子吓跑了嘛。难怪有人找不到女朋友了。
这一条可以参考参考。
Friday, March 30, 2007
Shell script execution - command not found, syntax error near unexpected token
“command not foundh” line xxx
“command not foundne” line xxx: syntax error near unexpected token `
This is due to the newline characters used on both systems. We need to replace all occurances of "\r\n" with "\n".
In vi, do the following:
// Change from
:set fileformat=unix
:w
// change back to Carriage Return + Line Feed for DOS
:set fileformat=dos
:w
// writing for apple computers:
:set fileformat=mac
:w
// remove multiple (repeated) Carriage Returns using search and replace
:%s/[^M]$//
:w
Thursday, January 25, 2007
年长者的失眠症
有一位年长者缺席了一堂课。我打电话去慰问她什么原因没来。她提到她有失眠问题,星期六早上觉得头晕,怕走路跌到,又不想麻烦女儿早起载她上学,所以便没来了。
我和她聊了很久,针对她的问题我给了我的意见。最后她反应道,“你的意见很新奇,我没有想过。”
因为聊了很多,她大概也记不了。所以我把重点写出来,印在纸上给她看。
问题: 白天不敢午睡,怕晚上会睡不着。常常小睡十五分钟就起身。
建议: 如果白天能够入睡,就应该敢敢睡久久。如果晚上睡不着了,就起身做事。反正都已经退休了,时间都是自己的,不用怕白天和晚上的生理时钟颠倒了。最重要的是睡的足够,睡到自然醒,睡足比药补好。
问题: 可是白天忙於做家务,不能午睡太久。
建议: 把家务事分开来。累时睡觉休息,醒了之后,就算在晚上也可以继续做家务。
问题: 晚上失眠,想看书看杂志,可是又不敢开灯,怕打扰到家人。
建议: 可以去客厅,去厨房,去厕所看书。
问题: 早上调闹钟,准时起来为家人准备早餐。
建议: 老娘今天不想早起做家务,你们自己吃面包。你不是女佣嘛,不需要做家务24小时。
问题: 已经习惯坐在书桌上看书,坐久会腰痛。躺下就会舒缓舒服。
建议: 做人不要让自己的习惯绑死,可以尝试洒脱的躺在床上看书。如果累了,书一丢,可以马上在床上睡着。
Saturday, January 13, 2007
OracleAS rewrite/redirect URL to internal machine hostname
When it goes live, we’ll assign a new Domain Name to point to this machine. Hence, this machine has 2 names. Internally it is machine_hostname.domain.com and externally it is host.internet.com.
From Internet when we access this machine, here comes a strange behaviour: when we login OracleAS EM (Enterprise Manager) or perform JSP/Struct/JSF Redirect in our web application, the internal machine hostname is shown up in browser. Hence the browser shows “Page cannot be displayed”.
Amazing. What’s wrong? What happens inside JSP/Struct/JSF Redirect?
Here is the culprit:
“vi $ORACLE_HOME/Apache/Apache/conf/httpd.conf”.
You see the following information:
…
ServerName machine_hostname.domain.com
…
# UseCanonicalName: (new for 1.3) With this setting turned on, whenever
# Apache needs to construct a self-referencing URL (a URL that refers back
# to the server the response is coming from) it will use ServerName and
# Port to form a "canonical" name. With this setting off, Apache will
# use the hostname:port that the client supplied, when possible. This
# also affects SERVER_NAME and SERVER_PORT in CGI scripts.
UseCanonicalName On
Observation is,
1) ServerName is hardcoded with internal machine hostname.
2) Read the explanation of UseCanonicalName, Apache use ServerName to construct a self-referencing URL.
So, we need to set UseCanonicalName off, then Apache will use the hostname:port that the client supplied.
Problem solved. Mission accomplished.
What happens inside JSP/Struct/JSF Redirect?
public class RedirectServlet extends HttpServlet
{
public void service(HttpServletRequest req,
HttpServletResponse resp)
{
String contextPath = req.getContextPath();
String redirectStr = contextPath +
"/nextpage.jsp?param1=value1";
// Use encodeRedirectURL so that session id can be
// included in browser which doesn't support cookies.
resp.sendRedirect(resp.encodeRedirectURL(redirectStr));
}
}
Then, we use Telnet to access this servlet:% telnet machine_hostname 8080
Manually enter:
GET /servlet/RedirectServlet HTTP/1.0
You will get the reply:
HTTP1.1 302 Moved Temporarily
Location: http://machine_hostname:8080/webapp/nextpage.jsp?param1=value1
DATE: ...
Server: ...
Connection: ...
What to observe is that,
1) Redirect in fact is a 302 response from webserver.
2) The complete URL and Port are written out fully in the Location.
This is the reason why the internal machine hostname will be shown up in browser, when we login OracleAS EM (Enterprise Manager) or perform a JSP/Struct/JSF Redirect in our web application.
Please check how to let EM and Redirect return URL as expected-ly.
Run OHS at port 80 (HTTP) and port 443 (HTTPS)
By default, OracleAS HTTP Server runs at port 7777 for HTTP and port 4443 for HTTPS.
In Linux, only root user can use port less than 1024. So, in order to have OHS runs at port 80 and HTTPS runs at port 443, we need to do the following steps:
1. As oracle user,
"cd $ORACLE_HOME/Apache/Apache/conf"
2. Edit httpd.conf
"vi httpd.conf"
Search for 7777 by ":/7777"
You see:
# This port is used when starting without SSL
Port 7777
Listen 7777
Change them to:
# This port is used when starting without SSL
Port 80
Listen 80
3. Edit ssl.conf
"vi ssl.conf"
Replace all occurance of 4443 with 443.
":1,$ s/4443/443/g" or ":%s/4443/443/g"
4. As root user, "cd $ORACLE_HOME/Apache/Apache/bin". Execute:
# chmod 777 apachectl
# chown root .apachectl
# chmod 6750 .apachectl
You'll see the following:
# ll apachectl
-rwxrwxrwx 1 oracle dba 11909 Dec 8 15:11 apachectl
# ll .apachectl
-rwsr-s--- 1 root dba 1703684 Jan 16 2006 .apachectl
Ok, done.
As oracle user, you can startup OracleAS with "opmnctl startall"
Also, you can view the status with "opmnctl status -l"