2009年11月26日 星期四

Git 簡記

Standard
在團隊的多人協同作業時,版本控制系統是很重要的工具,除了要將大家的工作成果彙整起來之外,還要確保歷史記錄不遺失,讓日後的追朔工作有跡可尋。早期的 CVS 到後來的 Subversion(SVN) 都是屬於這類的版本控制系統。不過對於堪稱世界上最大最多人協作的 Linux Kernel Project,CVS 與 SVN 顯然像的玩具,根本不敷使用。而其他商業的版本控制系統,也多少有些缺點,這也是為什麼 Linux 之父『 Linus Torvalds 』要下海親自打造一套新的版本控制系統『Git』。既然 Git 能勝任於這世界上最大的專案,說它是下一世代的版本控制系統,應該一點也不為過。

這樣的一個強大的工具,讓很多人都躍躍欲試,但也因為太過強大,網路上長篇大論的文章也讓許多人不敢恭維,有殺雞焉用牛刀之感。回頭想想,若是連如同 CVS/SVN 上的基本功能都無法輕易上手,講再多 Git 的特異功能也是枉然,套句 Torvalds 的經典名句:『full of bullshit』,一切都是廢話和放屁!(筆者真的懂每次都聽到一堆所謂的分散式架構等等優點,但還是不知道要怎麼開始用,是多麼令人覺得自己是 git!亦或者是文件撰寫者是 git?)

從人本考量,我們需要版本控制系統,最初就是要能上傳和提交 source code,使之能放在 Server 上保存。此 Server 可以放在遠端,也可以是自己電腦上,要嘗試架一個在本地端(沒有提供外部連入功能)的 GIT Server 相當容易,裝好相關套件之後,指定一個 Source code 的保存目錄就好:

Server 端的設定:
# 建立一個新目錄,用來放 example project 的程式碼
mkdir example.git
cd example.git
#  初始化此目錄為 Git 儲存庫
git --bare init

到此,Server 的設定已經完成,新的 example project 儲存庫也已經建立,若是有需要,日後也可以加上 SSH/HTTP 等連線支援,讓外部使用者可以遠端存取此 Git server。

有了 Server 之後,通常真正在做開發工作的,是在客戶端(Client),我們通常會從 Server 上取得一份完整的副本程式碼回家修改,完成工作後再提交回 Git server。在提交之前我們必需先設定自己的一些資料,以便他人知道是誰提交了程式碼。

Client 端的設定:
# 設定提交者的姓名和電子郵件信箱
git config --global user.name "Fred Chien"
git config --global user.email "fred@ullab.org"


Client 端的本地工作區建立(從 Server 取回所有程式碼):
# 建立一個乾淨的目錄
mkdir git
cd git
# 初始化並從 Git Server 取回程式碼
git clone /home/fred/example.git

Client 端修改好後提交回 Server:
# 提交所有程式碼修改和加上說明描述
git commit -a -m "說明描述"
# 將所有提交內容上傳至 Git server
git push

Client 端從 Server 下載並更新本地工作區的程式碼:
git pull

Client 端新增文件並提交和上傳至 Server:
git add example.c
git commit -a -m "Add a example.c"
git push

瀏覽所有開發記錄:
git log

後記

一直以來有很多人都來詢問 Git 的用法,網路上的相關文件也似乎都太過『完整』,因此整理了一下筆者過去的私人小筆記,用比較簡單的方式說明如何使用 Git,且避免和省略了許多令初學者摸不著頭緒的部份,如:分散式、離線作業、Branch、Merge 等等。

2009年11月25日 星期三

Our Happy Travel for GNOME Summit in Vietnam

Standard
This is first time that we(ULLab guys) make speeches at international event oversea, so we're so exciting on this travel.


Core Founders of ULLAB

Before this travel, in fact that I didn't know anything about Vietnam. I was just under the impression that Vietnam is a highly unstable country in Asia as well as this place is uncomfortable for us. Everyone all over the world always talks about the war and the girls in a bad way when mention Vietnam, so we never get a good impression about this place. However I must acknowledge that I was wrong now, Vietnam is a good place for enjoying our life absolutely, and also there are many people try to be surviving and becoming better in the world. Actually, many students in there have lifelong ambition, it shames me who is a Taiwanese.


When we arrived Vietnam, the first thing which is traffic made us crazy. The traffic in Vietnam was scaring me, I never see so many motorbikes all over the road. My new friends who are local people in there told me that most people choice to ride , because they doesn't have enough money to buy a car. The crazy traffic looks so dangerous, you never know when cars and motorbikes in front will turn to other direction. Sometimes we could see there are some cars and people to force to cross over crowd of cars, but it is magical that no accident happened.

In fact there is similar to Taiwan except traffic, we often consider we're standing on the road in south of Taiwan.


For us, the biggest problem is communication. Due to most people do not speak English, it's difficult to do anything something's like taking a taxi, ordering foods and buying something. Fortunately, Volunteers of GNOME Summit help us so much, they are a good tour guide and translator to let us survive in Vietnam. If no those guys, we will get a big trouble I think.

