發表文章

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 sh...

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": ...

恢復EVO 4G的Firmware

手上的 EVO 4G 之前被我升級成 cyanogen mod 版, 因為聽說它很讚, 而且有EVO 4G當時沒有的2.3 release. 不過我實際unlock bootloader, 換掉recovery, 燒上cyanogen mod 7.0.3.1後, 我覺得它不是那麼妙. 所以一直想把它換回HTC的正式版. 直到今天才有時間跟找到文章來做這個. 還真的挺酷的, 有人把它寫成Google doc, 可以一步一步照著做. Link 一直沒法升級的Galaxy Tab 10.1, 昨天也終於升級Android 3.1成功了...

辦信用卡

來美國另外一個重要的課題就是使用信用卡. 在台灣我有無數的信用卡, 包含了最早的慶豐, 台新, HSBC, 中國信託, 富邦等等, 每一張都是白金卡. 其中幾家還主動寄升級為鼎級卡的邀請給我, 但是我覺得沒什麼好處所以統統拒絕. 這些卡對米國的銀行來說, 統統沒用! 我的信用紀錄在美國仍就是白紙一張. 難怪王又曾可以在美國待的很舒服. 昨天我在線上試著申請我的薪資轉帳銀行, BOA的信用卡. 一番交涉之後他拒絕了我的credit card的申請, 要我辦secured credit card. 而它需要$39的年費, 當下我拒絕了. 回來做一下功課. BOA: Fully Secured Credit Card , Annual fee: $39 沒啥特別的, 需要12個月才能升級為unsecured credit card. Payment tag Wells Fargo: Secured Card , Annual fee: $18 看起來它有個性化信用卡的功能, 可以放兒子的照片上去, 加分! Auto rental insurance Citi: Secured MasterCard , Annual fee: $29.001 需要18個月才能升級為unsecured credit card. Auto rental insurance Payment tag Capital One: Secured MasterCard , Annual fee: $29 Report to 3 bureaus 沒啥其它功能 HSBC: Vary Chase: N/A AMEX: N/A DISC: N/A 照上面看起來, 應該會從Wells Fargo下手吧.