Monday, March 17, 2008

美丽的神话-成龙,金喜善

解开我 最神秘的等待 星星坠落 风在吹动
终于再将你拥入怀中 两颗心颤抖
相信我 不变的真心 千年等待 有我承诺
无论经过多少的寒冬 我绝不放手

이젠 나의 손을 잡고 눈을 감아요 yi jie na ye so nul qia go,nu nul ka ma yo.
(现在紧抓住我的手闭上眼睛)
우리 사랑했던 날들 생각해봐요 u li sa la hei dang nal dul,sei ga ke ba yo.
(请你回想起过去我们恋爱的日子)
우리 너무 사랑해서 아팠었네요 u li no mu sa la hei so,ha pa so ne yo.
(我们是因为太爱所以更使得我们痛苦)
서로 사랑한단 말도 못했었네요 so lo sa la ha dan mal do,mo tei so ne yo.
(我们连"爱你"这句话都无法讲)

每一夜 被心痛穿越 思念永没有终点
早习惯了孤独相随 我微笑面对
相信我 已选择等待 再多苦痛也不闪躲
只有你的温柔能解救 无边的冷漠

이젠 나의 손을 잡고 눈을 감아요 yi jie na ye so nul qia go,nu nul ka ma yo.
(现在紧抓住我的手闭上眼睛)
우리 사랑했던 날들 생각해봐요 u li sa la hei dang nal dul,sei ga ke ba yo.
(请你回想起过去我们恋爱的日子)
우리 너무 사랑해서 아팠었네요 u li no mu sa la hei so,ha pa so ne yo.
(我们是因为太爱所以更使得我们痛苦)
서로 사랑한단 말도 못했었네요 so lo sa la ha dan mal do,mo tei so ne yo.
(我们连"爱你"这句话都无法讲)

让爱成为你我心中 那永远盛开的花
穿越时空绝不低头 永不放弃的梦
우리 너무 사랑해서 아팠었네요 u li no mu sa la hei so,ha pa so ne yo.
(我们是因为太爱所以更使得我们痛苦)
서로 사랑한단 말도 못했었네요 so lo sa la ha dan mal do,mo tei so ne yo.
(我们连"爱你"这句话都无法讲)

让爱成为你我心中 那永远盛开的花
우리 소중했던 약속 잊지는 말아요 u li so ju hei dang ya kso,yi ji ni ma la yo.
(我们千万不要忘记我们的约定)
唯有真爱追随你我 穿越无尽时空
서로 사랑한단 말도 못했었네요 so lo sa la ha dan mal do,mo tei so ne yo.
(我们连"爱你"这句话都无法讲)
爱是心中唯一不变美丽的神话

美丽的神话-孙楠,韩虹

梦中的人熟悉的脸孔
你是我守候的温柔
就算泪水淹没天地
我不会放手,每一刻孤独的承受
只因我曾许下承诺
你我之间熟悉的感动
爱就要苏醒
万世沧桑唯有爱是永远的神话
潮起潮落始终不悔真爱的相约
几番若痛的纠缠多少黑夜掐扎
紧握双手让我和你再也不离分
枕上雪冰封的爱恋
真心相摇篮才能融解
风中摇曳炉上的火
不灭亦不休
等待花开春去春又来
无情岁月笑我痴狂
心如钢铁任世界荒芜
思念永相随
悲欢负月唯有爱是永远的神话
谁都没有遗忘古老,古老的誓言
你的泪水化为漫天飞舞的彩蝶
爱是翼下之风两心相随自在飞
你就是我心中唯一美丽的神话

爱情诺曼底

六月六日六时六分刚过六十秒
脆弱的堡垒远眺如风化的沙雕
轻抚着断裂的皱纹沧桑一条条
谁的心早已死掉
曾和你相爱如天命难违的凑巧
为何与你对决变成轮回的纷扰
爱如那常消的海潮退去时飘渺
我的心不再计较
情爱它似毒药 你我早就应该知道
为何却不停的要
为何却一再的要
我怎么才能登上你的爱情诺曼底
别让天与海的距离 衡量爱与恨的对立
怎么才能让我登上你的爱情诺曼底
狂奔在破晓的大地 拼了命也要找到你
占领这爱情诺曼底 Yeah

Thursday, March 13, 2008

挑衅

我的梦早已归零 我的爱结成冰

退色的刺青 残留的姓名 那是我的曾经

