Saturday, February 28, 2009

話接前文

話說我在前一個blog裡對大家發出挑戰了吧
就是那個計算200,000以內的prime number的總和
沒想到youqi居然來挑戰了(才發現原來他有看我的blog的 XD )
他用php寫了個program放上server
然後給我url去看
不過還真的有點慢的說
需要三秒多左右才能完成calculation

這時候我就想用C++來寫看看有多快
反正我這兩天一直在想著一個不同我以往用過的algorithm
也很想test一下

第一次嘗試 - 8秒多,答案正確
但是我卻覺得奇怪為甚麼會那麼慢的
看看我的program logic裡面感覺有點不對
但是又能給出正確答案的說

第二次嘗試 -  <50ms,答案錯到離譜
我把logic稍微改了一點
居然差那麼多
百思不得其解
最後我只好使出殺手鐧 - output出中間所有的數目來看

第三次嘗試 - 100多ms,答案正確 XD
我突然想通之前的logic錯在哪裡了
看來這個algorithm可以跑到很快一下
只是使用了一些簡單的number theory而已 XD
而youqi嘗試用傳統的一個一個慢慢test到sqrt(n)的方法都要跑到500多ms


解決完了上面那個問題了
我無聊又跑去jobstreet上面翻翻了
結果居然又給我看到這個

Free Image Hosting at www.ImageShack.us

又是同一間公司
但是題目不一樣
是要找出最小的能夠被1-20除以的數目
而這個要找的是web programmer
看來要當web programmer還有點難度下
哈哈哈哈哈哈
這家公司真的是太可愛了
還有誰要來挑戰嗎? XD

Thursday, February 26, 2009

Job Hunting

前幾天在學校經過一個booth
是下個星期就要辦的JACTIM Career Fair的booth
那邊就是介紹關於這個展覽的東東
還有讓學生呈上他們的resume
眼看我還有幾個月就要畢業了
應該也是時候填好我的resume了吧
雖然之前也有填過一份
不過那個是自己隨便寫+抄的 XD
應該要有份比較professional look的resume才行

所以我就決定上去jobstreet開一個account啦
然後在jobstreet上面填好我的詳細資料
jobstreet就會幫我generate好一份professional的resume啦 XD
而且還會幫我列出符合條件的工作出來讓我看
但是話說我今天打開符合條件的工作列表出來看時
我看到一個公司的recruitment是醬子的

Free Image Hosting at www.ImageShack.us

居然是要你解決了裡面列出的那個問題才有資格apply的 XD
看了看它的問題
是要你寫出個algorithm能夠找出200,000以內的prime number的總和而已
其實問題是不難
只是要有一個optimize的algorithm
不然的話會非常慢
能夠在1秒內找出答案的program才符合資格 XD
其實這個一點都不難的
有誰要來挑戰一下
下次我才來公布我的solution XD
如果你還不知道甚麼是prime number的話
prime number是一個不能被任何數目除以的數目,除了1和那個數目本身
當然1是不包括在prime number內的
所以10以內的prime number有2, 3, 5, 7
你明白了嗎? XD

Tuesday, February 24, 2009

我的Converse

上個星期去sungai wang時
我跑去買了雙converse的鞋子 XD
為甚麼要去買新鞋呢
原因很簡單:
  1. 我的舊鞋已經穿了一年多了
  2. 我的鞋底好像已經穿了個洞
  3. 最近經常下雨,我的鞋子居然進水了(原本是不會進水的說)
  4. 都不懂那個鞋子是用甚麼做的,進水而已卻弄髒我的襪子 =.= (看來中國貨還是有點限度)
基於以上的種種理由
所以買新鞋是必要的
哇哈哈哈哈哈哈哈哈哈!!

我的新鞋是黑色+淺藍邊的
給你們看看一些照片








哇哈哈哈哈哈哈哈哈!!
怎麼樣?
還不錯吧!! XD


Monday, February 23, 2009

你們有注意到嗎?

