2009/06/30
荷蘭文學習網站
Annecy.France
昏暗的燈光,冷清的街道,連接著喧嘩與寂靜兩端。
今晚,該往哪頭去呢?
****
幾年沒接觸,現在的線上學習網站愈做愈好。
裡頭有好幾個是免費的,而且內容不再光是純文字而已,連audio和video也有。
這下子再學不好,就沒有任何藉口了吧。
http://www.taalthuis.com/course/index.htm
http://www.learndutch.nu/index.htm
http://www.dutchgrammar.com/
太極
2009/06/29
Bon week-end
2009/06/28
流水帳
2009/06/27
2009/06/22
2009/06/21
Google App engine
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/
The Thirteenth Tale 第十三個故事 -- Diane Setterfield
2009/06/20
nrg to iso conversion under linux (ubuntu)
2009/06/19
成長,就意謂著失去嗎?
ca me manque
2009/06/17
法文文法 -- 動詞時態教學
Semnoz.France
快忘光了。有空來複習一下,順便記錄一下吧。
法文主要有下列動詞時態:
l'indicatif 直陳式
le present 現在式
l'imparfait 未完成過去式
le passe simple 簡單過去式
le passe compose 複合過去式
le passe anterieur
le plus-que-parfait
le futur simple
le futur anterieur
le futur dans le passe
le futur anterieur dans le passe
le passe immediat
l'imperatif 命令式
le conditionnel 條件式
le subjonctif 虛擬式
l'infinitif 不定式
le passe simple 簡單過去式
Sushi.Taipei
le passe simple(簡單過去式),唯一一個還沒學到怎麼動詞變化的時態,所以趁還有力氣時,先把它寫一遍。這是一個主要用於書寫的時態。一般會話時,對於過去的事情,不是用l'imparfait就是用le passe compose在描述。了不起,頂多再加上個le plus-que-parfait。但是在書寫時,一般會用le passe simple來取代掉le passe compose。至於原因…我也不知道。可能在寫字的時候,le passe compose,每次都得寫兩個字,法國人覺得很麻煩,所以又生出來le passe simple來減輕句子中到處擺的動詞(純屬鬼扯…)。l'imparfait跟le passe simple的用法會在別篇裡頭說明,這邊就不多說廢話。我們直接來看一下動詞的變化吧。
第一類動詞 (er 結尾,例如aimer)
tu aimas
il aima
nous aimâmes
vous aimâtes
ils aimèrent
第二類動詞 (ir 結尾,例如finir)
je finis
tu finis
il finit
nous finîmes
vous finîtes
ils finirent
第三類動詞 (亂七八糟動詞)
je courus
tu courus
il courut
nous courûmes
vous courûtes
ils coururent
je vins
tu vins
il vint
nous vînmes
vous vîntes
ils vinrent
不規則動詞 etre
je fus
tu fus
il fut
nous fûmes
vous fûtes
ils furent
不規則動詞 avoir
j'eus
tu eus
il eut
nous eûmes
vous eûtes
ils eurent
很機車的變化吧。規則的動詞還算好記,在單數時,只要把詞幹接上ai, as, a就行(avoir的現在式變化);複數時,再記一下特別的變法就行。
我每次看小說時都會搞混的,就是avoir跟etre的變化。明明是Etre,可是變化後,變成F開頭;然後明明原本是A開頭的avoir在變化後,變成e開頭的字。有時會讓我弄不清究竟他是有了什麼,還是是什麼…
以上。
REF:
http://fr.wikipedia.org/wiki/Pass%C3%A9_simple
2009/06/16
2009/06/15
Unofficial Plurk API in Python : A Plurk client in wxpython - Plurkao
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
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.
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.
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
2010/02/17 補充:
既然有官方版的plurk api了,照例隨便玩玩看:
2009/06/14
Python再起,誰與爭鋒:無名小站相簿備份軟體
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文章裡的圖片 | 無為閣
破解無名小站下載相簿照片作者: 井民全前言
New Skype UI
下午出門騎好久沒有騎的腳踏車,
不然肚子愈來愈大了。
才騎沒多久,就開始下雨了。
在下狂風暴雨的前一刻,我躲進了某家7-11還是全家的騎樓,
在它外頭的桌椅旁看著大雨直直下,大風猛吹。
一旁一樣是在躲雨的路人,都在討論說,這跟颱風來了沒有什麼兩樣。
回程時經過景美舊橋。
目前舊橋好像要拆了 (廢話,都剩下不到一半長了)。
摩托車可以走一旁的便道。
汽車的話就得要繞道而行了。
回家後,很廢,什麼事都沒做。
週六就這麼結束了。
晚上吃了碗辛拉麵。
****
不然肚子愈來愈大了。
才騎沒多久,就開始下雨了。
在下狂風暴雨的前一刻,我躲進了某家7-11還是全家的騎樓,
在它外頭的桌椅旁看著大雨直直下,大風猛吹。
一旁一樣是在躲雨的路人,都在討論說,這跟颱風來了沒有什麼兩樣。
回程時經過景美舊橋。
目前舊橋好像要拆了 (廢話,都剩下不到一半長了)。
摩托車可以走一旁的便道。
汽車的話就得要繞道而行了。
回家後,很廢,什麼事都沒做。
週六就這麼結束了。
晚上吃了碗辛拉麵。
****
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?
2009/06/13
食記
A small utility to customize Manila Program Tab on HTC Windows Mobile devices
ManilaProgramSetting
Because I constantly re-install my devices with different ROM builds, I used to installing softwares into my SD card. Although I don't have to reinstall all these softwares, every time I want to launch them, I have to launch File Explorer first; go to that directoy on SD card. And finally luanch it manually. It's so tiresome that I wanna configure these apps in my Manila Program Tab, so that I can launch them by no more than two clicks.
Current Manil Program Tab design only allows you to add programs which are listed in \windows\Start Menu\Programs. In official way, it's not possible to do so. As a consequence, I decided to write a small utility to help myself on this boring task, and by the way, I can practice my poor C# coding skills a bit.
It's very easy to create UI layouts with C# (though it's usually very ugly). As you can see on the screenshot, there are two buttons on the top, so that user can easily switch to other program icon settings. File Path and Display Name is what we need to fill in the registry keys. When you switch to a program icon, current setting will be brought out. And then, you can press "Select File" button to any other exe files on the device (or SD card). Before switching to other program icon, remember to press LSK: Update, to write the modification back to registry key.
Finally, you can exit the program and go to Manila Program Tab and take a loot. What? it's not as what you modified? oh, because Manila does not know you changed its registry keys. You need to do something to let it reresh the UI. this is very easy too: just press RSK: Remove and then press Done again. Your modification will be shown now.
Programming Tips:
1. MS built-in OpenFileDialog really sucks!!! It will teat "My Documents" as root, and only lists files under it and one more subdirectory. It's not useful for most of the applications!! Anyway, I don't wanna write one by myself; so I found some simple classes written by others on the internet. It's from Reference 1. With his efforts, I can get my exe file name on sd cards now.
2. In order to read registry key, Microsoft.Win32 should be used. Here's how I use it:
RegistryKey regManilaSetting = Registry.LocalMachine;
regManilaSetting = regManilaSetting.OpenSubKey(@"Software\HTC\Manila\ProgramLauncher\" + (string)comboBox1.SelectedItem,true);
textBoxPath.Text = (string)regManilaSetting.GetValue(@"Path");
REF:
1. MobilePractices
Download:
http://daniel.kao.googlepages.com/ManilaProgramSetting.exe
2009/06/12
食記
Annecy.France
Ca me souvient un petit magasin a Annecy, qui vend des oeuvres artificielles.
Je les ai trouvees plusieurs fois a Taipei aussi, mais en taille plus petite.
Taipei.Taiwan
Cette photo est prise dans un batiment plubic a Taipei.
Quand il fait beau, la vue d'ici est magnifique.
Regard, on peut meme voir la montagne de guanyin!!
Quel beau temps!
Leiden.Netherlands
Quand je me suis promene au bord du lac pres de la ville de lyde aux pays-bas,
j'ai vu un homme qui etait assis sur le banc en lisant un livre.
C'etait tres tranquille.
Grenouille
C'est un appareil de FM radio.
Mais il ne marche pas depuis longtemps.
****
晚餐,拖到九點多才吃,不太像我。
跑到景美夜市吃蚵仔麵線。
雖然大腸不多,但蚵仔可是滿滿一碗,而且吃起來沒有砂。
吃完蚵仔麵線,再來盤冰吧。
這家冰店從我國小有印象開始,就已經存在了。
當初店裡幫忙招呼客人的兩個小女孩,現在也已經長大成人。
今天在店裡的,應該就是其中一個吧。
離題了。
下次應該點一下新的牛奶雪花冰的。
2009/06/11
The long way to port my onlinedic on Android platform
Cannes.France
坎城除了大家比較熟悉的海邊的星光大道外,
其實在車站的另一個方向有個舊城區。
跟海邊的人潮比起來,
這兒顯得寧靜許多(不過沒有上空美女就是了。
看著清一色的橘紅色屋頂和遠方的山水,晒著不會太炙熱的陽光,
這兒真的很適合度假。
難怪在Bienvenue chez les Chi'tis裡的那個老婆,那麼想要搬到法國南部;
而在南法,特地搬來這兒住的英國人也是屬一屬二多的。
****
After glancing through the basic documents of Android SDK, I still have a lot of work to do before porting my onlinedic to this platform:
1. Find the UI components that I need:
1.1 EditControl
1.2 Button (for start searching)
1.3 HTML viewer
2. How to create and use its menu
3. Find the component to open http requests
4. Find the component to post-process the received html file
As for item 1, it's not so difficult because the UI components I need are few.
Except for the 1.3 HTML viewer, I spent some time to make it work.
First of all, the component to display html content on android is
android.webkit.WebView
You can create this component in the resource and find it by id in the java source code.
Secondly, you need to add a permission line in the Manifest xml file in order to have the access to load URLs.
<uses-permission android:name="android.permission.INTERNET" />
Since I will only use this component to display the processed results of the html, I don't have to study too much about what actions it supports.
As for 2, 3, and 4, I will update later once I know how to accomplish them.
voila, here's the result of today's work:
****
好久沒到韓風饌吃東西了。
久久吃一次也是不錯的。
新拿到的傢伙太大隻了。
拍起照來手會不穩。
不過,看電子書應該很過癮吧。
訂閱:
文章 (Atom)
乩童警探 一二集
接連看了兩集。第一集還算新鮮,到了第二集就看得比較慢了。一來,劇情雖然常會提到乩童,但真的跟乩童又沒有什麼關係。第二集後半大概就猜出是怎麼一回事了,但還是很享受在作者解釋的過程。只是前面舖陳有點久,而且人物有點多,再加上我是斷斷續續的看,看到後來都快忘了誰是誰,或是誰曾經出過什麼...