别为我动了真情 别怪我那么ㄍㄧㄥ

孤独的背影 落寞的神情 经不起你的挑衅

不要闯进我冰冷的爱情 我怕沉睡的梦被你惊醒

无论束手就擒 或是抵挡你的入侵 都会让我 摇摆不定 触景伤情

你的梦如此清醒 你的爱太冷静

催泪的叮咛 温柔的神情 却又让我动心

别让我掉入陷阱 别恨我不敢听

固执的个性 坚定的表情 经不起你的挑衅

不要闯进我冰冷的爱情 我怕沉睡的梦被你惊醒

无论束手就擒 或是抵挡你的入侵 对我来说 都是挑衅

不要挑衅我冰冷的爱情 我怕醒来会爱你爱不停

请你别再靠近 不要让我恨不下心

现在的我 经不起你 一再挑衅

Friday, February 29, 2008

check all or none items in checkedlistbox

if (clientList.CheckedItems.Count == 0)
for (int i = 0; i < clientList.Items.Count; i++)
{
clientList.SetItemChecked(i, true);
}
else
for (int i = 0; i < clientList.Items.Count; i++)
{
clientList.SetItemChecked(i, false);
}

Visual Studio 2008 checkedlistbox

figured this way to databind checkedlistbox, not sure why DataSourse, ValueMember, and DisplayMember do not appear in intellisense

this.clientsTableAdapter.Fill(this.dataSet1.Clients);
practice2.DataSet1.ClientsDataTable t = clientsTableAdapter.GetData();
checkedListBox1.DataSource = t;
checkedListBox1.ValueMember = t.IdColumn.ColumnName;
checkedListBox1.DisplayMember = t.NameColumn.ColumnName;

Monday, February 25, 2008

detect if ActiveX is disabled

found this two links quite useful

tect the browser using ASP.NET and C#
http://www.codeproject.com/KB/aspnet/detectbrowser.aspx

How Can I Tell if ActiveX is Enabled in Internet Explorer?
http://www.microsoft.com/technet/scriptcenter/resources/qanda/nov05/hey1114.mspx

Thursday, February 14, 2008

Wednesday, February 06, 2008

HAPPY CHINESE NEW YEAR TO YOU ALL!!!!!!




























五谷丰登 六畜兴旺 吉庆有余
惠风和畅 发家致富 日度小康
鼠年大吉 万事遂心 利国利民
一往无前 四海皆春 普天同庆

人逢盛世情无限;鼠拱华门岁有余

吉日生财鼠拱户;新春纳福鹊登梅

名题雁塔登金榜;鼠拱华门报吉祥

戌年引导小康路;亥岁迎来锦绣春

孟春之月方营室;宝盖进豕恰是家

国泰民安戌岁乐;粮丰财茂亥春兴

金榜题名光耀第;喜鼠拱户院生财

猪守家门旧主喜;鼠增财富新春欢

猪岁已赢十段锦;鼠年更上一层楼

猪年已展千重锦;鼠岁再登百步楼

猪问平安随腊去;鼠生财富报春来

Thursday, November 29, 2007

make google dance~

found this link somewhere, it provides a block of javascript that makes images in google image search result dance in a queue, lol funny
http://www3.webng.com/redtophank/cit.html

Monday, October 29, 2007

ORA-00979: not a GROUP BY expression

problem query

select class_schedule.class_id, class_schedule.sum(class_schedule.enrolments) tot_enr, class.name from class_schedule inner join class on class_schedule.class_id = class.id group by class_schedule.class.id


solution
select class_schedule.class_id,
sum(class_schedule.enrolments) tot_enr, class.name
from class_schedule
inner join
class on class_schedule.class_id = class.id
group by class_schedule.class_id, class.name

Sunday, October 21, 2007

how to convert my query to stored procedure

I have this procedure below:

