Sunday, May 31, 2009

my gsoc2009 @ May 31

This is again not a good day for coding .... But the day to learn coding -.-"

Let's consider the following js...


var items = this.items;
if (items) {
delete this.items;
...
}


Have you ever think of ... "this.items" is still exist after the delete statement??

This is why i said today is not that good for coding :p

Sooooooooooo, let me explain wt's actually happening...

When i'm refactoring the codes of doc-editor ... I do something like this ...



items of the ui-component are directly defined in the Ext.extend function.

BUT............ The devil comes!!!!!!



As you can see from the nice FireBug console ... Before the delete statement ... items are there... After the delete statement ... ITEMS ARE STILL THERE and making the initComponent CRASHES!!!

Right before I know the problem behind ... i guess it's Firefox bug ^^ then I tried on Chrome ... Same thing happen in Chrome's console .... SO... THat's not bug of browser ....

Wt next?? I dig into Ext.extend ... and think that's bug of Ext.extent ... BUT... Indeed ... it's not a bug but my poor understanding of javascript ~~~~~

From Ext.extend ... items are considered as prototype attribute SO THAT delete statement WONT work here....

Solution! prevent using extend statement for defining the itemssssssssssssssss

---
Update@4-June-2009
This morning... I spent another hour to fight against a bug due to Ext.extend(). In addition to items, overriding tbar + bbar as prototype attribute DOES ALSO CRASH extjs. Looook OUT!!

Monday, May 25, 2009

The GSOC Package

When I awoke this morning, a FedEx package arrived ~~~ It's My GSOC Package!!


A little bit blur as my phone doesn't have anti-handshake ~o~"

So~ Let's have a macro-shot on the notebook!!


It's pretty the same as Google Notebook XD

Sunday, May 24, 2009

my gsoc2009 @ May 24

This week, I finished abstracting the Ext.ajax.request() and reflect corresponding changes in phps.

The major reason for abstracting the pretty good Ext.ajax.request() is that ... we may save some lines for those repeating things like the url of the web service... And another reason is that I know how doc-editor works throughout all request-and-response.

To have a brief review on main.js ... it's a one-big-ui-class with many methods ... those ui-components can be classified by their nature of task ... The following code block can explain the situation...


class something_like_the_main {
task1 : function() {
define_ui_of_task1();
fire_any_XHR_to_construct_the_ui();
show_the_ui_for_task1();
},
task2 : function() {
define_ui_of_task2();
fire_any_XHR_to_construct_the_ui();
show_the_ui_for_task2();
}
...
...
taskN : function() {
// feels like copy & paste from above tasks...................
}
}


As you can see, this make my life easier to break them into different large piece ui components. But.. probably these large piece ui-components are not reusable for other task ... Anyway... i'm not making an ui library so that's not a problem =]

Let's get back to the XHR abstraction. From extjs implementation of ext.ajax.request() method ...
- success callback will be invoked if (httpStatus >= 200 && httpStatus < 300) || (httpStatus == 1223 for IE)
- failure callback will be invoked else
- request callback will be invoked right after calling success/failure callback

And, most (but not every) XHRs in doc-editor depend on the "success" attribute in the response json string to make decision. So, why not slightly improve the readability by re-directing those response with "success: false" to the failure callback and free the success callback by a single if-else branching ??

As a result ... the abstraction is made as follow.



Followed by this decision, I need to reflect the changes in phps. In php... there are 3 routines something like ...

1) getResponse( $mixed ) {return json_encode($mixed); }
2) getSuccess() { return getResponse( array( 'success' => true ) ); }
3) getFailure( $message ) { return getResponse( array( 'success' => false, 'msg' => $message ) ); }

XHR request handlers depend on this 3 functions ... sometimes getFailure-getResponse pair while sometimes getFailure-getSuccess pair. So, I decide to unite them.

It's pretty simple ... change all handlers into getFailure-getSuccess pair and then the XHR abstraction should work. Hence, following codes resulted.





