十月 1, 2011

hoamon's sandbox
hoamon
hoamon's sandbox is about »

tag cloud

» 再改寫「背包問題」的求解程式碼

之前的作法是將 cut 函式所計算的 list 結果直接 append 到全域變數 tmps 中,這樣的 cut 函式是無法作 decorator 的。

新方法則是把 cut 函式的 input, output 重新規劃,讓答案就是 return 值,這樣 input 就能對應到單一 output ,透過這個特性,我們就能加上一個 @cache decorator ,去作快取。因為在求解的過程中,勢必會遇到重覆的 input ,有了快取,可以少算一次。

其中的 _no_cache_count 值指的是第一次遇到的 input 值,而 _cache_count 值則是利用 dictionary 找到答案的次數。

要怎麼建構出 cut 函式的樣貌? 我們一開始先抽象地想像這個 cut 函式要作到的事就是 answer = cut(bar, sizes)

answer 是我們要的答案,結構是 list of list( [[ , , , ..], [ , , , ..], ..] )。而 bar 是原長度, sizes 則是需求尺寸的 list 。

假設我們帶 bar = 10, sizes = [7, 5, 3, 2] ,那麼經過 cut 運算,就能得到一個 list of list 的 answer,那到底 answer 是多少? 我們先不管。但我們可以知道 10 拿給 7 去切,可以得到 0, 1 兩種組合。

所以 cut(10, [7, 5, 3, 2]) 一定會等於 cut(10, [5, 3, 2]) 的結果其解全部在元素 0 的位置插入 0 + cut(3, [5, 3, 2]) 的結果其解全部在元素 0 的位置插入 1 。

一樣地, cut(10, [5, 3, 2]) 也會等於 cut(10, [3, 2]) 的結果其解全部在元素 0 的位置插入 0 + cut(5, [3, 2]) 的結果其解全部在元素 0 的位置插入 1 + cut(0, [3, 2]) 的結果其解全部在元素 0 的位置插入 2 。

直到 cut(10, [2]) 時,我們知道它的結果就是 ([5], ) ,為什麼是一個 tuple of list ? 因為之前我們就定義 cut 一定要回傳 list of list ,而因為這次的 cut 回傳值本身並不會被修改,所以傳個 tuple 回去,可以少用一滴滴的記憶體(應該是一滴滴而已)。

當開始有 answer 被回傳後,我們就開始作合併的工作(就是把前一個需求尺寸的用量插入 answer 內的 list)。合併後再回傳。

程式碼如下,不過在實際跑的時候,有二件事我不能理解,為了比較 cut 與 cache_cut 的效率差別,我在同一個行程上分別跑了兩次 cut, 兩次 cache_cut ,而順序是 cache_cut, cut, cut, cache_cut ,cache_cut 比 cut 快,這很容易理解,但第二次的 cut 居然會比第一次的 cut 還慢,這我就不懂了。

另外,我每次跑 cut 之前,都是用 cs = CutSteel(bar, sizes) 創建新的物件,為什麼第二次跑的 cache_cut ,它還是可以找到第一次 cache_cut 所儲存的 CACHE 呢?

最後,我還得到一個結論,當解答組合數不多時,用 cut 會比 cache_cut 快。因為小題目,遇到重覆 input 少,但如果還是全部的 input 要儲存 CACHE ,那所花費的時間還不夠重覆 input 所節省的時間了。


