Showing posts with label gsoc. Show all posts
Showing posts with label gsoc. Show all posts

Monday, October 12, 2009

gsoc t-shirt 之到來




Thursday, August 13, 2009

my gsoc2009 @ August 13

I just issued my "last" gsoc status report to the php ml =]



Even so... i'm still going to work on it as leisure :p The next target ... Implementing a WYSIWYG doc-editor!

Wednesday, July 29, 2009

my gsoc2009 @ July 29

Thanks to php-manual, I can generate mod_auth_digest MD5 hash nicely =]

The hash is highlighted below ~


So, what I'm doing to simulate a "cvs-login" on subversion is to fire a MKACTIVITY request to the server. (this is documented in the protocol that most "write" operations first fire it before any other operation).

This MKACTIVITY request will be responded with HTTP-401 Authorization Required =]

Then, I use the info from the HTTP-401 and generate a valid hash of it.... Fire back another MKACTIVITY request with Authorization header.

If... server still reply me with HTTP-401... then the user-password is not valid to the server.
If... server reply me with the superb HTTP-201... That's valid user-password pair.

The whole stuff like this ...


p.s. ... invalid credential give me an apache-error on my own repository ...
[Wed Jul 29 17:20:41 2009] [error] [client 144.214.121.111] Digest: user kschan: password mismatch: /svn/acm/!svn/act/67764a9e-5629-6c72-d9fc-6205068e0a1a

Tuesday, July 28, 2009

my gsoc2009 @ July 28

SVN is good for source control "only".

Why I'm saying so ^^? Read the story...

The story is simple....

In doc-editor, user won't need to register in which doc-editor will check for cvs-credential automatically. As cvs2svn migration complete, I need to adopt svn for doc-editor. So, the very first thing is that I need to understand how svn authenticate!!

Just before my study ... I just know ... svn uses Apache and Http... That's ALL! So, I googled ... "subversion http protocol" and failed. Then, I read subversion *documents* slowly and know that it's using webdav. So, I googled "subversion webdav protocol"... Yes! It give me this!

Therefore, I make my first trail with php-webdav-extension from here...

The codes are simple as shown here ~.~ It fires a webdav-put request and so the authentication stuff are sent to server.


Even it worked... but ... drawbacks come.... no matter what, Apache give me error log as the webdav request is not valid to mod_dav_svn.


Thus, I think I better seek advice from mentor =] And mentor just said, if we're going to use php-extension, we better use the official ... However, the official svn package is somehow like the native svn-client in which the authentication is fired when some operations ask for that... That's to say... it's not much different that I use exec('svn ci') =.=" So, it's much better to do it raw!