However, when i try to test out the changes ... Something failed... The repository tree failed to load and not files can be retrieved... So, i go back to main.js and see what's matter. It's tricky... the tree nodes are loaded by ext.tree.TreeLoader in which this loader can only accepts json with ext-tree-node config ... While ... the php is returning something like ... { success : true, 1 : tree_node_config1, 2 : tree_node_config2, ... }. A solution is to rollback the change on the repository request handler and allows it to use getResponse instead of getSuccess.

Monday, May 18, 2009

my gsoc2009 @ May 18

At the first glance ... the javascript is really a big mess -.-"

So... I try to study it by first refactoring ALL XHR in the script... So ... I know ... where I click the UI fires what XHR and links to which UI component.

When I was refactoring the script ... I found that ... when I open a XML with the CodeMirror integrated editor and then close it after loading ... Firebug tells me the following ...



"method is not defined" ... At first ... I was wondering if it's my introduced error ... So ... I spent time to setup another environment with cvs no-modification copy... But I still get the "method is not defined".

Then I see the green wordings saying the stuff relating to i18n ... So ... I spent time to look at it. I'm wondering is this a problem related to script include sequence in the php file or cross script reference issue .... This is because I googled: "javascript method is not defined" and read a stackoverflow page.

As time passes by ... I figure out that it could not be the referencing issue anymore when I try the bug reproduction steps again and again with one slight change.

Original reproduce procedure...
1. double click on a XML in "Files Need update"
2. close the newly opened tab after loading complete
3. you could get the err from firebug...

The slight modifed one...
1. double click on a XML in "Files Need update"
2. wait for a few second after loading complete
2. close tab
3. It's FINE!!!

The only thing I can do is to read the stack trace :p
> method is not defined
> _("Loading...") main.js (line 5)
> getFile()("9f389d22c5cd3246733a5c672c6dcf0f", "hk/chapters/","tutorial.xml", "FNU-LANG-PANEL-", "FNU-LANG-")
> main.js (line 1759)
> initialize()() main.js (line 4743)
> DomHelper()() ext-all.js (line 9)
> DomHelper()() ext-all.js (line 9)
> onInit()() Ext.ux.C...Mirror.js (line 59)
> init()() codemirror.js (line 153)
> method() util.js (line 8)
>
> var str = i18n[key];

As you can see from the bold ... method is not defined is really a method which can be found by CodeMirror source ........ Then I look at the source and found that util.js is included using an iframe ... so ... step 2 ... "wait for a few second after loading complete" WORKS!

Next time ... i will see the stack trace before interrupting what's an error message actually mean......... :p silly man~

十天

第0天:

她: "我們做十天的朋友吧. 這十天裡我把你當普通朋友. 你也一樣把我當朋友吧"

他: "對不起, 其實我想了很久, 我還是不成熟, 還不合適當你的男朋友. 是我負了你, 對不起"

晚上, 他哭了, 整晚沒睡. 他一直想著與她的一段段片段. 想著她對他的心意. 想著她...

第1天:

她: "昨天的說話有沒有後悔呀,呵呵... 起初匆忙地確定我們的關係,但是又匆忙地結束我們的關係不太好吧? 既然你說你不成熟,那就給你一個成熟的做一次決定的機會吧. 既然我想約定要做幾天的朋友的,不能一點也不給面子吧? 所以不管昨天之前是什麼關係, 也不管以後是什麼關係, 我們約定做一個月的好朋友吧"

他: "笨蛋, 十天變了一個月了... 其實不是說不給面子, 只是知道, 我還是不習慣. 我習慣跟普通朋友聊幾句 ... 可是不習慣常常的聊著. 你昨天晚上睡不著哭了吧... 我也哭了. 我其實很明白... 我沒好好的關心你..."

他知道這段關係是還可以挽留的, 但他沒有.. 因為, 他知道自己不合適去維持這段關係...

本來, 他已經心死了... 但是, 她卻不想就這樣結束這段感情.

她: "放棄愛一個人, 如果是為了讓他/她更幸福,那可以放棄. 但是如果選擇繼續愛一個人是為了讓他/她更幸福那為什麼要放棄"

他: "愛一個人也要懂得放手. 我錯了, 本來不應該開始, 繼續下去只會樣你一直不開心"