set serveroutput on
DECLARE
v_counter NUMBER(7) := 0;
v_tax NUMBER(11,2) := 0;
v_an_sal NUMBER(11,2) := 0;
CURSOR emp_cursor IS
SELECT id, last_name, first_name, salary
FROM scott.s_emp;
--r_emp scott.s_emp%ROWTYPE;
BEGIN
DBMS_OUTPUT.PUT_LINE(rpad(‘ID’,5) || rpad(‘LAST_NAME’, 15) || rpad(‘FIRST_NAME’,15) || lpad(‘ANNUAL_SALARY’,11) || lpad(‘TAX’,11));
DBMS_OUTPUT.PUT_LINE(rpad(‘____ ’,5) || rpad(‘_______________’, 15) || rpad(‘_______________’,15) || lpad(‘___________’,11) || lpad(‘___________’,11));
FOR r_emp IN emp_cursor LOOP
v_counter := v_counter + 1;
v_tax := 0;
v_an_sal := r_emp.salary * 12;
IF v_an_sal > 150000 THEN
v_tax := 47850 + (v_an_sal -150000)*0.45;
ELSIF v_an_sal > 75000 THEN
v_tax := 17850 + (v_an_sal -75000)*0.40;
ELSIF v_an_sal > 25000 THEN
v_tax := 2850 + (v_an_sal -25000)*0.30;
ELSIF v_an_sal > 6000 THEN
v_tax := (v_an_sal -6000)*0.15;
ELSE
v_tax := 0;
END IF;
DBMS_OUTPUT.PUT_LINE(rpad(r_emp.id,5) || rpad(r_emp.last_name, 15) || rpad(r_emp.first_name,15) || lpad(v_an_sal,11) || lpad(v_tax,11));
IF v_counter mod 5 = 0 THEN
DBMS_OUTPUT.PUT_LINE('******************************************************');
END IF;
END LOOP;
END;
/


I need to convert it to a stored procedure (or create a sored procedure for this) so that i can call it from my psp pages.

solution:
remove 'DECLARE set serveroutput on'
replace with 'CREATE OR REPLACE PROCEDURE proc_emp_sum_analysis AS'

loop through query result and print each row in stored procedure

have this query which returns a set of rows, How can I loop through each row and display them using dbms.output.put_line? Please notice in the where clause there is a variable 'v_trainer_id', the variable value is known (retrieved from a column of a current row of another cursor)

select customer.id as customer_id, membership.join_date, membership.join_fee,round(months_between(sysdate, membership.join_date),0) as months_joined, membership_plan.monthly_price, membership.monthly_discount, (membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0) as total_paidfrom membership,membership_plan,customerwhere membership.membership_plan_id = membership_plan.id andcustomer.id=membership.customer_id andmembership.trainer_id = v_trainer_idorder bycustomer.id;


solution:

v_cur_tid := r_trainer.trainer_id;FOR r_mem IN(select membership.customer_id as cust_id, membership.join_date, membership.join_fee,round(months_between(sysdate, membership.join_date),0) as months_joined, membership_plan.monthly_price, membership.monthly_discount, (membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0) as total_paidfrom membership,membership_planwhere membership.membership_plan_id = membership_plan.id andmembership.trainer_id = v_cur_tidorder bymembership.customer_id)LOOP

PL/SQL: ORA-01744: inappropriate INTO

I have this part of the stored procedure, trying to use one select query to fill in 2 variables, got error 'PL/SQL: ORA-01744: inappropriate INTO'

--print summary of subsection

select t.* from (select count(membership.id) into v_tot_mem_by_trainer,sum((membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0)) into v_tot_rev_by_trainerfrom membership, membership_planwhere membership.trainer_id = r_trainer.trainer_id andmembership.membership_plan_id = membership_plan.id) t;


this is the original select query that has no problem
select t.* from (select count(membership.id) as total_number_of_members,sum((membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0)) as total_membership_paymentfrom membership, membership_planwhere membership.membership_plan_id = membership_plan.id) t;


the solution:

select t.* into v_tot_mem_by_trainer, v_tot_rev_by_trainer from (select count(membership.id),sum((membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0))from membership, membership_planwhere membership.trainer_id = r_trainer.trainer_id andmembership.membership_plan_id = membership_plan.id) t;

Saturday, October 20, 2007

ORA-00937: not a single-group group function

I want to select some data from table membership and membership_plan, these 2 have some relationships with each other. In the same query, I also want to 'select count(*) from customers' where customers table has no relationship with the other 2 tables, I just want to find out the total number of customers and display with the rest of the query results.

select (select count(id) from customer), count(membership.id) as total_number_of_members, sum((membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0)) as total_all_members from membership,membership_planwhere membership.membership_plan_id = membership_plan.id;


I got an error message as below:
ERROR at line 1:ORA-00937: not a single-group group function

solution:
select (select count(id) from customer), t.* from (select count(membership.id) as total_number_of_members,
sum((membership_plan.monthly_price- membership.monthly_discount) * round(months_between(sysdate, membership.join_date),0)) as total_all_members
from membership, membership_plan
where membership.membership_plan_id = membership_plan.id) t;