你們有注意到嗎?
我的blog的header及footer都多了一排東西
看到一堆不一樣顏色的機械人在裡面走來走去的
把你的mouse移過去的話會有不一樣的東西哦  XD










你試著去玩了嗎?
沒錯!這個其實就是android的東東
header的那個是Android Developer Badge
而footer的那個是Droiderator
簡單來說就是android developer的證明 XD
看起來還不錯吧
哇哈哈哈哈哈哈哈!!

又是一個久違的blog,也是第一次在這裡用中文寫

今天在看完我的bloglist裡面所有的最新的blog後
突然有種心情想要回來寫了
而且還是用中文來寫


最近都在忙一堆的東西
一大堆的project和assignment要煩
fyp其實都沒什麼進展
因為我都沒怎麼認真去做
眼看著時間一天一天過去了
我還真的有點害怕最後交不出貨的說
偏偏我就是沒有足夠的時間來做
都怪我皮癢跑去報名參加了那個MDeC贊助的Dell Training course
雖然可以學C#和.NET
但是其實我都沒怎麼去認真聽書的說
就醬子每個拜六禮拜的時間都浪費在那邊了
回家後也懶惰做些甚麼東西了
看醬子的情形我自己也很擔心下
但是就是懶了沒辦法


說完了一些廢話
就來說一點有建設性的東西吧
基於我的wireless computing這個subject的assignment要求我們做一個mobile application的關係
所以我就開始去想一些有用,有趣及可行的idea
第一個idea出來了
最初我的想法是利用bluetooth將電話相機的video給stream過去的
可以拿來當webcam的replacement
後來想到既然還有麥克風,而且要保持mobility
為甚麼不直接通過Internet來通電話呢
想像著用手機來跟朋友skype的感覺應該不錯吧
可以在家裡到處跑的說
對於這個idea其實我也沒做甚麼research
就只是純粹一個想法而已
可以拿來當backup idea

另一個比較有趣的idea也很快出來
因為我跑去研究android了
玩著android的emulator的時候
我知道它能夠使用google map的web service了
所以我就想出個idea
就是做出個google map navigation system with voice guide
雖然說android不是完全沒有類似的東西
但是我個人還是覺得很有趣
就著手下去做research尋找我需要的東西
花了我好一番工夫才找到個android的text to speech library
並且成功在emulator裡面測試了
至於那個google map的東東就很麻煩了
我花了兩天在debug才成功load到google map進去android
所以看來這個idea是可行的了
只差沒有寫好一份proposal而已


最近開始染上了一個習慣
就是看有有趣的東西就跑去研究一下
到處search相關的資料
其實這個有部分是被you qi影響的
然後也經常跟他談論這些有趣的東東
今天又跑去找了些關於vpn的東西了
為甚麼呢?
因為kar hoong告訴我他突然收到個email
是個fcm的lecturer要他幫忙寫個類似garena的game client
然後對方還願意付錢的說
想想garena應該是用vpn來連線的吧
所以我就隨便search了一下相關的東東
找到了openvpn
但是懶惰繼續研究了
反正也不是找我的
得空再慢慢研究
不過you qi好像說他打算自己做個vpn server來host FIFA的lan game的說
好像很有趣的樣子
很想加入他的project



好啦
暫時先說這麼多
得空再繼續
Stay tune!!
哇哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈!!

Wednesday, December 03, 2008

Wiimote Gesture Recognition

Up until this post, I assume that you should have played with your wiimote for some days.
You probably have tried to program something with the wiimote library that I've introduced from the previous post.
Now you might come with a question that, how to actually make sense from the data of the accelerometer on the wiimote.
So there are people doing gesture recognition with the wiimote.

I've just realized that to fully utilize the accelerometer that I actually need a gesture recognition software when I was reading the wiimote specifications at Wiili.org.
So the first library that I've discover is the Wiigee which is a java based library.

wiigee is an open-source gesture recognition library for accelerometer-based gestures specifically developed for the Nintendo® Wii™ remote controller. It is implemented in Java™ and, thus, is platform-independent. Using a third-party Bluetooth®-library wiigee allows you to define and recognize your own, freely trained gestures.