她: "如果你說我們的開始是一個錯誤的話, 那現在結束就是一個解決錯誤的完美答案嗎? 為什麼不嘗試用更好的辦法去解決這個錯誤呢"

她: "如果覺得現在不夠成熟, 其實你其他方面都很成熟, 就是對待感情不夠成熟. 但是, 最終總有一個從不成熟到成熟的過程. 你最後還是要過這一步的. 為什麼遇到問題就逃避而不敢從實質去解決? 你不想成為一個事業感情家庭都能成熟對待的人嗎"

他這時, 知道她不再想結束這感情, 但他實在知道自己的不足.. 卻真的想逃避.. 結果, 他說了一番非常狠的說話.

他: "我很辛苦. 要坐兩個多小時的車很辛苦、想見的時候見不到很辛苦、到一個陌生的地方很辛苦、常常用文字遘通很辛苦" (因為他們相隔異地)

她: "真的沒有想像到和我的這段相處, 你會覺得是那麼的辛苦. 想到最初我的想法和你現在的一樣. 當時你的一句話 - 其實這些都不重要. 一句什麼都不重要的話,讓我放下了一切顧慮"

他: "其實我很自私, 你就當我是負心人吧! 我不值得你去愛, 我不想大家辛苦下去"
他: "我們分手吧"

他: "做一對不久就關心對方的朋友, 不是好多嗎"

過了很久... 他還沒收到她的回覆... 他開始擔心起上來...

他: "笨蛋, 又在哭嗎?"
他: "還在嗎? 不要不說話. 很擔心你"

她: "你還會擔心我嗎? 剛剛那些話, 真的可以透涼到心底"

他聽了, 淚一直下...

他: "你很壞, 常常說一些要人哭的話... 笨蛋!"

她: "你不是也一樣嗎? 擔心我哭, 可是哪句話不會讓我不哭呢"

她: "你每次坐兩個多小時車來見我, 我當然知道你很辛苦. 你曾說了這不重要, 就是因為這些都可以解決的. 自從我答應你之後就沒考慮這些"

她: "因為我知道只要能吃苦, 沒有過不去的. 要我等3年, 我也願意. 但是我不能接受你心裡沒有我" (他們有3年成婚之約)

他: "為什麼你要對我這樣好... 為什麼要對一個常常忽略你的人這樣好"

她: "因為一個我累時, 樂意幫我按摩的人. 因為一個和我吵了架, 夢裡喊我名字的人. 因為一個在車上怕我暈車, 怕我扶手扶痛, 要我抱他腰的人. 因為一個怕我睡不好, 用膊頭給我當枕頭的負心的人..."

他: "就當我們有緣沒份吧..." (這時, 他的淚水下得更多...)

她: "現在一句話就結束了嗎? 怎麼沒有前幾天的,想去修補我們關係的勇氣了"
她: "可是你都沒有嘗試過,去修補這次"

話說不是第一次因他忽略她而令到關係緊張了... 他就是知道... 一次又一次的忽略她, 一次又一次的令她失望... 他只說了三個字...

他: "我累了"

她: "你這次真的放棄了嗎? 曾經說要喝我煲的湯, 可是還沒嚐過, 就放棄了嗎? 曾經說要我幸福, 現在不關心我的幸福了嗎?" (他的淚下得不停)

她: "你要做回自私的人, 為什麼對其他的人你可以無私奉獻? 對我就要自私, 真的是為了我未來的幸福嗎"

他: "我就是知道帶不了幸福給你... 還是算吧... 我已經連流淚的力也沒有啦"

她: "不要那麼不重視一次決定好不好? 為什麼不能好好的溝通? 為什麼可以對我這樣?"

他: "靜下來一天好嗎? 是我負了你"

她: "我何嘗不想靜下來? 可是靜不下來"
她: "你這個大壞蛋, 可不可以教幾種讓我靜下來的方法.. 我怕回家在家人面前哭"

她: "你既然把跟我的相處看成負擔, 那我還是不成為你的負擔吧... 希望你記住曾經有個唯一的女朋友為你流淚, 有個天天牽掛你而被你忽略的人"

這時, 他再不想說些什麼... 只想一直的哭下去... 他心中只知道... 原來... 喜歡一個人跟愛一個人是不一樣的. 他很愛她, 但卻怕負了她, 只想她找到比他更好的.