1 #!/usr/bin/env python
2 # -*- coding: utf8 -*-
3 import types
4
5
6
7 class CutSteel:
8 u""" 目的:解鋼筋切割的組合問題(也就是背包問題),但不只是求組合數,
9 也要把所有的組合列出。
10 例: 10 公尺長的鋼筋,要切成 7, 5, 3, 2 公尺等,有多少種組合。
11 解:
12 7 5 3 2
13 [1, 0, 1, 0]
14 [1, 0, 0, 1]
15 [0, 2, 0, 0]
16 [0, 1, 1, 1]
17 [0, 1, 0, 2]
18 [0, 0, 3, 0]
19 [0, 0, 2, 2]
20 [0, 0, 1, 3]
21 [0, 0, 0, 5]
22 """
23 def __init__(self, bar, sizes):
24 if type(bar) != types.IntType or bar <= 0:
25 raise ValueError(u'只接受正整數')
26 for s in sizes:
27 if type(s) != types.IntType or s <= 0:
28 raise ValueError(u'只接受正整數')
29
30 self._no_cache_count = 0
31 self._cache_count = 0
32
33
34 def cache(my_function):
35 CACHE = {}
36 def inner_function(*args):
37 key = str(args[1:])
38
39 # try:
40 # #INFO 用 try 的會比 if 慢一點點。只慢一點點。
41 # CACHE[key]
42 # args[0]._cache_count += 1
43 # except KeyError:
44 # args[0]._no_cache_count += 1
45 # CACHE[key] = my_function(*args)
46
47 if not CACHE.get(key, None):
48 CACHE[key] = my_function(*args)
49 args[0]._no_cache_count += 1
50 else:
51 args[0]._cache_count += 1
52 return CACHE[key]
53
54 return inner_function
55
56
57 @cache
58 def bag(self, total, sizes):
59 u""" 只計算組合數 from thinker"""
60 propers = tuple([sz for sz in sizes if sz <= total])
61 if not propers:
62 if total >= self._minsize: return 0
63 else: return 1
64
65 num = self.bag(total - propers[0], propers) + self.bag(total, propers[1:])
66 return num
67
68
69 def cut(self, total, sizes):
70 u""" 本函式的 input 為「被切割長度」及「欲切割的種數」。
71
72 output 為該 input 的所有組合。
73 """
74 if len(sizes) == 1:
75 return (
76 [(total / sizes[0]), ],
77 )
78 elif total < sizes[-1]:
79 return (
80 [0,] * len(sizes),
81 )
82
83 return [
84 [j] + tr
85 for j in xrange(0, total / sizes[0] + 1)
86 for tr in self.cut(total - sizes[0] * j, sizes[1:])
87 ]
88
89
90 @cache
91 def cache_cut(self, total, sizes):
92 u""" 因為 cache_cut 函式本身是具有固定 input 就會產生固定 output ,
93 它們具有一對一或多對一的關係,所以我把 input,
94 output 放在一個 dictionary 中,若程式計算到相同的 input 時,
95 可免計算,直接從 dictionary 拿答案。
96
97 其實本函式就是複製 cut 函式後,
98 將函式內程式碼中的 self.cut 改成 self.cache_cut ,
99 並在函式名前加上 @cache 而已。
100 """
101 if len(sizes) == 1:
102 return (
103 [(total / sizes[0]), ],
104 )
105 # elif total < sizes[-1]:
106 # #INFO 多這個判斷式反而變慢了。因為已經用 cache 了,
107 # #所以那些 total < sizes[-1] 情況會變成比較少,
108 # #然而在一個 cache_cut 函式中多加一個 if ,則判斷時間會多一倍,
109 # #加速效果反而不如預期。
110 # return (
111 # [0,] * len(sizes),
112 # )
113
114 return [
115 [j] + tr
116 for j in xrange(0, total / sizes[0] + 1)
117 for tr in self.cache_cut(total - sizes[0] * j, sizes[1:])
118 ]
119
120
121
122 from time import time
123 import sys
124 if __name__ == '__main__':
125 #bar = sys.argv[1:]
126 #sizes = sys.argv[2:]
127 bar = 10
128 sizes = [7, 5, 3, 2]
129 sizes.sort(reverse=True)
130 sizes = tuple(sizes)
131
132 cs = CutSteel(bar, sizes)
133 cs._minsize = min(sizes)
134 print 'Total count: %s' % cs.bag(bar, tuple(sizes))
135
136 cs = CutSteel(bar, sizes)
137 time0 = time()
138 result = cs.cache_cut(bar, sizes)
139 print 'cache_cut spend time: %s' % (time() - time0)
140 print len(result)
141 print('\tno cache count: %s, cache count: %s'%(cs._no_cache_count, cs._cache_count))
142
143 # cs = CutSteel(bar, sizes)
144 # time0 = time()
145 # result = cs.cut(bar, sizes[:])
146 # print 'cut spend time: %s' % (time() - time0)
147 # print len(result)
148 # print('\tno cache count: %s, cache count: %s'%(cs._no_cache_count, cs._cache_count))
149 #
150 # cs = CutSteel(bar, sizes)
151 # time0 = time()
152 # result = cs.cut(bar, sizes[:])
153 # print 'cut spend time: %s' % (time() - time0)
154 # print len(result)
155 # print('\tno cache count: %s, cache count: %s'%(cs._no_cache_count, cs._cache_count))
156 #
157 # cs1 = CutSteel(bar, sizes)
158 # time0 = time()
159 # result = cs1.cache_cut(bar, sizes[:])
160 # print 'cache_cut spend time: %s' % (time() - time0)
161 # print len(result)
162 # print('\tno cache count: %s, cache count: %s'%(cs._no_cache_count, cs._cache_count))
163
164 for i in xrange(0, len(result)):
165 print(result[len(result)-i-1])

