日期: 2011 年 3 月 8 日
Google Storage Python API
到 Google Storage 申請帳號,過兩天收到認證信,開通以後填入信用卡帳號,就可以開始使用了,
先到 key management 申請一個 key ,然後抓 http://code.google.com/p/gsutil/ API 的函式庫,
然後用 Python 2.5 ~2.7 執行 gsutil ls 他就會幫你產生 .boto 設定檔 填入 剛申請的 key 跟 secret,就可以按照範例執行程式了。
#!/usr/bin/python import StringIO import os import shutil import tempfile import time import boto # Read developer keys from the ~/.boto config file. config = boto.config # URI scheme for Google Storage. GOOGLE_STORAGE = 'gs' # URI scheme for accessing local files. LOCAL_FILE = 'file' now = time.time() CATS_BUCKET = 'cats-%d' % now DOGS_BUCKET = 'dogs-%d' % now for name in (CATS_BUCKET, DOGS_BUCKET): # Instantiate a BucketStorageUri object. uri = boto.storage_uri(name, GOOGLE_STORAGE) # Try to create the bucket. try: uri.create_bucket() print 'Successfully created bucket "%s"' % name except boto.exception.StorageCreateError, e: print 'Failed to create bucket:', e
css 定位模型
最近覺得自己講話、描述越來越不清楚,所以想找幾個曾經沒足夠能力用口頭來描述的概念,用文章的方式重整一下自己的條理。
今天的主題是 css 定位模型,主要範例為此網站 http://www.barelyfitz.com/screencast/html-training/css/positioning/
他內容有十個 tab 幾乎將所有較可能發生的情況都舉了一次例子,所以是一個適合說明的範例。
我想要用兩種方式描述,一種是整理成簡短適合口頭介紹 定位模型的解釋。
另一種是完整定義清楚的解釋。 Continue reading…
![marshmallow[1]](https://mlwmlw.org/wp-content/uploads/2011/03/marshmallow1-300x225.jpg)