2015-03-01から1ヶ月間の記事一覧

$.Deferredを使って、一定間隔でスリープしながらループする

まずはSleepメソッドを自作する。 function Sleep(msec) { var d = $.Deferred(); setTimeout(function() { d.resolve(); }, msec); return d.promise(); }繰り返したい処理の本体の実装。こちらも、Deferredを返すようにしておく。 function MyFunc(cnt) { …

サーバ上のdatastoreをローカル開発サーバにリストアする

GAE

サーバのデータをローカル開発サーバ上にリストアする方法。 自身のアプリケーションIDを APP_ID とします。 appcfg.py download_data --application=`APP_ID` --url=http://APP_ID.appspot.com/_ah/remote_api --filename=hoge.dump --email=Googleアカウン…

ndbのquery結果の件数を取得する方法

GAE

自分の中でごっちゃになっていたので整理する。 Queryのcount()のリファレンスには、こうある。 This returns the same result as len(q.fetch(limit)) but more efficiently. query = MyModel.query(条件) cnt = query.count() #OK cnt = len(query) #NG cn…