三月 28, 2011
» MacbookPro 13"

IMAG0090.jpg
Taiwan History Museum.Taipei

Finally, I got a mac.
Hope it can help me more than creating suffers for me.

五月 19, 2010
» 山形尖叫 / NoMachine NX

P8068007
butterfly.Taiwan

山形尖叫,因為有山形才看的。
好怪的一部片。

==

看同事都是用NX也不是vncviewer,所以我也上網找文件設定了一下。
果然速度快了很多,不會像vncviewer那樣,卡得要命。

https://help.ubuntu.com/community/FreeNX
http://www.nomachine.com/download-client-windows.php

四月 3, 2010
» Flickr Random Image Picker

P6216480
Annecy.France

It's a small tool written to randomly show my photos from flickr. I quite enjoy viewing photos in this way. It helped me to discover photos that I didn't notice before. However, there are some limitations to it:
1. in current configuration, 10 photos will be shown every time I launch it. it takes too much time to do so. I have to wait for tens of seconds or even longer.
2. in GUI version, no thread is implemented, so the UI is blocked after the button is pressed.

To make it better, I did some minor changes:
1. create a thread for fetching photos from flickr, and use wx events to post event to htmlwindow. Don't know how to use lock or mutex under python yet, though...

import threading
from time import sleep

(FetchDoneEvent, EVT_FETCH_DONE) = wx.lib.newevent.NewEvent()

class FetchThread(threading.Thread):
def __init__(self,w):
threading.Thread.__init__(self)
# windows for posting events
self.w = w

def run (self):
fi = None
for x in range(10):
print x
if fi == None:
(content,fi) = fetch_photo()
else:
content = fetch_photo(fi)

evt = FetchDoneEvent(source=content)
while (self.w.loading):
sleep(0.5)
wx.PostEvent(self.w, evt)

class MyHtmlWindow(html.HtmlWindow):
def __init__(self, parent, id ):
html.HtmlWindow.__init__(self, parent, id, style=wx.NO_FULL_REPAINT_ON_RESIZE)
self.Bind(EVT_FETCH_DONE, self.OnFetchDone)
self.loading = 0

def OnLinkClicked(self, linkinfo):
import os
os.startfile(linkinfo.GetHref())

def OnFetchDone(self, e):
#self.LoadPage("myflickr.html")
self.loading = 1
if self.start_fetching != 1:
self.AppendToPage(e.source)
else:
self.SetPage(e.source)
self.start_fetching = 0
self.loading = 0

class SimpleFrame(wx.Frame):

def __init__(self, *args, **kwargs):
...

