2012年10月1日 星期一

Titanium Mobile i18N 的 Android Bug

Titanium Mobile 在 Build Android 的 application 有一個bug

http://jira.appcelerator.org/browse/TIMOB-3639

http://justfly.idv.tw/2012/02/08/Just_1067.html

讓你沒有辦法順利在  iOS 跟 Android 上做 i18N

現在讓我們來修好她!


請在你的  Titanium Mobile SDK 裡面找到

localecompiler.py

在mac 上是 ~/Library/Application Support/Titanium/mobilesdk/osx/2.1.2.GA/common/localecompiler.py

然後請在 compile_for_android 這個函式裡面,locale 的後面加上下面這兩行

                        if '_' in locale : 
                                locale = locale.replace('_','-')  
如果不是很了解的話,就請看這一段commit 
https://github.com/timtan/titanium_mobile/commit/c96b59186ff5e8e999ad11643faaccc03bc964a1




2011年10月10日 星期一

Dart

Google 發表了 Dart , 剛剛看了裡面的Source Code, 它是用Python 來指引整個  Build Process, 我還以為只有我會這麼土炮,我想像中Java 世界的人都愛用ant .

這也讓我想到很多coding style 的問題,最近我的code 都用了大量的 function, 和這份 Dart 的 compiler build script code 是完完全全地不一樣。 這讓我想到有兩種不同面向的可讀性。

這一份code 的  style 是把每一個步驟都一一做給你看,你可以立刻看到他手工打造的過程。

而我自已最近偏愛的方式,是以Top Down, 先把High Level 的函式或是界面先訂好。然後再把實作補齊。

我覺得,我的方式在了解High Level concept 的時候相當很容易,Business Logic 顯而易見。而另一種方式是你可以立刻改變整個流程。

對一個成長中的程式,你有兩個選擇。一個是把Logic 直接曝露,讓你可以隨時可以搞來搞去,另一個是要隨時擁抱Refactoring. 隨然後者是比較好的方式,但看來實際情況,還是前者較省力啊!

2011年5月18日 星期三

猜數字

看了thinker 的文章 http://www.codemud.net/~thinker/GinGin_CGI.py/show_id_doc/445

就寫了一個猜數字程式。

是電腦猜人的數字喔~~

在PyCharm 的幫助之下,先把Hilevel Logic 建立好,再用Code Gen 補齊實作。

這樣寫Code滿寫意的~~~

Evernote 如何建構服務

http://blog.evernote.com/tech/2011/05/17/architectural-digest/





重點是 用了 Local File System

以及大量的Java ~~

Layout  => GWT

Web Framework ==> Strip

ORM ==> Hibernate

SQL ==> MySQL

Container ==> TomCat

看起是不是很樸實呢?

2011年4月26日 星期二

用Makefile 寫費式數列

a = 0
b = 1
all:
ifeq ($(time),10)
    exit
else
    @echo $a $b
    @make time=$$((time + 1 ))  c=$(a) a=$(b) b=$$(($(a)+$(b)))
endif

這是在看 GNU makefile 的 manual 裡的conditional statement 部份就順手寫的,還可以再精巧嗎?  try try try

2011年4月11日 星期一

Java Auto Complete in vim

為了得到Java快速開發的好處,往往會借重eclipse的自動完成的功能,但是eclipse的冗長開啟時間是很讓人抓狂的,所以就找了一下這個工具,來讓vim 也有java 自動完成的功能。

http://www.vim.org/scripts/script.php?script_id=1785

安裝的方式很簡單,就是 unzip thezipfile -d ~/.vim 就結束了。

裝完後不免俗的要在 .vimrc 上 加上Java 相關的 auto command.

" Java auto complete
" url -- http://www.vim.org/scripts/script.php?script_id=1785
if has("autocmd")
  autocmd Filetype java setlocal omnifunc=javacomplete#Complete
endif
" end of Java auto complete

之後就是 ctrl-x ctrl+u 的 omni completion 了。

希望不要像clang completion 一般,有大檔案過慢的問題。

2010年3月4日 星期四

Building qemu-kvm

KVM is integrated into linux kernel, It may help virtualizaion of QEMU( QEMU is emulation only ).

the first step is install the kernel module and get the qemu-kvm source code( a modified qemu )

1. modprobe kvm
2. modprobe kvm-intel

3. step into the source code of qemu-kvm,  ./configure --target-list=i386-softmmu

if lack of libpic ,    install the pciutil

then make to get the qemu