過了很久很久.... 他知道她在街上... 又很久沒消息... 又再擔心起來.

他 (帶著冷淡的語氣) : "到家了沒有, 到家給我發個短訊就好了"

她: "我放不下, 我的心很痛"
她: "你不可以不要我的.. 你曾說過, 要照顧我一生. 以前是, 以後也是. 不要對我說那麼狠心的話"

他: "在那啦?? 還沒回去嗎? 找你的姪子玩吧.. 不要一個人在街"

她: "我怕在家人面前哭. 我很沒用的, 常常哭"

他更擔心了... 只好來個小計...

他: "我的乖乖, 聽話快回家, 回家再說吧"
他: "快回家, 你不回去, 我就不理你, 回家網上談吧.."

她: "我聽話, 不要不理我, 我回家"

他: "好啦, 我在網上等你"

他本來只是想騙她先回家... 他便可安心一點...
他為了這段可挽留而怕最後卻害傷她的感情, 掙扎了一整天..
最後... 他仍留在網上等她的出現...

他: "笨蛋, 有沒有哭到眼晴累累的?"

她: "其實一直在想, 為什麼我們兩個都是一遇到困難, 首先想到的是放棄? 曾經還說過的, 不要輕易放棄的說"

他知道她到家了.. 還是只想快一點靜下來想想...

他: "我的眼睛哭得快睜不開了. 早點休息, 明天靜下來再談好嗎"

她: "可是睡不著, 現在談吧"

他: "不要, 明天談吧"

... 兩個人一直的爭了幾句... 最後他下線了.
過了一會... 她又發短訊了...

她: "你睡覺了嗎? 是不是眼睛痛得不想對著電腦? 還是為了讓我徹底死心? 其實我是早上才看到你的短信. 從看到短信起就一直在流淚, 但是開始一直忍著、克制著, 所以給你發了電郵. 但是之後實在忍不住了"

她: "給我點勇氣, 讓我安心吧"

他仍沒睡, 卻想裝睡下去...

她: "我看了以前你給我發的短信. 我好難受, 我知道你沒有睡著, 可是你不要不理我"
她: "幾天前, 你還說了要學會做我的好老公的..."

他開始心動 ... 但卻仍堅持著.

她: "我很沒用, 說了讓你睡, 可是我真的很難受. 為什麼我們要相互折磨對方呢?"

過了又一會...

她: "我又一遍看了你和我的blog. 護身符其實很有用, 因為它不但讓我沒怎麼生病, 還讓我愛上了你. 可是不知道護身符會不會繼續保護我, 因為他就是你. 我不想讓護身符離開" (那個護身符應該算是他們的訂情信物吧....)

他堅持不了...

他: "嘈死啦 明天才說吧"
他: "親愛的~ 樣親愛的睡吧~"

她: "同樣的一句話, 怎麼換種方式說, 聽起來就感覺完全不一樣啦. 聽了第一句話, 我完全崩潰. 聽了第二句話, 我想抱著你親一口. 好啦, 親愛的不吵親愛的了. 可是親愛的明天不要放棄親愛的, 有什麼苦, 有什麼問題, 我都願意和你一起承擔的. 我不想輕易放棄你, 你也不要我"

就這樣... 過了第一天. 他其實還沒下決定... 因為.. 他想靜靜的想.. 想一想, 是否去修補這段感情...

第2天:

她跟他說了很多很多, 但他卻只想靜下來, 只好一時冷淡的回應, 又一時關心的問候...

到了深夜...

他: "你在睡吧.. 其實, 我不想樣你傷心. 我知道最近你受了很多苦, 可是我沒好好關心你... 其實我沒想過我們將來怎樣, 太多不明因素啦. 只是想問你, 將來你又需要我關心的時候, 我又卻忽略你, 我又沒關心你, 你會怎樣想呢"

她: "其實我在意的, 是最終你願意跟我過嗎?"

他給了她一個很失望的答案.

他: "這麼短時間就可以肯定嗎? 可以樣我們再認識多一點才回答嗎?"