Tuesday, October 16, 2007

oracle sqlldr datetime value problem

this is my loader ctl file

LOAD DATAINFILE 'trainer.data' BADFILE 'trainer.bad'DISCARDFILE 'trainer.dsc'REPLACEINTO TABLE trainerFIELDS TERMINATED BY ','TRAILING NULLCOLS(ID TERMINATED BY ',' ENCLOSED BY '"',FN TERMINATED BY ',' ENCLOSED BY '"',LN TERMINATED BY ',' ENCLOSED BY '"',GENDER TERMINATED BY ',' ENCLOSED BY '"',PHONE TERMINATED BY ',' ENCLOSED BY '"',MOBILE TERMINATED BY ',' ENCLOSED BY '"',EMAIL TERMINATED BY ',' ENCLOSED BY '"',CERTIFICATE_LEVEL TERMINATED BY ',' ENCLOSED BY '"',IS_PERSONAL_TRAINER TERMINATED BY ',' ENCLOSED BY '"',HIRE_DATE TERMINATED BY ',' ENCLOSED BY '"',IS_ACTIVE ENCLOSED BY '"')



the field 'hire_date' is a datetime field. e.g. '15-JUN-2005 13:30' in the format of 'DD-MON-YYYY HH24:Mi'. please see the first 3 rows of my datafile below:

"1","Cara","Surename","m","06623355","0446002359","lorem.ut.aliquam@dictum.edu","a","y","06-JUN-2006 00:00","y""2","Noble","Surename","m","28435168","0451498500","Mauris.magna.Duis@id.com","a","n","06-JUN-2006 00:00","y""3","Coby","Surename","f","79907443","0460112510","Mauris@accumsan.ca","d","n","06-JUN-2006 00:00","y"


then when i executed the ctl file, i got this error below in the log file

Record 1: Rejected - Error on table TRAINER, column HIRE_DATE.ORA-01830: date format picture ends before converting entire input stringRecord 2: Rejected - Error on table TRAINER, column HIRE_DATE.ORA-01830: date format picture ends before converting entire input stringRecord 3: Rejected - Error on table TRAINER, column HIRE_DATE.ORA-01830: date format picture ends before converting entire input string



solution:
HIRE_DATE DATE "DD-MON-YYYY HH24:Mi" TERMINATED BY ',' ENCLOSED BY '"',

Monday, October 15, 2007

An old joke about project manager

A tourist walked into a pet shop and was looking at the animals on display. While he was there,another customer walked in and said to the shopkeeper, "I'll have a C monkey please." Theshopkeeper nodded, went over to a cage at the side of the shop and took out a monkey. Hefitted a collar and leash, handed it to the customer, saying, "That'll be £5,000."

The customer paid and walked out with his monkey.

Startled, the tourist went over to the shopkeeper and said, "That was a very expensive monkey. Most of them are only a few hundred pounds. Why did it cost so much?" The shopkeeperanswered, "Ah, that monkey can program in C - very fast, tight code, no bugs, well worth themoney."

The tourist looked at a monkey in another cage. "Hey, that one's even more expensive! £10,000! What does it do?"

"Oh, that one's a C++ monkey; it can manage object-oriented programming, Visual C++, even some Java. All the really useful stuff," said the shopkeeper.

The tourist looked around for a little longer and saw a third monkey in a cage of its own. The price tag around its neck read £50,000. The tourist gasped to the shopkeeper, "That one costs more than all the others put together! What on earth does it do?"

The shopkeeper replied, "Well, I haven't actually seen it do anything, but it says it's a project manager".

Sunday, October 14, 2007

oracle how to random select a value out of 2 letters

select chr(121 - 11 * (round(dbms_random.value))) is_successful from dual
or

select case when dbms_random.value(0,1) < 0.5 then 'y' else 'n' end is_successful from dual

or
select translate(dbms_random.string('U',1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','ynynynynynynynynynynynynyn') from dual

or
select distinct First_Value(is_successful) over(order by dbms_random.value) as is_successfulfrom (select 'n' as is_successful from dual union all select 'y' from dual);

or
substr('yn', dbms_random.value(1,3), 1)

Friday, October 12, 2007

oracle add a day

select sysdate+1 from dual

oracle add a day

select sysdate+1 from dual