To do it raw... I need to understand how's the webdav protocol actually works out ... That's pretty difficult (I should say it's evil honestly =.=) I tried to seek help from freenode-irc #svn but not much help ... So I googled to see how can I trace a http-request and response....

The answer is .... strace!



As fas as I know from the strace ... Apache may be using mod_auth_digest for authentication ... Therefore ... i'm going to study how it works now ... so that i can MD5 the "password" for the authorization header.

( another hard task for me -.-" but that's quite enjoyable =] )

Friday, July 24, 2009

my gsoc2009 @ July 24

php svn-migration is complete and that's time to commit changes :p (excuse for my laziness)

the project is now on http://svn.php.net/viewvc/web/doc-editor/trunk/

You may have a look into the dirty codes by "svn co http://svn.php.net/repository/web/doc-editor/trunk doc-editor"

What I've done thus far from the last commit is that I factored the php files from the ground to the top. The single pain-long (yup, pain-long not plain-long as that's really painful!) class.php is now separated into dozen of files in which each of them groups related functions. The groupings are now written on http://wiki.php.net/gsoc/2009/phdoe#factored_php_classes

Let's have a sneak preview :p


Anyway, what are other excuses of a late commit ^^?

The trouble was that .... i failed to commit the codes .... OMG... What a pity?
The case was that ... when i did svn ci, server responded me ..

svn: Commit failed (details follow):
svn: At least one property change failed; repository is unchanged
svn: Server sent unexpected return value (400 Bad Request) in response to PROPPATCH request


err.... what can I do? Of course.... shout SOS!


And, I got a hand from the mailing list and lovely Apache told me ...

[Wed Jul 22 02:29:46 2009] [error] [client (screened)] Could not fetch resource information. [301, #0]
[Wed Jul 22 02:29:46 2009] [error] [client (screened)] Requests for a collection must have a trailing slash on the URI. [301, #0]




So ... the last resort is Goooooogle!

With a day or two of searching and guessing ... I came to this... The archived mail told me that ... perhaps my network proxy did something naughty to my svn ci .... ( :[ damn hidden proxy? )

The solution is this... i bring the patch back to my home with no hidden proxy ... and committed =]

p.s. Have a footnote here... I'm brainstorming further refactor the project ... see http://wiki.php.net/gsoc/2009/phdoe#brainstorming_idea

Tuesday, July 07, 2009

my gsoc2009 @ July 07

When I read the gsoc timeline, I was expected to submit a "mid-term evaluation" that I thought it's a written report. But... finally, it turns out that it's a MC-alike survey ^^ My Life Is MUCH EASIER!!



Anyway, there are still 2 big empty boxes to fill in texxxxxxxxxxxxxxxxxt :( I'm not feeling comfortable with it as the boxes are at the bottom of the MCs :p (quite disappoint me that I need to think of something to fill the boxes :p)



By the way, I got a good news and bad news from the php mailing list ... Good news is that php is going to use SVN. Bad news is that doc-editor is CVS-dependent. That's to say I need to twist the code and adopt the migration ^^"

Friday, July 03, 2009

my gsoc2009 @ July 03

=] The first milestone is reached!

The clearance of js namespace has been completed and ui-components resulted.



main.js keeps several things in its namespace and a clear layout in the source.



The next milestone is to cleanup the PHPs as listed in the todo.



Currently, a single ExtJsController.php dispatches corresponding handler for particular request. This will be kept but the handler structure will be changed as the handlers are all messed up in class.php. My plan is like this... first groups those related handlers (some are listed in todo), then try to build a hierarchy if there's any. Hope this can be finished before mid of July =]

Sunday, June 21, 2009

my gsoc2009 @ June 21

It's a GDay =] Several bugs are KIA... AND, only several miles away from the destination =]

main.js is now 18xx lines (which is 23% of the original main.js)

There are totally 22 ui-components that builds up the doc-editor ui while there are 8 ui-task wrappers work for the user.

if you read my previous report back to 2 weeks ago, i have refactored and tested 4xxx lines js in this two weeks :p indeed ... these 4xxx lines are 70-80% alike but different context in use.

anyway ... if you read my proposed timeline .... i'm still behind schedule :p even so ... the proposed one is actually different from the acting one :p Thus! this week ... i will use the time for "merging and testing" to refactor and test out the rest of main.js.

Thursday, June 11, 2009

my gsoc2009 @ June 11

As doc-editor has many sub-components open a code-mirror editor.. i'm trying to make the editor becomes a reusable ui component.

Today ... i'm working on that and trying to allows two editor to synchronize their scroll bar...

BUT... problemsssssssssssssssssssssssssssss :)

Let's consider this!
Editor-A scroll for 40px from top
Editor-A's scroll listener catch the event and ask Editor-B to scroll to 40px from top
Editor-B scroll for 40px from top
Editor-B's scroll listener catch the event and ask Editor-A to scroll to 40px from top
Editor-A scroll for 40px from top
:
:
:
who scroll NEXT?

in Chrome ... the logic seems working.... but in Firefox ... the logic breaks.

To handle this.... I added a "scroll-lock" to the editors :] (just a conventional solution to handle synchronization problem)

New logic follows....

Editor-A scroll for 40px from top
Editor-A listener gains lock as Editor-B is not scrolling
Editor-B scroll for 40px from top asked by Editor-A listener
Editor-B listener cannot gain lock as Editor-A gained
Editor-B listener gives up asking Editor-A to scroll and force Editor-A to release the lock

So... scrolling won't be propagated
if Editor-A/Editor-B scroll again, lock can be gained and logic applies

Sync is FUNNY XD

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~

Tuesday, April 21, 2009

GSOC RESULT

Monday, April 06, 2009

gsoc .. 兩年前、一年前、今年的想法

Google Summer Of Code ... 是我在兩年前認識的一個 program. 當我第一次接觸它的時間, 它已經 deadline 了.

自此, 小弟不斷的留意與 GSOC 有關的消息. 直至一年前, GSOC 2008 的舉辦... 小弟心動了... 只可惜... 因為要到某銀行實習, 給了自己一個藉口, 繼而卻步於門前. 那一年... 小弟雖未能參與其中... 但亦在歐遊的期間, 參與了 Google Code Jam (GCJ). 由於未有準備 + 人在歐遊 , 結果很自然連第一round 都過不了.

這一年, GSOC 2009 舉辦了, 起初未有心動. 後來, 得到一位朋友的問題: "有沒有興趣參加這一年的 GSOC ?" 小弟對 GSOC 的情意結又一次的被觸動了.

事實上... 小弟這一年是 undergrad 的最後一年... 假如讀不上 mphil, 就是最後一年的學生生涯. 換句話說, 很大可能是最後一個參與 GSOC 的機會. 坦白說, 就算有多忙, 也要花時間參與.. 無論成功與否... 就像馬雲所說: "放弃才是最大的失败". (那麼... 不成功便成仁麼!? XD)

April 20 19:00 UTC 便是結果公報的時間, 靜候 ...

Anyway ... i will go for GCJ this year ~~~

Thursday, April 02, 2009

my gsoc proposal submitted to php.net


Proposal: Online editor for the PHP Manual ... http://wiki.php.net/gsoc/2009#online_editor_for_the_php_manual

Currently, the documentation work is synchronized by cvs. But still, there are potential conflicts due to redundant work. Besides, it's not that easy to share the works or even pipelining the works in a distributed environment. Therefore, a centralized environment is introduced. 

The editor is still under development and the source can be found by http://cvs.php.net/viewvc.cgi/doc-editor/ 


Short Description: In order to ease the work of PHP Documentation Group, work on Online Editor for PHP Manual has already started by Yannick... The Online Editor mimicks an offline PHP documentation environment by using ExtJS as ide alike ui and providing xml-editor with CodeMirror syntax highlighting. The documentation group can make changes online, DocBook syntax check, CVS Log/Diff/Commit, patch review list, etc.


Full Description:

PhD OE allows PHP Documentation Group to carry documentation right ahead through the browser instead of using cvs to synchronize their local copy. There is ide alike ui on PhD OE so that the doc-group can directly edit the PHP DocBook xml online. Despite, PhD OE also eases the collaboration in an open documentation environment. Doc-group can share the workloads easily since they no longer need to pass the local modified copies around but on PhD OE. In addition to this, PhD OE does allow community contributor to submit patch so that the doc-group can review the patch in a centralized location like an issue list.

To find out the implemented features of PhD OE, visit following posts on mailing list:

Currently, there are some opening issues on the TODO list (found by - http://cvs.php.net/viewvc.cgi/doc-editor/TODO?revision=1.5&view=markup). One of the major task is to "Split main.js into several objects & files" because of the coding readability, continunity, and scaliability. main.js contains ui of PhD OE. There are 6922 lines of code in revision 1.21. It is obvious that maintaining such a large piece of codes is tidous and not that good. Thus, this proposal describe how to split the main.js and merge the js for deployment.

Right before talking about the split, let's see how to merge. ExtJS ant script make use of YUI compressor. So, there's no doublt that YUI compressor is a good choice to merge js in this project as the ui depends on ExtJS. Anyway, moving back to the split, main.js can be split based on module. I suggest Java alike model using 1 module 1 class 1 js. This is the practice I used in my own ExtJS project. Nevertheless the split is time consuming, the effort spent on this kind of refactoring allows me to better understand how the ui works and improve the structure. The proposed approach follows.

  1. Fork a branch to work on refactoring. The trunk keeps on development
  2. Refactor and Test the branch... Testing is important here! No failure should be induced by refactoring.
  3. Merge the modified trunk to the refactored branch.
  4. Freeze trunk, test the merge.
  5. Done.

Another task is to "Clean up class.php". Again, a refactoring task. class.php is the "bootstrap" residing on the apache server ... with 4075 lines of code in revision 1.21. As written in the TODO list, initial ideas for refactoring already exist.  It would be splited into several smaller classes that are quite relatively independent to each other. The proposed appraoch would be somehow the same as refactoring main.js. Fork, Refactor & Test, Merge, Freeze & Test, complete!

Thirdly, according to the TODO list again... the mod_rewrite task is another "better to have first". It makes the codes look much better to understand. This task is pretty strict forward. Design the pattern, write the regular expression on apache conf (.htaccess could be the choice). And then, reflects the changes in both php and js. It's totally different from refactoring, no forking and no code freezing.

Finally, if there's still plenty of time, I would like to propose that the modified but not-yet-saved file should have a lock or google-doc alike collaborative editing. When someone is editing a file with file-based locking, others cannot edit it at the same time before the file is commited (lock released). This reduce the chance of having conflict in modification. If collaborative editing is considered, high level DocBook xml-tag locking can be considered. This means ... partly locking the file so that anyone can edit different parts of the same file. When conflict occur, notify the editors. This would be another busy task.


Timeline:

Community Bonding Period - Study current PhD OE architecture. Confirm refactoring procedures and exact deliverables with mentor.

May 23 ~ June 20 [around 4 man week] - Refactor & Test main.js

June 20 ~ June 27 [around 1 man week] - Merge Refactored code with trunk + Testing + Documentation

June 27 ~ July 4 - [around 1 man week] - Compile interim report

July 4 ~ July 18 [around to 3 man week] - Refactor & Test class.php

July 18 ~ July 25 [around 1 man week] - Merge Refactored code with trunk + Testing + Documentation

July 25 ~ August 15 [around 3 man week] - Implement mod_rewrite, reflect changes in php and js + Testing + Documentation

August 15 onwards - Compiling final report


Category (PHP, PELC, PEAR, other): PHP Manual

Tuesday, March 04, 2008

Struggling??

Google SOC 2008 is announced ... http://googleblog.blogspot.com/2008/03/summer-of-code-is-back.html

What can I do?? What should I do??

Should I quit placement for this?? Or should I forget about tour??

Things happen at the same time ... ALWAYS!!

Can I, Could I, or Would I??

Is stability really better than variety and fluctuation?

Why I only get 24 hours a day?

this 2 weeks were the most disappointing weeks . . .
 
© 2009 Emptiness Blogging. All Rights Reserved | Powered by Blogger
Design by psdvibe | Bloggerized By LawnyDesignz