The wiigee library
  • allows you to define (train) your own arbitrary gestures,
  • recognizes these gestures with high accuracy,
  • offers an event-driven architecture with which you will be able to
  • integrate the gesture-input as easy as common mouse-input.


Here come some video demo for wiigee.








Even though I've downloaded the library but I haven't got it to work on my pc yet.
As the library require another bluetooth library for java and I've always got an exception about the bluetooth connection stuff.
If any of you manage to get it work on your pc, please don't hesistate to give me an update.


Here there is a library for C/C++ which is called Accelerometer Gesture Recognizer.
I still haven't got it work with my pc either as I still cannot manage to compile it due to unknown reason.

However, there are few alternative C/C++ libraries to it such as Accelerometer-based Gestures for Openmoko Neo FreeRunner which also works for wiimote.
This project was done under the Google Summer of Code 2008 program.



Even though I've never tried to build this library as it is written in C code though but it seems work pretty good from the video demo above.

There is another C/C++ library which is program by a Taiwanese which is WiimoteGR (I found his blog which lead me to this page anyway).
On the wiki page which is linked above, the author even describes how the library work in diagram and some pseudocode.
It is pretty good reference if you want to program a similar library.
I guess that I will use this library for my project as it works fine when I tried to train it with some gestures and have it to recognize the gesture.

Finally, here there is a C# library for those who love managed code which is Wiigle.

Wii-based Gesture Learning Environment
WiiGLE provides support for recognizing gestures based on the Wiimotes accelerometers. The current version features some basic feature calculations on the raw signal and a simple NaiveBayes classifier. To this end, it makes use of the Managed Library for Nintendo's Wiimote by Brian Peek and the Weka Data Mining Software by the University of Waikato. It provides interfaces to integrate your own feature calculations and your own classifiers.

WiiGLE provides and environment to record gestures, calculate features, train classifiers, and use the Wiimote for online gesture recognition based on accelerometer data. It features a Programming API that allows integrating your own features and classifiers.

http://mm-werkstatt.informatik.uni-augsburg.de/documents/WiiGLE/doku.php

There are some good documentations on it and even a video tutorial.
It seems pretty even though I haven't tested it out yet.


So for the few libraried above, most of them are released under LGPL license which allows you to do anything with it either open source or commercial.
This is a good sign for those who want to learn more on it.
You can just download the source code and see what the authors have done.


So now you have the gesture recognition libraries here, let's get it Rock 'n Roll!!

Thursday, November 27, 2008

How to make use of the Wiimote

So now you have your wiimote connected to your PC, isn't it?
You probably tried to press the buttons on the wiimote or even tried to shake it, but nothing happens in the end and the 4 LEDs just keep blinking.
Don't be frustrated, it is because you do not have any programs that read the data from your wiimote and make use of it.
So here I introduce to you few of the wiimote libraries that I've tested anyway.

First, here comes the managed library which is WiimoteLib.
This library started out as an article at the Coding4Fun site and eventually many people use this to develop their projects with wiimote.
For a familiar example, it is also used by Johnny Chung Lee's projects which were posted in the previous post.
Here's a screensot to let you see how it is looked like.



Next, here comes a C library called Wiiuse.
It is one of the very first library that enable you to gain access to the wiimote with your PC, I guess.
For those who like to program in C language, you can go for it as its support for the wiimote is pretty good and it can support most of the bluetooth stack theoritically.



In case that you would like to program in Java, there is a Java wrapper for the Wiiuse above called WiiuseJ.
It is supposed to be able to do whatever the Wiiuse can do though.


Lastly, it is a great news for those who love C++, there is an excellent library for C++ which is WiiYourSelf!.
It is a fully featured library which supports everything from the wiimote even the speaker and vibrator.
This is the library that most recommeded by me as it is really easy to use though.




Here I've introduced several libraries tested by me.
In case you want to know more other libraries available, feel free to visit the URL below.
http://www.wiili.org/index.php/Wiimote_driver