2010/03/31
霞光, 火天之城
Riverside.Taipei.Taiwan
原來五十公里比我想像中的還要長。
不過時速平均不到十公里,也太誇張了。
====
火天之城。沒有字幕,每到重點必聽不懂。
不過,電影畢竟是電影,光看畫面也可以猜出個七八成。
2010/03/22
onlinedict線上版小改進
lac d'Anncey.France
在這邊看到,透過點小設定,可以讓Chrome的網址列充當搜尋引擎,自訂想要的搜尋。之前用Google App Enginen包裝出來的OnlineDict,只有吃由form餵入的資料,也就是只支援post的方式。為了要讓它也可以做為Chrome搜尋用的引擎,就得要為它做點小改變,讓它也支援get方式的查詢才可以。
所以,我改了一下程式碼。有多簡單呢?就copy paste一行程式碼而已。
原本def get(self)底下是直接呼叫OutputHtml(),現在改成呼叫post(self),就可以跟post做一模一樣的處理了。
#/usr/bin/env python
import cgi
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
import os
from google.appengine.ext.webapp import template
import Dict
class OnlineDic(webapp.RequestHandler):
def __init__(self):
self.fren_dic = Dict.collins_fren_dict()
self.ench_dic = Dict.yahoo_dict()
self.eijiro_dic = Dict.eijiro_dict()
def get(self):
self.post()
def post(self):
word = self.request.get('word')
dic = self.request.get('dic')
if dic == 'Fr-En':
content = self.fren_dic.doSearch(word)
content = content // handling
elif dic == 'Ja-En':
content = self.eijiro_dic.doSearch(word)
else:
content = self.ench_dic.doSearch(word)
self.OutputHtml(content,dic)
def OutputHtml(self, content="", dic=""):
template_values = { 'content': content,
'dic': dic,
}
path = os.path.join(os.path.dirname(__file__), 'index.html')
self.response.out.write(template.render(path, template_values))
application = webapp.WSGIApplication(
[('/', OnlineDic)],
debug=True)
def main():
run_wsgi_app(application)
if __name__ == "__main__":
main()
# vim:set nu et ts=4 sw=4 cino=>4:
網站在此:http://onlinedict.appspot.com/
目前支援法翻英,範例如下:
http://onlinedict.appspot.com/?dic=Fr-En&word=%s
英翻中
http://onlinedict.appspot.com/?dic=En-Ch&word=%s
日翻英
http://onlinedict.appspot.com/?dic=Ja-En&word=%s
為了貼上面的程式碼,特別去找了一個透過javascript的syntax highlighter,路徑如下:
http://alexgorbatchev.com/wiki/SyntaxHighlighter
使用方式可以參考下面這個網址:
http://www.craftyfella.com/2010/01/syntax-highlighting-with-blogger-engine.html
2010/03/21
高速鐵路新時代 -- 蘇昭旭
2010/03/20
Vimium
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
Link: Vimium
2010/03/18
龍紋身的女孩
2010/03/15
2010/03/14
Did you hear about the Morgans 名牌冤家
忠犬小八
等一個人咖啡 -- 九把刀
2010/03/11
追尋現代中國 -- 最後的王朝 史景遷
2010/03/10
2010/03/09
Bouquet Final (Final Arrangements)
2010/03/07
電影
2010/03/05
onlinedict by google app engine
Central Station.NYC.US
I posted an article about using Google App Engine in last June, and the experiment target is the onlinedict. Everything goes well and since onlinedict is originally written in python, the porting task is without any efforts.
However, there's one limitation of using Google App Engine: You can get your codes back from the server. You have to keep your codes somewhere. That's quite strange as a policy. I know it may be easier to control the whole system on google side, but as a user, it's troublesome ofr me because I am too lazy to my stuff in another source control website.
As a consequence, I lost my codes after re-installing OS on my nb for several times. Although my original work still runs well, it looks bad on all mobile devices. The words are too small to read. However, I don't have original codes anymore! no way to improve it at all!
Finally, I decided to rewrite it again,since this website should help me most on mobile devices. If the outlook on devices are bad, then it is somehow useless to me. Well, the first thing to do is study again how to apply the google app engine framework into my dictionaries. With the help of the tutorial, I quickly achieved what I have done last time: a working fr-en, ch-en dictionary, and, plus eijiro dictionary!
The most difficult part (not really difficult at all, I just don't know how to do) is to adopt some css style to make it look great on mobile devices. Well, I found a good refernce site: http://building-iphone-apps.labs.oreilly.com/. And, it's free!
Okay, after several hours of work, I am happy with my new dictionary now. The font size is good, the input control is at the right position, with some hints in the box. Three online dictionaries are available. It's time to go to sleep again~~
2010/03/04
訂閱:
文章 (Atom)
跨界通訊 - 陳又津
昨天從圖書館借的書,一口氣把它看完了。很特別的題材,在講老人的社會問題,以及人為什麼不行自行決定生死,只能在醫院拖著已經殘破不堪的身體,直到最後短氣的那一刻。 書中還有提到想成為女生的男生,以及透過網路可以達到的一些社群效果。算是把一些現代的元素組合得蠻好的作品。 推薦。
-
Sushi.Taipei le passe simple(簡單過去式),唯一一個還沒學到怎麼動詞變化的時態,所以趁還有力氣時,先把它寫一遍。這是一個主要用於書寫的時態。一般會話時,對於過去的事情,不是用l'imparfait就是用le passe compose在描述。了...
-
(山寺.日本) 幾乎快忘了當初有拍這張照片。記憶力真的愈來愈差了。 幾年前的藏王行,途中有在山寺稍做停留。 山寺是個小鎮,鎮上最有名的(或是目前我還記得的…),就是它建在山上的寺廟。 上山的路很陡,想必當初寺廟蓋得也很辛苦吧。 到了山腰或是山頂,就可以放眼往山谷和另...
-
(Jellyfish.Osaka.Japan) 去水族館看水母,已經成了到各地水族館既定的行程。在微光下,要拍攝出動人的水母照片,難度頗高。若是能拍攝到,當天的心情一定會特別好。 **** 新版的教育廣播電台網站,把原先可以直接下載的連結全變成了網頁。有些課程只能線上...