發表文章

目前顯示的是 9月, 2011的文章

touch data for all kinds

用AppEngine寫程式, 經常會有需要一次update所有的data, 可是如果真的要上傳一個新的version去GAE上執行很麻煩, 而且又因為GAE很容易timeout, 要把一件事分很多段來做, 或是用mapreduce. 總之是很花時間的苦差事. 而且通常這種事只要做一次, 上傳一份特別的code總是很不舒服. 後來在網路上看到了這個作法, 真是相當貼心呀. 首先要先用remote api. $ python ~/scripts/google_appengine/remote_api_shell.py -s xxxx.appspot.com 輸入帳號跟密碼後, 就會出現標準的python command line App Engine remote_api shell Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) [GCC 4.5.2] The db, users, urlfetch, and memcache modules are imported. xxxx> 先執行兩行 xxxx> sys.path.append(os.getcwd()) xxxx> from models import * 最後一行會把這個AP定義好的model都import進來, 如果你們沒有models.py做這件事的話, 就不要學了... :P 然後學到的重點就是可以用下面這一招 >>> len ([e.put() for e in XXXX.all().filter().fetch(1000)]) 只要有先定義好的index, filter()裡面的條件可以任意的設定. 把filter()整個拿掉也行. 這樣它會把每一個entity拿出來, 再執行一次put(). 這樣就可以達到更新model的用意, 而且顯然也不受timeout的限制, 十分好用.

在米國買MBA或iPad 2

圖片
查了一下米國的價錢, 跟台灣APPLE的定價一比, 台灣APPLE真是佛心來著. iPad的價錢幾乎跟米國一致, 最多差不多20塊米金. 而MB也才差個三四千塊, 而且這還是在Amazon買, 未稅才差這麼多, 如果加上稅金, 也是幾乎跟台灣差不多.

Honeycomb Tablets partition tables

Acer $ adb shell df Filesystem             Size   Used   Free   Blksize /dev                   361M    32K   361M   4096 /mnt/asec              361M     0K   361M   4096 /mnt/obb               361M     0K   361M   4096 /system                590M   455M   134M   4096 /data                   12G   200M    12G   4096 /cache                   1G    32M     1G   4096 /system/vendor          29M    25M     3M   4096 /mnt/sdcard             12G   200M    12G   4096 Asus $ adb shell df Filesystem             Size   Used   Free   Blksize /dev                   364M    32K   364M   4096 /mnt/asec              364M     0K   364M   4096 /mnt/obb               364M     0K   364M   4096 /system                503M   399M   104M   4096 /data                   27G   245M    27G   4096 /cache                 521M     8M   512M   4096 /Removable             364M     0K   364M   4096 /mnt/sdcard             27G   245M    27G   4096 Moto $ adb shell df Filesystem             S

AT&T 帳單

Fiona 8/26到美國, 沒隔幾天(8/30晚上)我就帶她去辦這裡的門號, 順便把我的門號由Wayne的Family plan裡移出來. 沒想到前天就收到帳單, 奶奶個熊, 居然要260.95大洋. 而且今天也才不過9/12號... 於是我就潛心研究一下這次的帳單的由來, 怎麼會要這麼貴咧. 最後讓我悟道了, 畢竟電腦算的還是不會錯... :S 大致的明細是這樣的 Billing period: Aug 30~Sep 02 Monthly Service Charges: $168.38 Usage Charges: $16.65 Credits/Adjustments/Other Charges: $61.74 Government Fees & Taxes: $14.18 Total: $260.95 才區區三天, 就要我交$260.95元? 八月 Line 1 Rate Plan: $1.00 DataPro 2GB: $2.50 Usage Charge: $14.85 Activation Fee: $36.00 Other charges: $3.28 Taxes: $5.38 Line 2 Rate Plan: $5.00 World Connect: $0.40 DataPro 2GB: $2.50 Family Messaging Unlimited: $3.00 Usage Charge: $1.80 Transfer of Service Responsibility: $18.00 Other charges: $4.46 Taxes: $8.80 Total: 106.97 (其中$54.00是一次性的手續費) 九月 Line 1 Rate Plan: $9.99 DataPro 2GB: $25.00 Line 2 Rate Plan: $60.00 World Connect: $3.99 DataPro 2GB: $25.00 Family Messaging Unlimited: $30.00 Total: $153.98 ($143.2 after discount) 數字看起來很多, 主要原因是他似乎把9/3~10/2的費

Google url shortener

Google提供了goo.gl這個服務, 可以將網址縮短 http://www.google.com/ -> http://goo.gl/fbsS 程式的用法是 縮網址 $ curl https://www.googleapis.com/urlshortener/v1/url -H 'Content-Type: application/json' -d '{"longUrl": " http://www.google.com/ "}' {  "kind": "urlshortener#url",  "id": " http://goo.gl/fbsS ",  "longUrl": "http://www.google.com/" } 恢復短網址 $ curl 'https://www.googleapis.com/urlshortener/v1/url?shortUrl= http://goo.gl/fbsS ' {  "kind": "urlshortener#url",  "id": "http://goo.gl/fbsS",  "longUrl": " http://www.google.com/ ",  "status": "OK" } 看統計資料 $ curl 'https://www.googleapis.com/urlshortener/v1/url?shortUrl=http://goo.gl/fbsS&projection=FULL' {  "kind": "urlshortener#url",  "id": "http://goo.gl/fbsS",  "longUrl": &quo