2008年9月19日金曜日

Uploading index definitions Error


何日かぶりに appcfg.py update xxxx/ で更新しようとしたところ以下のエラーで先に進まなくなってしまった。
タイミングとして新しいイメージファイルをいくも追加したので、それが原因かと思ったが、そうではないらしい。

Uploading index definitions.
Error 400: --- begin server output ---
Building a composite index failed: ApplicationError: 3
--- end server output ---

Issue 287:Explosion with >100 indexes


To vacuum your indexes: 
1. Create a backup of your index.yaml specification
2. Remove the definitions of the indexes in Error from your index.yaml file
3. Run appcfg.py vacuum_indexes your_app_dir/
4. Replace the modified version of your index.yaml file with the original
5. Run appcfg.py update your_app_dir/


を参考に まず index.yaml をクリアしてから vacuum すると、

This index is no longer defined in your index.yaml file.

ancestor: true
kind: Timeline
properties: []

Are you sure you want to delete this index? (N/y/a): y

ときかれるので、N として、いかにも不要そうな複合インデックスをいくつか削除して
appcfg.py vacuum_indexes your_app_dir/

にて今度は Y にて削除した。
いくつも削除したため、ダッシュボードでみると index の delete のタスクが走りだした。このタスク中に appcfg.py update xxxx/ すると
Server Error (500) A server error has occured.
となる。しばらく、時間をおいたところ無事 update できたが、その直後から今度はindex 作成のタスクがいくつも走りだした。




http://code.google.com/appengine/docs/datastore/queriesandindexes.html#Big_Entities_and_Exploding_Indexes

To handle "Error" indexes, first remove them from your index.yaml file and run appcfg.py vacuum_indexes. Then, either reformulate the index definition and corresponding queries or remove the entities that are causing the index to "explode." Finally, add the index back to index.yaml and run appcfg.py update_indexes.

2008年9月13日土曜日

Google Visualization API その2


Visualization APIを用いたプログラミング 
を参考に SpreadSheet からの Timeline の描画を行なってみた


Chart API だとすぐにぶつかるデータ数の壁をあっさりクリアしてしまった。
おそるべき JavaScript 。


・メモ
- spreadsheet は Share Anyone can this document WITHOUT LOGGING IN
 にしておくこと
- packages:["annotatedtimeline"]
 にSpreadSheet から 123.4 のように少数点付きの値を
 データとして与える場合 123.*100/100 のように一度 乗算して除算しないとなぜかうまくいか
 なかった。 ( javascript を理解していない? ためか  これには苦労した)
-  query.setQuery("select C, J from `Sheet 1` order by C");
 Sheet 1 を Sheet 2 に変えても、先頭のシートしか参照できない。 要調査

2008年9月12日金曜日

Google Visualization API


Google Visualization API の
Gallery に

Google Finance で使用されているものが登録されていた
さっそく Google App Engine と組み合わせ、使用したところ動作した
けれども、どうもデータの表示範囲のスクロールがなぜかうまくいかなかった。
原因はデータのラインの本数で、折れ線グラフが1本だけだと、下部分の
スクロール機能が動作しない仕様らしい。




2008年9月8日月曜日

Google Chart API で日本語

日本語を使用するには urllib.quote() 
u' 日本語'  はNG

import urllib

chart_ttile = '日本語'

      url2 = '<img src="http://chart.apis.google.com/chart?'
      url2+= 'chs=600x200'
      url2+= '&chtt=' + urllib.quote(chart_title)


Memo

2008年9月7日日曜日

Timeout Error

GAE で今まで動作していたアプリが動作しなくなった。

TemplateSyntaxError: Caught an exception while rendering:

テンプレートが重いのが問題かと 表示内容をけづっていったところ
動作したり、しなかったり。

  File "/base/python_lib/versions/1/google/appengine/api/datastore.py", line 1627, in _ToDatastoreError
raise errors[err.application_error](err.error_detail)
Timeout
同様の現象の報告もあり、様子をみることに。

http://groups.google.com/group/google-appengine/browse_thread/thread/53e7e0a34f3bec89/37b2a5a033ee0ac0?hl=en&lnk=gst&q=timeout+error#37b2a5a033ee0ac0

つい先日も  login: admin  の設定の URL ではログインできなかったが、翌日は復活していた。

2008年9月5日金曜日

Property XXX must be a str or unicode instance, not a tuple

val = "test",

aa = Img( p1 = val )
aa.put()

不要なカンマがある場合などでもこのエラーとなる
BadValueError: Property p1 must be a str or unicode instance, not a tuple

2008年9月3日水曜日

トランザクション エラー Nested transactions are not supported.

1. get_or_insert  自体がトランザクションなのでこれを含めたトランザクションを
  作成しようとするとエラーとなる。

File "C:\Program Files\Google\google_appengine\google\appengine\api\datastore.py",
   line 1386, in RunInTransaction'Nested transactions are not supported.')
BadRequestError: Nested transactions are not supported.


2.動作確認


First up is batch writes. You can now include entities in different entity groups in a single db.put() or db.delete() call. Entity modifications are only atomic within each entity group, but a single call that spans entity groups will be more efficient than a call for each group, which was required before.


以下は SDK だと Cannot operate on different entity groups in a transaction:
となるが Cloud では動作した。

class Dummy2(db.Model):
d1 = db.StringProperty()

class Dummy(db.Model):
d1 = db.StringProperty()

def tran():
d2 = Dummy2(d1 = "aaab")
d1 = Dummy(d1 = "aaab")

d1.put()
d2.put()

tran()


3. その他

   トランザクションの中で検索は実行できない。
  Can't query inside a transaction

Swift+VSCodeでまた「一致するワークスペースシンボルがありません」で悩む

 Xcode のプロジェクトフォルダを vscode で開いて cmd+T のシンボル検索で 「一致するワークスペースシンボルがありません」 となる 結論としては Package.swift ファイルが必要だった。 一行目の  // swift-tools-version: 6....