Imps are always mischievous, uncontrollable, only obedient to somebody special, and not as powerful as the real demons, yet.
小惡魔:調皮難控制的猴小孩,還在努力成為真正的大惡魔中。
As the title suggests, this is my everything notebook, may in traditional Chinese or English.
這裡什麼都寫,不管是食譜、遊記、練習寫作的爛文,抑或是個人的一些狗屁倒灶的東西都有可能出現,使用語言也是隨性。
*Sometimes, those bilingual articles are not formed by translation, I will represent the concepts twice using different ways of thinking based on the language I use.
Sunday, September 14, 2014
Hold on and waiting for the clouds with silver lining
沒想到我也會有生平無大志,只求六十分的一天啊。
現在放棄的話,就要回到神豬當首都市長的小島了喔^.<
想到這裡我都醒了,繼續撐著,總有一天會看到鑲銀邊的雲朵的吧!
Tuesday, July 29, 2014
[轉錄] 我要我們在一起
http://www.cheers.com.tw/article/article.action?id=5023891&page=1
我要我們在一起
- 2005-08
- Cheers雜誌59期
- 作者:盧智芳

Tuesday, July 15, 2014
感恩
Saturday, July 12, 2014
手段
我想,這可能也是我愛恨分明的原因吧!除了坦蕩面對自己不怕誤解以外,我其實把從親友們身上得到的委屈和無力感都吸收儲存了下來,如果能短暫地就經由自己的性格去消解的話就好;如果不能,那就找機會轉嫁到我可以合理生氣的敵人身上,算他倒楣,而且干我屁事,我打你幹嘛怕你會痛?你哪位阿?
還...還是我本來就是個超難相處又沒個性的死爛人呢? 這應該也是很有可能的事情。
嗯...改天再想辦法調整吧!
Wednesday, July 9, 2014
[Android] Get access to external SD card
Tuesday, July 1, 2014
不留遺憾
終於和她見了面,很自私的說出了這十多年來從沒對她,或其他人說的話(或說:傾倒壓力在這無辜的人身上)。過程中,即使我極力保持冷靜並收斂情緒,但在某些時候,還是讓我真正的感受到了什麼叫做「語帶哽咽」。原來那竟是一種沒辦法控制的生理反應:情緒波動感覺起來是平穩的,但雙唇一啟卻總有股強烈的壓力由胸腔一路擠迫到喉頭;於是,為了不將此壓力化作情緒並藉由雙眼與鼻腔發洩(即一般典型的泣訴),選擇了以話不成句的方式,在每一字之間強壓那在喉之重,命早已紊亂不堪的言語儘速逃脫。
談話結束後,我沒有太大的情緒變化,也沒有很強烈的如釋重負的感覺;一切都這麼的自然,這麼的如我預期;畢竟我們從沒有發展過感情,何來失戀?只不過是老朋友間普通的談話、告別罷了;身體上的疲累應該只是交通的緣故,不礙事。第二天依舊起了個大早,自己準備了早餐、打掃了家裡、幫寵物洗個澡,然後開始打開電腦作事,一直到了下午約一點我才恍然發現我竟什麼事都沒有做、連打混摸魚都沒有,就只是茫然的看著程式碼、看累了就趴著休息,就這樣虛度到了下午;胡亂吃了點午餐後,不只沒收拾(要知道,我開伙可是先收完才開動的人),連下午預定要去的約也就算了。哈!原來躺在床上聽著雨聲「耍廢」也蠻舒服的嘛!
再隔天,回到工作崗位了。良好的工作環境與談話,工作效率似乎有恢復了一點,很快的找到了預計在週末就要解決的問題,至於無心治本應該只是出至於惰性與不必要吧!只是,依然心神不寧,腦袋一直對著「虛無」空轉。是的!我一直在想著東西,而那東西我唯一的形容方式就是「什麼都沒有」,我只好隨著靈魂的意思任它行動並趁早下班以獨處並休息。果不其然,在一陣的放空發呆以後,我癱軟在床上沈沈睡去,在進入夢鄉前的腦中最後訊息我記得是
「那你現在應該沒有失眠了吧!」
「嗯阿!太忙了,時間跟體力都不夠用了。」
在做了場美夢醒來之後,夢中依人已然不是故人,而我在夢中卻笑得更燦爛。這時我才恍然大悟兩件事。第一:原來那陣虛無是因為心理的寄託被掏空了,過往那可笑至極的執念讓我在徬徨之際至少有個寄託,而當我真正解脫了以後,那些力氣突然撲了個空;這個概念大概類似於武俠小說裡面那種「如果他沒了心中報仇的對象,那他生存的動力還剩下些什麼?」吧!原來,我不只是身體遲鈍,連情感上的傷也很遲鈍地到第三天才發現,哈!我想,我只是需要時間,讓心理重新找到真正的依靠,或是讓情感再鈍化一些。第二:我似乎在保護機制的啟動下,將這股執念開始轉移了,使得感情突然放重了。這不是個好現象,這是種有如白血病般,為了防禦外在侵略大量增生卻反而自傷的症狀;我不想要在目前就放得這麼重,我想再放輕鬆一點、再放淡一些,不要超過七分,一切自然、正常、隨緣就好。
不過呢!可以解開這十多年來那無形的結,其實是個很大的解脫,這樣我才能勇敢而無畏地面對現在、或是以後會遇到的人,應該比較不會像過去一樣每次都那麼難看了吧(遮臉)。另外,和她見面以後記錄這過程也是有目的的,如果我連對她都說不出這些私密的話,那我要如何對其他重要的人敞開心胸呢?更甚者,我想試試看言語不帶太多保留,赤裸裸的顯示自己會有什麼事情發生,在這應對的過程中,我想我會收獲不少。
最後,我必須誠實的表示,我不是為了誰而要與她作個結束,我最主要的目的就只是為了不讓自己後悔罷了,其他的都在其次,以此為證,以防我日後腦袋錯亂隨便唬爛。
我失戀了,但我也復原了,我現在想好好的、輕鬆的交朋友。
Thursday, June 26, 2014
不必二選一
這種感覺是眉目俱笑、是怡然自得、是悠然自得不患得患失(好啦!偶而還是會有),是開心卻不是狂喜、是掛念卻不是踮念、有份量卻如清風一般不留痕跡,渴望坦承也贊成神祕。我真的很享受這種感覺,如果你們發現了什麼,能不能當做不知道,給我點空間呢?
其實在我第一次意會到的時候,我是很排斥的;我很怕會因為這樣而分心,甚至產生牽掛使得我未來的路出了差錯,我不想要有任何變數發生,我放不開。只是,我突然發覺到這種想法真的很幼稚,誰說念書和交朋友一定是會互相排斥的呢?就算會,現在說這也太找了吧!我在擔心什麼阿?這種想太多的心態才是真的會讓我兩者皆空停滯不前的毒瘤,我應該要放輕鬆、讓一切順其自然發展就好,不管會有怎樣的結局,不要讓自己後悔就好。
只願接下來的日子裡,一切隨緣、正常、自在。
大道不移,兩不捨。
Tuesday, June 24, 2014
[Android] Error inflating class fragment
We have a project that will contain several fragments in one activity, we compile and deploy it to a device without any error message. However, runtime exception occurs when we launch the App, even though we just declare a fragment and not use it yet.
At the first glance, I would consider that it is caused by the fragment class. But it is actually caused by the XML syntax while declaring the fragment component in the layout file of my main activity. See the rectangular area
android.view.InflateException: Binary XML file line #25: Error inflating class fragment
What happened?
It is due to the line 27 in the editor, which uses capital characters (even though it is exactly the same with the real java file we are going to use). All I need to do it change them with all lower characters (it is legal to use capital ones in the rear). That is to say, we revise it as
android:name="com.example.soundclassifier2.MusicFragment"
And everything works now!
[Android] Missing AppTheme (styles)
There is a typical one:
in your res/values/styles.xml
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
It is because I did not include a library appcompat_vXXX correctly. The fastest way to include it, though locally (you have to do it once on every machine), is load an suitable appcompat_vXXX project on your machine.
Right click on your project -> Properties -> Android -> (scroll down) Library
Then you will see an item X ../appcompat_vXXX in the window. All we have to do is click the 'Add...' button to select one of them (in my case: appcompat_v7_4), and click 'Apply' and 'OK'.
If there no any appcompat_XXX available, then you have to download them via Android SDK Manager and download 'Android Support Library' first.
You can see more details in
http://developer.android.com/tools/support-library/index.html
Thursday, May 8, 2014
[Android] Run C/C++ codes on Android–Android NDK
Before Start
When we develop Android projects, Java codes can handle most of the cases. However, we may need to run C/C++ codes under some circumstances:- Some of your methods have performance issues.
- Re-use some open-sourced codes written in C/C++.
- The methods written in C/C++ handle CPU-intensive tasks such as signal process, machine learning algorithms, etc.
Again, running C/C++ codes on Android does NOT guarantee performance improvement, it somethings make your application slower. Only transform the methods that are really CPU-intensive.
What is Android NDK
Android NDK stands for Android Native Development Kit. As Java run the codes in the JVM, no matter what the hardware is; however, it does matter to C/C++ codes, which need to be compiled in different ways (implicitly) according to the hardware architecture before we can run it, that is why we call it "native".
How it work
- Install the NDK to compile the C/C++ code to native libraries
https://developer.android.com/tools/sdk/ndk/index.html - Declare an "interface" as a bridge from C/C++ functions to Java methods
- Declare the Java methods in your application, then use it like (most) normal Java methods
Case study
Instead of using a "HelloWorld" for demonstration, I would like to trace a open-source project for your reference, and that is how I learned by the way.Libsvm-androidjni -- LIBSVM for android jni environment
https://github.com/cnbuff410/Libsvm-androidjni
Libsvm is one of the most powerful tools for SVM and widely used in many classification problems in the world, and it is definitely CPU-intensive. To make this tutorial simple, I just introduce the svm-train function here in a bottom up approach (target the C/C++ codes first, then the interface and how to call the Java methods and so on).
Original source code
/jni/src/svm/svm-train.cpp
/jni/src/svm/svm-train.h
The entry in the svm-train.cpp file is
This is an unusual C/C++ that really link the native codes (C/C++) to you Android (Java) code
Three rules observed here
- Besides the real parameters, please add JNIEnv *env and jobject obj as the first two parameters
- Add j in front of type identifier; use Array instead of []. For instance, int becomes jint, int[] becomes jintArray
- Use objectArray for any multi-dimensional array. For instance both int[][] and float[][] will become objectArray
- Convert the strings before and after use them.
Put the parameters in the () pair, followed by the return value type
Several mappings here
[type in Java]:[identifier here]
int: I
float: F
double: D
String: Ljava/lang/String; (do not forget the semicolon)
float[][]: [[F
int[][]: [[I
For example:
float HelloWord(int i, String s1, String s2, int[][] arrayI) becomes
"(ILjava/lang/String;Ljava/lang/String;[[I)F"
Register this interface and native methods
}
Again, you must replace "info/kunli/AndroidLibsvmExampleActivity" to the file name where you register the library.
Link the interface java codes with Java Virtual Machine
Call NDK to compile the cpp files into a native library (*.so)
libsignal is the name of compiled native library here
jni/src/Application.mk
Set up the hardware architecture
Call NDK to compile the library
ndk-build
Overview of the native library building process (top-down)
NDK configuration
Android.mk
Application.mk
Linking JVM to native library
onload.cpp
Set up the interface between Java and native codes
info_kunli_androidlibsvmexample_AndroiLibsvmExampleActivity.cpp
Call the native function as Java methods in the Android project
AndroidLibsvmExampleActivity.java
Note:
If you are familiar with libsvm, you probably found that the lasted version when I am writing this post (May/2014) does not fully support the original LIBSVM well. That is why I want (have) to learn how the NDK work so that I can expand it via the interface codes (not the original C/C++ codes).
Saturday, May 3, 2014
Less is more
I am always a hard-working person, and I have been suffered from enormous stuffs I am working on. In the past, I had spent more and more time on working even than holidays; however, spending more time on working does not always work. In my personal experience, allocating more time for working somehow does not work! Why? It turns out that I would assuming I still have much time to finish the works, resulting the decrease of efficiency.
Fortunately, I have found such a hazard. The solution is: Do not expect extra time (e.g. weekend and night) and have some recreational activities on holidays to strike a balance between work and life. With a tight schedule, I have to finish the tasks within the weekdays and the normal working hours; therefore, both my throughput and happiness increase due to the fact that I have better working efficiency and relax.
"Less is more" means that spending less time on working brings more throughput and pleasure.
Wednesday, April 30, 2014
重回軌道了
專業上,開始能夠複習程式開發方面的技能;網球方面開始能放鬆的打球,而不是緊繃的只練某些固定的弱點項目,即使各項技能仍有很大的進步空間;作息也開始慢慢回復到早睡早起的模式了,我記得這幾乎是一年多以前的事情了,哈哈!
最重要的我想就是人際方面了!現在的我,可以在依然真誠待人的心境下,而能保有自我的空間,一步一步在實現「邀請對方進入我的世界,而不是一味的付出」,這樣的相處模式有什麼好處呢?一言難盡。但我想,最大的好處就是不會再患得患失,心境可以常保平靜卻又不致於對世間的感情覺得冷漠,我喜歡這種感覺。
終於又感到在成長了呢! <3
Friday, April 11, 2014
放鬆
我的身體跟脾氣的僵硬度基本上我已經放棄去挽救了(sign),不過今天倒是在一陣小沮喪和放鬆下(這啥詭異的順序?),整個肩膀像融化般的化在床上了;身體的疲累是還好,我甚至還是有意識的(所以才能記下這感覺),但卻隱約感受到,原來我不只是騙過身體的疲累,似乎心理上的壓力其實有一部分也被蓋下了,而我以為那是我小時候才會作的事。
幹!我真的越來越不像人類了,從「我身體叫我休息」繼續突變到「我的心理叫我休息,雖然我不是很想」。
好吧!以理智來思考的話,這種現象其實是可以解釋的,第一個可能是我把各種敏感度不知不覺中越調越低了,以致外界引發的負面影響無論大小我都只能感覺到「還好」;第二個就是我只是個很帥的北七,三不五時不知所云而已。
對了,因為我沒當過真的屍體,今天也沒喝酒,這是比喻而已,筆記一下以防以後忘記。
Friday, February 28, 2014
[Python] Cannot write data into multiple array
However, without any error message, all of them are 0.0.
It is because I initiated them array with 0 (int), and my data are always between 0 to 1 so that all of them are casted to 0.0 (float)
Make sure initiate your array with the same type you will use.
Below are some codes to generate the 2-D array and update them
# generate a 5-by-3 array initiate with 0.0 result_list = [[0.0 for j in range(0, nFeat)] for i in range(0, 5)] """ Below is what drove me crazy result_list = [[0 for j in range(0, nFeat)] for i in range(0, 5)] """ # convert to array via numpy result_array = np.array(result_list) print 'Before:', result_array # update (Python starts at 0) result[2][2] = 0.8 print 'After: ', result_array """ if you want to use list rather than array afterward, you can use either result_list = result_array.tolist() or result__list = list(result_array) """
Tuesday, February 25, 2014
More pain, more progress, and happiness in the end
Being suffered by finance, love, parents, and study at the same time. I will make all the obstacles my strength.
Sunday, February 23, 2014
[Linux] Some tips for screen
Screen is especially useful if you connect the server via SSH and need to run a time-consuming process. Just open a window, running the process on that window, then you can leave and log into the same window to continue you work.
In this post, I use 'window' rather than 'screen' to give you a clear image. But technically, they are 'screen's by definition.
Show the window list
Create new window with given name
Attach to an unattached, or log in if it is attached, window
Attach to an attached window (multiple log in the same window)
Detach (leave but not kill) a window
Kill a detached window
Leave (and kill) the current window you are on
Check whether you are on any window
if is is 'null', then you are not on any window. You can also edit your shell to show that in your prompt:
You can also use hot-keys, which I do not recommend to the beginners. Check the reference for more detailed information:
References
http://www.rackaid.com/blog/linux-screen-tutorial-and-how-to/
http://www.bartbania.com/index.php/linux-screen/
Tuesday, February 11, 2014
[Python] Dealing with the 'CSV new-line character seen in unquoted field error'
Just do as it said: use universal-newline mode, which means ‘U’ in the arguments.
Example:
Thursday, February 6, 2014
[Linux] Check the memory size in human readable format
Alternative: Show the number of GB (only the number)
Saturday, January 18, 2014
[VirtualBox] Make SSH connections among the cluster of guest OS
Host OS: OSX 10.7
Guest OS: Ubuntu server 12.04
How to build up in-cluster network?
The spirit:Create a network interface for in-cluster network
On every guest OS panel
Setting -> Network
Besides the first network card with NAT, add second network card with Bridged Adapter.
This will create a new network interface on your GUEST, say eth2
Edit the network interface configuration
Assume the interface is eth2, and we want to set the ip as 192.168.56.100
Add these
Restart the network process to read the new configuration.
You can also manually activate the interface by
What to communicate with the host?
The spirit: Create another network interface on host, also create new network interface on guest.Create new network interface on host
On the VirtualBox main panel
Preference -> Network -> Create a new adapter (e.g. vboxnet0)
This will create a new network interface on your HOST, say vboxnet
type ifconfig to check it
In this case, we have vboxnet (doesn't matter), and 192.168.56.1 as the ip
Conclusion
Friday, January 17, 2014
[Linux] Customize shell prompt
To change the shell prompt, change the variable $PS1 the .bashrc (depends on the shell you use)
\u : user name
\h : hostname
\w : the current absolute path (use /W if you only want to relative path)
\n : new line
To add color to the prompt
\e[ : start to add colorx;ym : set the color to x;y
\e[m : end to add color
another format to add color
For example, green string 'HelloWorld'
Green user name (spencer)
purple directory (~) in a pair of bracket ([XXXX])
ending up with a dollar sign ($) and leave a space.
Update Jan. 24, 2014:
It seems that using the purple color (11;35m) may result in a bug, choose another color, for example blue (01:34).