Monday, January 10, 2011

Destiny

Every creature has its own destiny to fulfill.
The path set for it is pre-determined by the universe.

Sometimes,
it will desperately strive to blend in the groups that are out of its league,
but in vain.

Destiny will sometimes let it try and have some experience from those groups.
But in the end,
inevitably,
it will be reset to its own league,
living back to its own world.

How marvellous!

You will know it when you get what it takes,
luck will never be your side, not even occasionally.

Sunday, November 14, 2010

Tape sort on 4k-by-4k matrix

Q: How to transpose row-major 4k-by-4k matrix stored on magnetic tape?

A: First prepend the column and row numbers to each element, then tape sort by column numbers then by row numbers, then remove the column and row numbers.
For example: there is a row-major matrix stored on the tape

3 2 1
4 5 7
6 2 3

So on the tape it will be like {3,2,1,4,5,7,6,2,3}

Prepend column and row numbers to each element:
[0,0]3 [1,0]2 [2,0]1
[0,1]4 [1,1]5 [2,1]7
[0,2]6 [1,2]2 [2,2]3

Sort by column number then by row number, on tape it will be like

{[0,0]3,[0,1]4,[0,2]6, [1,0]2,[1,1]5,[1,2]2, [2,0]1,[2,1]7,[2,2]3}

Friday, October 1, 2010

openssl soap_ssl_client_context() problems

On client side:

generate necessary pem files:

(1) private key/certificate pem file:

openssl pkcs12 -in in_file.p12 -clcerts -out key_out_file.pem

(2) generate CA certificate pem file (NOTE: Do NOT use -clcerts here, because the fifth parameter of soap_ssl_client_context requires a CA certificate):

openssl pkcs12 -in in_file.p12 -cacerts -out cert_out_file.pem

(3) use in soap_ssl_client_context()

if (soap_ssl_client_context( &soap,
SOAP_SSL_DEFAULT,
"key_out_file.pem",
"your_pw",
"cert_out_file.pem",
NULL,
NULL))
{ // print ... error }

Monday, September 13, 2010

GEnerate gsoap

gcc -o iplookup iplookup.c soapC.c soapClient.c -L/usr/local/lib - lgsoap -lm -lsocket -lnsl

gcc test.c soapC.c -lgsoap
works for me

Thursday, September 9, 2010

How to make Virtual keyboard and SCIM co-exist on N900

(1) Install MSCIM and whatever input methods you want
(2) Go to /etc/gtk-2.0/, create two files as follows

first file: vb (for Virtual Keyboard)

"/usr/lib/gtk-2.0/2.10.0/immodules/hildon-im-module.so"
"hildon-input-method" "Hildon Input Method" "hildon-input-method-framework" "/usr/share/locale" "*"

Second file: scim (for MSCIM)

"/usr/lib/gtk-2.0/2.10.0/immodules/im-scim.so"
"scim" "SCIM Input Method" "scim" "/usr/share/locale" "*"


(3) in the same directory, create another two files:

first file: vb.sh

cp /etc/gtk-2.0/vb /etc/gtk-2.0/gtk.immodules

second file: scim.sh

cp /etc/gtk-2.0/scim /etc/gtk-2.0/gtk.immodules

then chmod to these two files

>>root
>>chmod +x vb.sh scim.sh


(4) make two symbolic links in /usr/bin/

ln -s /etc/gtk-2.0/vb.sh /usr/bin/vb
ln -s /etc/gtk-2.0/scim.sh /usr/bin/scim

(5) if you want to use virtual keyboard, remember to retract the physical keyboard first, then type in

>>root
>>vb

if you want to use MSCIM:

>>root
>>scim

Sunday, August 29, 2010

Call of Duty Modern Warfare 2原声碟

尽管Call of Duty Modern Warfare的背景音乐也不错,但是大师毕竟是大师,Hans Zimmer在Modern Warfare II中的作曲表现对该作品在英美游戏排行榜的影响应该是功不可没的。从动画片狮子王,特种作战大片石破天惊到现在的现代战争2,大师的每次背景音乐总能展现深厚,雄伟,旷大的气势。尽管不是反映历史沉重的题材,但军乐队,交响乐及电子合成交替的完美运用却隐约展现一种沉淀,以至于将作品衬托为史诗般的巨作,的确能够让人不惜滥美之词。本文针对现代战争2的原声碟发表一些个人对应观点,顺便For the Record


Safeguard
































Guerrilla Tactics














Deadline














Breach



























Ordinance













Code of Conduct













Protocol













Friday, August 27, 2010

How to get Xilinx XUP Virtex II PRO to work in Ubuntu 10.04

(1) follow aclevername.com
(2) get the product id right in >>lsusb
(3) install usb-driver-HEAD.tar.gz