def OnButtonClicked(self,e):
FetchThread(w=self.html).start()
self.html.SetPage("

Fetching......

")
self.html.start_fetching = 1
2. add a function to only return a photo info at a time, instead of returning a html file with 10 photo infos.
def fetch_photo(fi=None):
print 'fetch_photo'
if fi == None:
fi = FlickrIndex(API_KEY, SECRET_KEY, MY_USER_ID)
return fi.print_random_photos(10),fi
else:
return fi.print_random_photos(10)

三月 19, 2010
» Vimium

R1040178.JPG
Seattle.US

No chance to visit Mountain Ranier and Mountain Baker in Seattle.
However, a casual view on the road side is already attractive enough.

====

Vimium is another Chrome extension that tries to simulate the key behaviors of Vi editor. Comparing to Vrome, it allows you to customize(map/unmap) its default key mappings, which is quite useful if you are used to other key mappings.

For example, I like to use H/L for going backward/forward among the tabs with vimperator on firefox. Instead of using the default J/K with Vimium on Chrome, I can change it back to the way I like.

Link: Vimium

十一月 2, 2009
» show btchina

P2250020
Face.Venice

After upgrading the network to fiber one, I need to fully utilize its bandwidth to make sure that each penny I spent is worthwhile. How to do so? Try bt. One of the best torrent site for Chinese should be btchina. No need to login; you can search the the results form multiple forums. However, it does not support firefox browser, which is my defaul browser on ubuntu. Based on the fact of firefox's tremendous popularity, it's not hard to find a workaround for it. Here it is: Show btChina userscript for greasemonkey extension.

It not only shows the results correctly for you, but also removes the annoying ad window in the middle of the screen.

http://userscripts.org/scripts/show/33286

六月 21, 2009
» Google App engine

p7135683.jpg (by plateaukao)
Biei.Japan

I forgot how I bumped into this site Google App engine. I saw there's a small youtube video at the right-hand side. Out of curiosity, I clicked on the video and gave it a gimplse. Wow, it's written in Python. That made me more interested in how it works. Within hours, I wrote my first google app based on its simple sample provided in the Google App Engine SDK. Hey, but it's already good enough to compete with my onlinedic!! The speed is amazing comparing to my desktop client. Instead of completing my first workable (and useful) android app, I ported my onlinedic to google apps. Well, I just changed the I/O part of my original python scripts. As for the html post-processing part, I did not change them at all.

Now, I have French-English dictionary, Yahoo Chinese-English dictionary, and French Conjugator ready on the internet! I can always have these basic function set as long as I have internet access.

Here are some notes about what obstacles I encountered while writing this small app.

1. use python 2.5 instead of python 2.6
If you are using python version other than 2.5, it'd better that you install python2.5 too.
It will prevent you from bumping into a out-of-nowhere debugging error.
(I spent some time on finding this out on my ubuntu 9.0)

2. There's new_project_temple folder in the SDK root directory. That's where you can start with.

3. Do not use urllib from python library. Use urlfetch from google.appengine.api instead.

4. You can only upload/update your files to google app server, but you CANNOT download these files from the server!!
So, remeber to back up your files and use version control systems by yourself.


LINK:
http://onlinedict.appspot.com


REF:
http://code.google.com/intl/zh-TW/appengine/

六月 16, 2009
» Unofficial Plurk API in Python : A Plurk client in wxpython - Plurkao

PB124783 (by plateaukao)
Des feuilles.Annecy

Originally, I wanna study how to write a small plug-in for Windows Live Messenger, so that every time a plurk alert comes, I can easily input the plurk id and username to reply the message. However, it turns out it's a hard work to do and there's no high-level wrappers for this task (please refer to CodeProject: Windows Live Messenger Plug-in Development Bible. Free source code and programming help). Moreover, I don't even have Visual Studio installed on my home computers. How can I compile my codes without a compiler.

After searching for a while, I gave up the idea of tweaking with Windows Live Messenger. Instead, I turned to search for plurk clients for desktop. Still, in vain. What I can only find is some air clients that use plurk mobile link internally, which I can already find a firefox extension for it. That interface is not intuitive enough for me. I need something more user friendly and not so error-prone as msn plurk alerts.

Well, the unofficial Plurk API in Python is what I found so far. On its website, the demo only shows how to display user's karma value and how to list your plurks. Hm.... it's not so attractive isn't it? But!!! indeed, the module does more than these two simple not so useful demonstrations!! You can send plurks, respond to existing plurks, get plurk permemant links, and etc. That's powerful enough to let me write my own plurk client. Yeah. You bet. I am gonna write one for myself if I have enough time.

Currently, there's only one API to get plurks which is called getPlurks( ). This API will get plurks no matter they are already read or not. I did a little modification now so that it can let you choose if you only want to list unread messages only.

Update (20090617)
I wrote a small app with this python library. Currently it can merely work. The speed is slow, but it works somehow.

And~~ the screenshots!

1. Login UI: well, that's almost you need to login your account
plurkao_login (by plateaukao)

2. Main Window: you can click on RealAll or UnRead to see the plurks.  Send button allows you to post a new plurk. There's no auto update mechanism so far; you have to manually click on them when you want to see updates. And...the data fetch is done in the same thread so the UI will be a bit lagged when the button is pressed.
plurkao_plurks (by plateaukao)

plurkao_plurks2 (by plateaukao)

3. Response Window:You can click on Inside to open up a new window which shows you the responses of the plurk. Refresh button will refresh the plurk for you (cause there's no auto update now); and the Send button will post a response to this plurk.
plurk_responses (by plateaukao)

The UI is done by wxpython, so you have to install wxpython on your system if you want to test this program. And thanks for python's portability, I think it can run well under Linux too.

DOWNLOAD:
http://daniel.kao.googlepages.com/plurkao.zip

REF:
David - The Unofficial Plurk API in Python
Boa Constructor Download
http://plurkapi.com/http/methods

六月 14, 2009
» Python再起,誰與爭鋒:無名小站相簿備份軟體

PB124784 (by plateaukao)
Autumn.Annecy

這篇雖然是電腦文,不過因為國外連進來的,可能對這篇也不會感興趣,所以破例用中文寫囉。無名小站前陣子因為取消一些服務,搞得民怨四起(好像不是一直都這樣?),鬧得很多人都要出走。要搬家的話,問題就來了:經年累月留下來的文章和照片,要怎樣搬到其他部落格去呢?關於文章、留言的部分,各家部落格其實都有提出類似的服務,可以讓使用者無痛搬家;但是對於相簿這塊,目前網路上找得到的軟體大都是專門設計來下載正妹照片用的,對於相簿中的標題和詳細描述,都沒有另外處理。也就是說,你搬得了照片,搬不了照片的字。

所以,昨晚我研究了一下網路上關於無名小站相簿原始檔格式的說明和網頁間的關連,寫了一小支程式可以把單一個相簿的相片抓下來,並且把照片和文字同時放進一個html檔。這麼一來,至少自己可以有一份相片和說明在一起的備份,就算不行匯到別的部落格去,也可以在自己的電腦上看爽的。等哪天有哪個部落格支援匯入照片和文字說明時,要再匯入也不會是件難事。

接下來是在寫這支python script時,需要注意的一些問題,和特別查到的資詢:
1. URL request時的Referer:無名小站從以前就一直被人垢病相簿不行外連,因為在抓圖時,它會檢查這個request是從哪發來的。為了要順利抓到照片,在程式裡必須塞一個假的,可以通過它檢查的網址給它。如此一來,就不行用單純的urllib完成,而得改用urllib2才行。

def GetURLContent(u):
req=urllib2.Request(url=u)
#req.add_header('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113')
req.add_header('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.9.0.11) Gecko/2009060215')
req.add_header('Referer','http://www.wretch.cc')
return urllib2.urlopen(req)

如上,先在request中加上Referer的header就可以了。

2. 在網頁的原始碼中,主要有三個tag是我們要抓的:DisplayTitle, DisplayImage, DisplayDesc;然後還有一個id="next"要抓。DisplayTitle是使用者設定的照片標題;DisplayImage該行有照片的真正路徑;DisplayDesc就是使用者可以寫得落落長的照片描述;id="next"則是用來檢查還有沒有下一張圖片,有的話,程式得要一路再抓下去,直到沒有下一張。

3. 抓的時候,記得要設一下sleep,不然抓太頻繁好像會被擋掉。所以每抓一張就加個sleep(10)或sleep(20)讓它休息一下。

4. 原本有打算把描述和標題塞到jpeg的exif裡頭的,可是編碼問題一直搞不定,所以算了。因為加了,一般的image viewer也看不到。

5. 用urllib2抓下image後,可以用read()讀出image的內容;存檔時記得開檔要用"wb"的flag,這樣子存出來的照片才能看。

6. 沒了。就這麼簡單。真想不通我怎麼搞了那麼久才寫好。

下載 DOWNLOAD:
http://daniel.kao.googlepages.com/WretchGrabPhoto.py

使用方式:
0. 先在電腦上裝好Python
1. 把WretchGrabPhoto.py下載下來,放在隨便一個目錄
2. 用cmd開啟一個Dos視窗,進到該目錄,然後執行下面這行 (python執行檔的位置要看你灌的是哪一版而定)
c:\Python24\python.exe WretchGrabPhoto.py "the_url_to_the_first_photo_in_the_album" html_to_be_saved.html
3. 等它執行完,用IE或Firefox開啟你自己設定的html檔就行了

參考:
Read & Write JPEG COM and EXIF metadata [jpeg] [python] [image] [metadata] [exif]
fetidcascade.com - Python Exif Utilities
Team Programming Dragon.編程龍 » Blog Archive » 用 wget 抓無名單一相簿
下載無名Blog文章裡的圖片 | 無為閣

破解無名小站下載相簿照片作者: 井民全前言



六月 13, 2009
» New Skype UI

下午出門騎好久沒有騎的腳踏車,
不然肚子愈來愈大了。

IMAG0469 (by plateaukao)IMAG0465 (by plateaukao) IMAG0467 (by plateaukao)

才騎沒多久,就開始下雨了。
在下狂風暴雨的前一刻,我躲進了某家7-11還是全家的騎樓,
在它外頭的桌椅旁看著大雨直直下,大風猛吹。
一旁一樣是在躲雨的路人,都在討論說,這跟颱風來了沒有什麼兩樣。

IMAG0474 (by plateaukao)
回程時經過景美舊橋。
目前舊橋好像要拆了 (廢話,都剩下不到一半長了)。
摩托車可以走一旁的便道。
汽車的話就得要繞道而行了。

回家後,很廢,什麼事都沒做。
週六就這麼結束了。

IMAG0477 (by plateaukao)
晚上吃了碗辛拉麵。

****

New Skype UI is not as intuitive as I thought. And I hate its new copy message feature. Why the hell you keep adding user name and posted time in the copied message for me. Fortunately, I found that this feature (big flaw, from my point of view) can be turned off in the options.

Also, now it has a new window style that aligns conversation window to the user list. By this way, user only has to deal with one window at a time. You can switch to other conversations by selecting from the current ongoing conversation list.

The wierd thing is: I can't find documents or any help files that describe all these changes... Are they expecting every user knows how to use these strange UI once they get the updates?

六月 7, 2009
» Android Study

R8074880.JPG (by plateaukao)
Hong Kong

I wanna try out how to write Android softwares on my borrowed Magic device. In order to take notes of my studies, I will write down something here for my later refernce.

1. System requirement and Installation

» Android Study: System requirement and Installation

R8074901.JPG (by plateaukao)
Hong Kong

1. eclipse
2. JDK6
3. ant
4. android SDK: need to set up PATH in windows
5. ADT in eclipse: need to add site in eclipse to do the update.

» Connect HTC Magic to PC

R8075187.JPG
ChangChou.Hong Kong

1. Go to following URL and download "HTCDriver_Update", "HTC Sync".
2. Install them on the desktop. Done!

If you've already installed Android SDK, you can use ADB in the tool folder to interact with Magic now.

» vimperator 2.0 tips

R8075502.JPG
油條.Taipei

I've been using Firefox + vimperator 2.0 for quite some time. It makes my browsing experiences as smoothly as the silk. Today, I found some tips about how to make vimperator even better! These tips exist long before I found them. It's a pity that I did not do much survey on this before.

First of all, some key mappings to make navigation more easily:

map <c-c> Y
map <c-g> YP
map j 8<c-e>
map k 8<c-y>
map H gT
map L gt


With these settings, you can use copy keyboard shortcut as before; the movement of pressing j and k is more obvious now (8 lines each time); and change among the tabs by H and L. It's easier than gt/gT or C-n, C-p.

Another good tip that I can't find til today: to disable system input method while switching to command line mode.

style -name commandline-ime chrome://* #liberator-commandline-command input {ime-mode: inactive;}

Moreover, starting from vimperator 2.0, it supports colorscheme just as vim does. You can download several color schemes from following link:

http://github.com/VoQn/vimperator-colorscheme/tree

To jump quickly within current opened tabs, you can turn on the numbering label on tabs by following setting:

set guioptions=n/N

N means displaying the number on the tab icon; n means displaying the number after the icon.

六月 2, 2009
» Install Ubuntu 9.04 in VirtualBox on Asus epc 1000HE

R8075345.JPG (by plateaukao)
Airport.Hong Kong

I saw the fly's eyes in the airport.

****

The default operating system on my epc 1000HE is Windows. It works quite well so far, and I am already addicted to its multi-touch panel. To save my time on finding all the equivalent functions on Ubuntu, I decide to install ubuntu in VirtualBox under Windows. In this way, I can get the benefits from the Windows softwares and drivers; in addition, I can use the familiar interfaces in Linux too.

The installation is very smooth. It takes about one hour. Afterward, it took about 20 minutes to update new packages. Everything works fine except the resolution is 800x600 by default. In order to solve this problem, I installed VBox toolbox and reboot the system. Voila. You can adjust the resolution by changing the VBox windows size now.

五月 24, 2009
» Asus EEEPC 1000HE

PB265241
la feuille rouge.Annecy.France

我果然是衝動型買者。
雖然從eeepc最早期7吋版本上市,我就一直關注著這一塊市場,
不過我關心的可不是它會不會大賣,而是什麼時候要入手一台來玩玩。
沒錯,只是要玩玩而已。
因為上班已經有配電腦了,下班又有一台老當益壯的筆電在幫我養動物。
平常要看看影片,靠它完全不是問題。
所以,買來唯一的好處就是…玩玩而已,滿足自己的好奇心。

昨天又在pchome上不斷翻來覆去,最終還是下手了。
目前10吋系列的,如果不要超持久的電力,其實1萬上下就可以買得到。
之前我用過Asus的s200,所以知道9吋螢幕用起來的感覺。
這次還是選大一點10吋的。雖然攜帶上會麻煩一點,
但是舒適度會高很多。

最終,選定了1000HE,號稱擁有9.5小時電力的持久機。
很多人喜歡它的巧克力鍵盤,不過對我來說那並不是很重要的因素。
既然在s200上,打字就可以跟飛的一樣了,只要鍵盤比s200大,我都能快速適應吧。
之所以著重在電力上是因為…這樣子出門就可以不用帶充電器,也少掉到處找插座的麻煩。

不過,才到手一天,還沒機會讓它出去走走。

目前唯一比較另我討厭的缺點是:觸控板的左右鍵很難按!
要壓很用力才有反應。
其他的,so far so good...繼續熟悉中。

改天再把它改灌成linux吧。

五月 16, 2009
» Simple Ripper -- Streamripper on Windows

IMAG0228 (by plateaukao)
Ipomoea nil.Taipei

I am quite enjoying streamtunner in Ubuntu. In combination with streamripper, it can help me to record online music radios and separate each songs into mp3 files, so that I can easily put them onto my windows mobile device and listen to the latest music at work without using the office bandwidth. Streamtuner and streamripper are free softwares in linux (as most of other softwares do). However, in Windows, I can't find an equivalent software which is free too. I know there are some commercial softwares that can do the same thing, but why should I pay for a feature that I can freely use in another system?

So I spent some time searching on the internet again. This time, I found a small software that provides almost the same feature for me -- Simple Reader. It's UI interface is quite simple (as the software name suggests), but that's enough for me. The underlying engine is streamripper too. Yeah, streamripper has windows version. It's a great news to me, because if I can't find a good frontend for it, I can easily write one for myself.

REF:
Simple Ripper2
StreamRipper

四月 22, 2009
» Source Navigator vs Source Insight

IMAG0048 (by plateaukao) IMAG0049 (by plateaukao)
Turugachyo.Japan

Originalement, je voudrais dessiner tout le chateau, et laisser encore assez d'espace en haut. Comme ca, je pourrais essayer de creer quelques jolies nuages sur le ciel. Cependant, j'ai commence par dessiner les gens devant le chateau. Quand j'arrive a finir plusiers etages du chateau... voila, le chateau deja atteignait le plus haut du papier. Bah, je dois bien mesurer le distance avant que je peigne a la prochaine fois. C'est un chateau pres d'ou j'avais le voyage de travail.

****

Today, one of my colleagues asked me if I know any other tools that we can use to browse source codes efficiently. Well, it's a good question that I did not pay much attention with. While developing softwares with Visual Studio, it's common to only use its built-in intelligence engine. The intelligence engine can already fulfill most of the requirement of general programmers. If it's still notpowerful enough as a code browser, we usually use Source Insight as a second choice. Source Insight did a great job on cross referencing codes.

However, there's one drawback of Source Insight: it does not support unicode files so far. When it comes to unicode source files, you have only two options: first, convert all your source files into non unicode files, which is not a good way; second, use another tools to do the job for you.

Long time ago, I tried Source Navigator. So, I gave it another try with my current ongoing projects today. What I appreciate is, it can build the class heirarchy chart for me. The layout is clear enough to get a whole picture of class relationships. As for source code cross referencing, I found it a bit lousy and slow. Not sure if it's because my nb is not powerful enough.

REF:
http://sourcenav.sourceforge.net/index.html

四月 21, 2009
» Lexipedia / 美術館之龐畢度中心收藏展

IMAGE_044.jpg (by plateaukao)
YanmingSan.Taiwan

Lexipedia,一個好玩的網站,可以把一個單字相關的字詞用mind map的方式列出來。
可能可以增加記憶的速度吧。

REF:
http://lexipedia.com/

****

上週就發現到有這個展覽,
不過沒有一時衝動,趕在週末跑去。
4/18才開展,選在那個週末去,擺明是跟自己過意不去。

龐畢度,曾經在它門口外經過兩次,卻沒有一次有進去。
由此可知,我是個大老粗,對於這些博物館一點兒研究也沒有。
不過,既然人家都大老遠地從法國跑來台灣展覽,
看在票價不貴的份上,我還是找了一天去逛了一圈。
其中,最讓我欣賞的,還是米羅的藍色二號(是二號吧?)。
大塊的色彩,再加上點和線;畫畫何必搞得太複雜呢?

另外,衝擊比較大的是另一個個展:方力鈞的生命之渺。
一堆小光頭和蓮花,在天空中奔跑;
一個大光頭在水中游來游去,等等。
對於一個真正的畫家來說,重要的不是技巧(因為畫家人人都得具備),
而是想要透過做出來的作品表達什麼,怎麼表達。
看到牆壁上他的年史,他在我這年紀時就已經揚名國際了。

我還在原地蹉跎光陰啊…

四月 14, 2009
» 唱歌 / Lunch Reader / photos of GRD II

IMAG0013.jpg (by plateaukao)
Daan Forest Park.Taipei.Taiwan

像這樣子嗎?
有粗有細,長短不一的線?
我沒慧根,哈。

****

人是需要放鬆的。
自己的嗓門特別大,平常還得注意說話不行太大聲。
不過唱歌的話,就隨便了。
反正有mic,誰唱都一樣大聲。

****

吃飯時,覺得用滑鼠移來移去看新聞很麻煩嗎?
那來試試這個會自動跳新聞的Lunch Reader吧。

REF:
http://playpcesor.blogspot.com/2009/04/lunch-reader.html

****

原來GRD II 可以拍出這麼棒的照片。
我的GRD II 看了一定會哭的。

http://blog.ricoh.co.jp/GR/archives/2009/04/post_357.html

A Feedjack powered Planet
A Django site.