June 25, 2015

Gradle command line


From here

gradlew help
gradlew tasks
 

Convert newline format on Mac

perl -pe 's/\r\n|\n|\r/\r\n/g' inputfile > outputfile  # Convert to DOS
perl -pe 's/\r\n|\n|\r/\n/g'   inputfile > outputfile  # Convert to UNIX
From this post

June 10, 2015

Unity building problem for Windows Phone

在使用 Unity 輸出 Windows Phone 專案的時候遇到幾個類似於下面的錯誤
Currently there will be errors like the following when building Windows Phone project in Unity.

method `System.Int32 System.String::Compare(System.String,System.String,System.Boolean)` doesn't exist in target framework.
因為 Windows Phone 提供的 API 並不完整,遇到這種錯誤的時候解法有幾個
The reason is that some of the .NET API are not provided by Windows Phone. The solutions for the error are:
  1. 改寫程式,拿掉那些沒有提供的 API,改用其他有提供的 API 達到一樣的功能
    Rewrite the code to remove those un-supported API and use other supported API instead.
  2. 一樣改寫程式,實作那些沒有提供的 API ,編譯出 DLL 檔放進 Unity Project
    Implement those un-supported API, compile as DLL and put it in the Unity Project. Use the DLL functions instead.
目前遇到兩個有問題的是 String.Compare(String, String, Boolean)List.ConvertAll,都使用方法一解決。Windows Phone API 提供了String.Compare(String, String, StringComparison)可以作為替代方案,List.ConvertAll 我就直接用 List.ForEach 一個一個處理了。

I chose Solution one for the un-supported API String.Compare(String, String, Boolean) and List.ConvertAll. Windows Phone API provided String.Compare(String, String, StringComparison) which can be used to replace String.Compare(String, String, Boolean), as for List.ConvertAll I just converted each item of the list with List.ForEach.

當然直接把有用到的部份拿掉也是一種 workaround。
Of course you can just remove the un-supported code, if it's not necessary, as a workaround.


June 04, 2015

新加坡旅遊筆記

網路

  • 可以先在台灣買Singtel或Starhub的預付卡
  • 樟宜機場也有賣,之前的價格是 7 天 1G 流量 10 SGD,用完以後可以再買
交通
  • 可以先在台灣買EZ-LINK
  • 在新加坡的話要去櫃台買,沒有自動賣卡片的機器,卡片一張12 SGD,7 SGD 製卡費
  • 地鐵跟公車都可以用,公車的話似乎都是上車前門刷,下車後門刷
  • 在地鐵加值最少要加值 10 SGD,少於 3 SGD 不能進站
其他
  • 最好去程就準備好回程機票的資料,可能會被詢問
  • 台灣有換新幣的銀行很少,台灣銀行的線上換匯再去機場還算方便

Fail to mount Guest Additions in VirtualBox

Just met this problem today and found solution here

sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11