Wednesday, October 07, 2009

My Game Programming Class(With TheFly Engine) environment setting

Class Note:

Require:
  • Visual Studio 2005 with sp1
  • Windows
  • TheFly engine

Step:
  1. Download DirectX 9.0c SDK
  2. Install .
  3. Extract TheFly.rar somewhere
  4. Open the sample of thefly engine.
  5. setting "DirectX include files and lib files" into you project or IDE's environment
    • 環境: 工具->選項->專案和方案->VC++目錄
    • 調整顯示目錄來設定
  6. Add thefly include and lib. same action as step 5
  7. Compile and Run!
  8. Maybe you have to copy the "Date" folder to the project's root floder. Then you can see the teeport(Optional)

Friday, October 02, 2009

My OpenGL develop environment

Note for my ICG class homework.

Step:
1. Download and install Microsoft Visual 2005 (not express version, it include glu.dll and gl.dll)
2. glut-3.7.6
You can get it from glut website.
3. Put glut.dll(extract dll from glut-3.7.6-bin.zip) into [System disk]:/windows/system32
4. That's all.

Friday, September 04, 2009

printf long long

note:

在windows下印long long
使用 %I64d

在linux下印long long
使用 %lld

Thursday, September 03, 2009

Google Code Jam 2009

第一次參加Google Code Jam (下簡稱GCJ)

1.老實說實力上還是不大夠(應該說是把想法化為程式的能力),有幾題是挺快就想到的,但是寫程式卻比我想像中的花時間

2.要小心失神打錯字XD,所有的錯誤嘗試都是因為這個原因

3.挑戰big的時候應該要考慮algorithm,這次第3題衝太快,little很快就解出,但是big就跑到死

4.第一名的真的是妖怪

5.其實蠻好玩的,明年還要參加XDDD


待補充

Saturday, August 29, 2009

firefox 3.0 + kubuntu 9.04 + flash no sound

Browser: Firefox 3.0.6
OS: Kubuntu 9.04
Sound Card: KECES DA-151 MK2 (PCM 2702 / USB Audio)


網路盛傳的方法:

因為我看到/etc/firefox-3.0/也存在,所以我兩個資料夾都有試試看

install alsa-oss
edit: /etc/firefox/firefoxrc
add: FIREFOX_DSP="aoss"

或是

edit: /etc/firefox/firefoxrc
add: FIREFOX_DSP="auto"

edit: /etc/firefox/firefoxrc
add: FIREFOX_DSP="none"


結果:無效


後來我參考了

HOWTO make one soundcard default


設定usb音效卡為預設值,但是其實我在沒重開機之前也有拿耳機測試主機板上的內建音效卡,一樣是沒有聲音,所以對於這方法存疑,等我重開機再試試看吧

結果:失敗再加一枚

Thursday, August 27, 2009

mediaWiki 設定 wgLogo

在[wiki root]/LocalSetting.php加入
$wgLogo = "[your image]";
即可

另外開放圖片上傳也是在這裡

$wgEnableUploads = false
改成
$wgEnableUploads = true即可

Sunday, August 23, 2009

Miranda method

再看Dalvik source code的時候遇到的東西,可惜我沒有找到中文資料,所以就不要臉的自己亂翻譯了一下了

From sun/tools/java/ClassDefinition.java


// In early VM's there was a bug -- the VM didn't walk the interfaces
// of a class looking for a method, they only walked the superclass
// chain. This meant that abstract methods defined only in interfaces
// were not being found. To fix this bug, a counter-bug was introduced
// in the compiler -- the so-called Miranda methods. If a class
// does not provide a definition for an abstract method in one of
// its interfaces then the compiler inserts one in the class artificially.
// That way the VM didn't have to bother looking at the interfaces.
//
// This is a problem. Miranda methods are not part of the specification.
// But they continue to be inserted so that old VM's can run new code.
// Someday, when the old VM's are gone, perhaps classes can be compiled
// without Miranda methods. Towards this end, the compiler has a
// flag, -nomiranda, which can turn off the creation of these methods.
// Eventually that behavior should become the default.
//
// Why are they called Miranda methods? Well the sentence "If the
// class is not able to provide a method, then one will be provided
// by the compiler" is very similar to the sentence "If you cannot
// afford an attorney, one will be provided by the court," -- one
// of the so-called "Miranda" rights in the United States.

/**
* Add a list of methods to this class as miranda methods. This
* gets overridden with a meaningful implementation in SourceClass.
* BinaryClass should not need to do anything -- it should already
* have its miranda methods and, if it doesn't, then that doesn't
* affect our compilation.
*/


懶人用中文版(翻得不好,請多見諒)




早期的VM有個BUG,VM不會去class的interfaces尋找method,VM只會往superclass chain尋找,也就是說只在interface中的abstract methods的定義是找不到的,為了修補這個bug,有一個利用compiler修補的方法就推出了。

也就是所謂Miranda method。 如果一個class沒有為一個interfaces中的 abstract method提供定義,則compiler會插入一個人工的class。VM就不需要為了在interface尋找定義煩惱

但是這也是有一個問題,Miranda methods並不存在規格中,但是這方法持續的使用,使得舊的VM可以繼續跑新的程式碼,某一天,等舊的VM不用,或許就不需要Miranda methods,為了結束這一切,compiler有了一個新的flag -nomiranda,可以關掉產生這些(Miranda)method,通常也是預設行為。

為什麼會叫Miranda methods? 是因為有一句話說:「如果一個class沒有提供一個method,則compiler會提供一個(method)。」 和「如果你沒有辦法請一個律師,則會法院會提供一個。」非常相似,也是就是在美國所謂的「Miranda」權力

加入一系列的miranda methods。這些method應該在SourceClass被有意義的overridden,BinaryClass不應該做任何事,他應該已經有他的miranda methods,如果他沒有,那他不會影響我們編輯。

Modified by Blogger Tutorial

JimmsHsieh Blog ©Template Nice Blue. Modified by Indian Monsters. Original created by http://ourblogtemplates.com Blogger Styles

TOP