When I was in Taiwan, I often heard that someone said people in Vietnam is not friendly. After this travel, I don't think so. The truth is there are so many good guys, everything is comfortable for us. We met many new friends in there and exchanged the Facebook and email accounts with each other as well.



Besides, I think foods in Vietnam is really good excepts uncooked vegetable. Though I like Salad, many uncooked kinds of vegetable in Vietnam I don't like. Because tastes of vegetables is very strong and strange, we cannot adopt that actually.

This travel we also met a lot foreign people, we had discussions, drinks and fun together. Sometimes we drunk and used English all night cause that when we were back to hotel, three Taiwanese people were still speaking in English for discussing rather than Chinese. So we get a conclusion that if you want to speak English without thinking, you must drink a lot beers to have a fun!

This is a cool travel I think. I heard some informations about the GNOME.Asia Summit will take place in Taiwan next year. If it is truth, we can meet up again in Taiwan next time. I am looking forward to see you guys very much! :-)

2009年11月12日 星期四

GNOME.Asia Summit 2009 is coming

Standard

GNOME.Asia summit 2009 is one of the top Free and Open Source Software (FOSS) events for developers, enterprises, officials and general users in Vietnam. The event brings together FOSS projects from Asia and around the world. More than 500 participants from 10 countries are expected to participate in the summit, which is the first international community event of its kind in Vietnam. It takes place from Nov. 20-22, 2009, in Ho Chi Minh City.

As a LXDE Developer, I just got invitation from GNOME.Asia committee last month. They expects that LXDE Team can give a talk to introduce and explain LXDE Development. Actually, we are so glad to have a session to talk about LXDE, especially  it can talk at GNOME event. It means we will have an opportunity to discuss with GNOME developer, users and contributor face to face rather than do anything behind closed doors.

Eventually Andrew Lee, Penk and me will attend GNOME.Asia 2009 in spite of there are a lot of factors make us hard to decide whether to go or not in the beginning. Andrew Lee will talk about libfm(a new library implementation for File Manager as well as it is a core of PCManFM2 which is next generation of File Manager of LXDE) and preside at LXDE BOF in first day. Penk will present his own project xPUD which is a small and special distribution to be suitable with netbook of this kind. About me, my topic is "LXDE Development Strategy" to explain how LXDE to work and how to improve  desktop environment performance. If time is enough, I will introduce a little bit LXDE new components, talk about current status and roadmap.

By the way, I think this travel will be so exciting for us, and also this is my first time to Vietnam. Good Luck to us!

2009年11月8日 星期日

Mandice Installer 嘗鮮預覽

Standard
感謝各界的關注和幫忙,最近『Mandice』頗有進展,繼『Mandice Repository』Server 啟動之後,現在安裝程式也總算有個雛形樣貌,廢話就不必多言,直接來看一下 Video:



大體來說,這是在開發 MTK(Mandice Toolkits)時的副產品,在做測試時順便打造出來的安裝程式,不過目前還在測試階段,仍有不少地方需要改進。

PS. 這不是 Mandice 廣告宣傳片!

2009年11月1日 星期日

Clutter Rotation 的惡行

Standard
由於之前已經寫過太多雜文說明,『Clutter Toolkit』的威力應該就不必要再多說。雖然說 Clutter 開發上很容易,但在真正開始開發程式後,就會發現有很多地方細節需要注意。

關於開發 Clutter 程式時,會碰到的大部份問題,都出在於其設計邏輯與其他 3D Engine 不同,而最不一樣的地方,就是演員制度。Clutter Toolkit 特別的演員制度邏輯,使開發者將不再以大場景和 3D 空間定位為考量重點,而是以一個個 Actor 的角度去實作一切行為。因此,通常開發者第一個會碰到的行為就是『向左走、向右走』,單單使 Actor 旋轉到我們要的角度,就會碰到些問題。

ClutterActor 定義了一系列 function 去實作各種行為,其中旋轉的部份:

clutter_actor_set_rotation(ClutterActor *self,
                                        ClutterRotateAxis axis,
                                        gdouble angle,
                                        gfloat x,
                                        gfloat y,
                                        gfloat z);

clutter_actor_get_rotation(ClutterActor *self,
                                        ClutterRotateAxis axis,
                                        gfloat *x,
                                        gfloat *y,
                                        gfloat *z);

關於 rotation 的 angle,其範圍在 0 至 360 度之間,若設定超出角度範圍,會有 Warning 出現,有些時候雖然仍可正常執行,但會有無法預期的錯誤行為發生。而有個小問題出在於 clutter_actor_get_rotation() 的回傳值,其回傳值將有可能為負數,並不是在 0 至 360 之間,若是直接將回傳值代入 clutter_actor_set_rotation(),將會出現錯誤。

這代表要是你的 Actor 現在已經轉了 315 度,用 clutter_actor_get_rotation() 取回的數值將可能是 -45。此時,要先算出正數的角度,才能再代回 clutter_actor_set_rotation() 使用。