她: "那不急著回答吧. 那我們接下來的時間, 先不考慮這些吧. 順其自然吧讓時間來回答吧"

第3天:

她在Blog 裡留了一封信給他....

如果你覺得認定了我,那你跟我說下,如果現在沒認定,可以到你認定的那天,再告訴我。如果你現在沒認定我,或者將來也沒認定我,那請你永遠不要跟我講,就讓時間去平息這一切吧。因為我不知道我還有沒有承受力去承受這一答案。

感情不是遊戲,不是一句簡單的話,我們開始吧,我們結束吧,就開始了,就結束了。一個真正負責任的人不會輕易的去開始,也不會輕易的去結束,除非到了不得不開始的時候,除非到了無法挽回不得不結束的時候,因為這都將影響人的一輩子。開始的時候請多思考些問題,不是一句簡單的是個錯誤的開始,我們結束吧,就結束了。因為以後也許這些簡單的幾句話,就會結束一個美麗的生命,即使你不為之感到惋惜,我相信在你一輩子的生活裡也會留下陰影。所以請從一開始就做個負責任的人吧,而不是太多的我還不成熟之類的話。... 既然開始了,即使是個錯誤,但也是一個不同尋常的錯誤,因此不能像解決其他錯誤一樣-既然是錯誤就結束這個錯誤吧。其實這些都是不負責任的做法,是在逃避。這些都是說起來簡單,做起來很難。

...

最後祝你事業上輝煌,我相信以你現在的事業心態肯定可以實現你的事業夢想!同時祝你感情美滿,請不要無心地傷害下一個愛你的女孩。認定她之後再去追,認定她之後,選擇了開始,就不要輕易跟她說--選擇放棄吧。

請不要跟我說--我負了你之類的話,傷害了一個人,說這些話只會讓她更傷害,讓時間去平息這一切吧!
結果 .... 他說了一句: "對不起, 我們重新開始, 好嗎?"


Friday, May 08, 2009

Oracle FAQ for Sun Acquisition...

The faq can be found here

Just wondering ... is the purpose of Greening an economic consideration or a sustainability consideration??

What's the "1st cause" of Greening??

This is not just a green issue, it’s an economic issue. Today, database centers are paying as much for electricity to run their computers as they pay to buy their computers.

or ... it's just a win-win situation and so the 1st cause can be ignored??

Thursday, May 07, 2009

some words from Larry... @ Michigan 2009

Google's co-founder just gave a commencement address @ Michigan...

I won't compare it with Steve's  but I can say both of them are ambitious!

I very like two sentences which I quote here....

You know what it's like to wake up in the middle of the night with a vivid dream? And you know how, if you don't have a pencil and pad by the bed to write it down, it will be completely gone the next morning?

Just like me, your families brought you here, and you brought them here. Please keep them close and remember: they are what really matters in life.
For the 1st sentence, I was thinking whether he's making a joke at the very beginning... But, when he elaborate further .... There's actually meaning in it. What's that mean??? Another sentence from him can explain "When a really great dream shows up, grab it!".

That's true ... That's always true! A dream will be completely gone in the next morning !!

I have my dream ... I know it is not a crazy dream at the moment... But... I'll make it crazy someday later.

On the other hand, the 2nd sentence remind me to do more with my family.. Frankly speaking... I know i'm not doing so well with my family... My brother is doing much more than me ... I should learn from him to do better with my family =] (i'm not doing bad to my family anyway^^")

Saturday, May 02, 2009

一句讓我刻骨鉻心的說話

不要以為就你的時間很寶貴,別人都是閒人. 別人也是抽時間跟你聊,為什麼就在別人好心好意跟你聊時,你心不在焉? 有這種那種忙的理由? 好像你是神人,可以一心幾種,心在玩,然後這邊敷衍幾句.

my blog ... a New Look =]

Just changed the template here =]

Having a clear looking now ~~ yeah~~~ i'm loving it :p

Template from http://btemplates.com/2009/04/15/greenpress/  ~~ Many thx for the beauty work~~~~

Cool!!!
 
© 2009 Emptiness Blogging. All Rights Reserved | Powered by Blogger
Design by psdvibe | Bloggerized By LawnyDesignz