2009年12月13日日曜日

Task Queue, Transaction

Scheduled Tasks With Cron for Pythonhttp://code.google.com/intl/en/appengine/docs/python/config/cron.html
  • Task Queue戦記 - スティルハウスの書庫
  • TaskQueueをローカルでデバッグする方法 - ひがやすを blog
  • Offline Processing on App Engine: a Look Aheadを見たメモ - スティルハウスの書庫

    タスク Task -- http://code.google.com/intl/ja/appengine/docs/python/taskqueue/overview.html



    やはり追加テーブルとのトランザクションはできない
    けれども、子孫となるテーブルにすればできないこともない

    key_name ="http://pages.google.com/edit/kwin786/Impressionnism01_s.jpg-2"
    r = db.get(db.Key.from_path('Imgmap',key_name))
    db.run_in_transaction(update_imgmap,r.key())

    def update_imgmap(key):
    r = db.get(key)
    r.regimgmapcontenturl = "1"
    s = ImgmapContentUrl(
        key_name=r.content_url,
    #   parent=key,
       content_url = r.content_url)
    s.put()
    r.put()

    Traceback (most recent call last): File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 507, in __call__ handler.get(*groups) File "C:\google\museum-in-cloud\cron.py", line 70, in get db.run_in_transaction(update_imgmap,r.key()) File "C:\Program Files\Google\google_appengine\google\appengine\api\datastore.py", line 1904, in RunInTransaction DEFAULT_TRANSACTION_RETRIES, function, *args, **kwargs) File "C:\Program Files\Google\google_appengine\google\appengine\api\datastore.py", line 2001, in RunInTransactionCustomRetries result = function(*args, **kwargs) File "C:\google\museum-in-cloud\cron.py", line 148, in update_imgmap s.put() File "C:\Program Files\Google\google_appengine\google\appengine\ext\db\__init__.py", line 797, in put return datastore.Put(self._entity) File "C:\Program Files\Google\google_appengine\google\appengine\api\datastore.py", line 198, in Put tx = _MaybeSetupTransaction(req, keys) File "C:\Program Files\Google\google_appengine\google\appengine\api\datastore.py", line 2090, in _MaybeSetupTransaction raise _DifferentEntityGroupError(expected_group, group) File "C:\Program Files\Google\google_appengine\google\appengine\api\datastore.py", line 2122, in _DifferentEntityGroupError b.kind(), id_or_name(b))) BadRequestError: Cannot operate on different entity groups in a transaction: (kind=u'Imgmap', name=u'http://pages.google.com/edit/kwin786/Impressionnism01_s.jpg-2') and (kind=u'ImgmapContentUrl', name=u'http://pages.google.com/edit/kwin786/Impressionnism01_s.jpg').

  • 2009年9月18日金曜日

    Twitter

    EmbedはQueyを複数指定しするとLoadingのままとなって、NGのようです。











    2009年8月4日火曜日

    Index 復活


    ようやく復活

    properties: [] 

    このインデックスは削除しないように注意

    diff は一切表示なし。
    C:\google>appcfg.py vacuum_indexes blog-editor
    Fetching index definitions diff.

    C:\google>

    エラーログの内容を index.yaml に素直に追加するのが一番
    - kind: Img
    properties:
    - name: open_mode
    - name: category
    direction: desc
    - name: modified
    direction: desc

    2009年7月31日金曜日

    Google App Engine : Index Error

    どうやらまた同じようなミスをしてしまった

    http://groups.google.co.jp/group/google-app-engine-japan/msg/2cc3dbed1cbb8ccf


    このパターンだと思われ、1日待ってみる必要がある。
    index.yaml の該当部分を削除して vacume_indexes しても Status が Error の
    ままで Deleting にならず、削除が開始されない。 結果、 Error が消えないのでどうしようもない。

    ローカル: 2009年7月21日(火) 午前11:52
    件名: Re: can not force delete a index with error!

    I wasn't able to delete the "Error" status index for a day, the next
    day when I tried vacuum_indexes it got deleted without any problem.

    The fist day I tried many times, but the index status was "Error" it
    didn't change to "Deleting...". It was kind of stuck at the error
    status.



    関連

    Google App Engineで、index.yamlに記述したインデックスが正しく生成されないときの対処法
    http://akisute.com/2009/05/google-app-engineindexyaml.html

    GAE(google app engine) インデックスのトラブルの顛末
    http://osima.jp/blog/gae-index-in-trouble.html

    2009年5月29日金曜日

    Blogger API / max_resuts



    X max-results
    ○ max_results


    ex. この値をセットしないと25程度しか reults が得られない

    start_time ='2009-05-01'
    end_time ='2009-05-31'
    query = service.Query()
    query.feed = '/feeds/' + blogID + '/posts/default'
    query.max_results = "100"

    query.published_min = start_time
    query.published_max = end_time
    feed = gd_service.Get(query.ToUri())



    2009年2月5日木曜日

    Blogger Data API

    PHP による処理

    Zend Google Data APIs client library をダウンロードし展開 

    c:\php\php.ini の include_path に追加 

    include_path = ".;c:\php\ZendGdata-1.7.3\library"



    コマンドラインより実行 

    C:\php\ZendGdata-1.7.3\demos\Zend\Gdata>c:\php\php Blogger.php -- --user=xxx --pass=xxxx 


    Note: This sample may Create, Read, Update and Delete data stored in the account provided. Please exit now if you provi
    ded an account which contains important data.

    0 Tech memo
    1 web2000

    public function promptForBlogID()// 以下の処理で prompt を停止可
    {
    $query = new Zend_Gdata_Query('http://www.blogger.com/feeds/default/blogs');
    $feed = $this->gdClient->getFeed($query);
    $this->printFeed($feed);
    //$input = getInput("\nSelection");
    $input = "0";//0 Tech memo に固定

    Selection: 0
    Creating a post.
    Creating a draft post.
    Updating the previous post and publishing it.
    The new title of the post is: Hello, world, it is.
    The new body of the post is: There we go.
    Adding a comment to the previous post.
    Added new comment: I am so glad this is public now.
    Adding another comment.~
    Added new comment: This is a spammy comment.~
    Deleting the previous comment.~
    Printing all posts.
    0 Hello, world, it is.
    1 Hello, world!
    2 Mambo / Install Maniax2008
    3 Joomla! / Install Maniax2008
    ・・・~
    23 multipart/form-data~
    24 it's not found as __builtin__.instancemethod
    Printing posts between 2007-01-01 and 2007-03-01.
    Deleting the post titled: Hello, world, it is.

    Blogger.php を元に
    Blogger2.php を作成し転送処理を実行

    2009年1月30日金曜日

    Blogger Data API Developer's Guide: PHP Hello, world!

    I am on the intarweb!


    http://code.google.com/intl/ja/apis/blogger/docs/1.0/developers_guide_php.html

    c:\php\php.ini
    include_path = ".;c:\php\ZendGdata-1.7.3\library"
    C:\php\ZendGdata-1.7.3\demos\Zend\Gdata>c:\php\php Blogger.php -- --user=xxx --pass=xxxx
    Note: This sample may Create, Read, Update and Delete data stored in the account provided.  Please exit now if you provi
    ded an account which contains important data.

    0 Tech memo
    1 web2000

    Selection: 0
    Creating a post.
    Creating a draft post.
    Updating the previous post and publishing it.
    The new title of the post is: Hello, world, it is.
    The new body of the post is: There we go.
    Adding a comment to the previous post.
    Added new comment: I am so glad this is public now.
    Adding another comment.
    Added new comment: This is a spammy comment.
    Deleting the previous comment.
    Printing all posts.
    0 Hello, world, it is.
    1 Hello, world!
    2 Mambo / Install Maniax2008
    3 Joomla! / Install Maniax2008
    ・・・
    23 multipart/form-data
    24 it's not found as __builtin__.instancemethod
    Printing posts between 2007-01-01 and 2007-03-01.
    Deleting the post titled: Hello, world, it is.

    C:\php\ZendGdata-1.7.3\demos\Zend\Gdata>
     


    blogger new posts, setting the scheduled post date and categories
    http://groups.google.com/group/bloggerDev/browse_thread/thread/a1eee09632f7eb9e?pli=1

    public function createPost($title, $content, $isDraft=False)
    {
    // We're using the magic factory method to create a Zend_Gdata_Entry.
    // http://framework.zend.com/manual/en/zend.gdata.html#zend.gdata.introdduction.magicfactory
    $entry = $this->gdClient->newEntry();
    $entry->title = $this->gdClient->newTitle(trim($title));
    $entry->content = $this->gdClient->newContent(trim($content));
    $entry->content->setType('text');
    $entry->category = array(
    $this->gdClient->newCategory('this is a label', 'http://www.blogger.com/atom/ns#'),
    $this->gdClient->newCategory('this is another label', 'http://www.blogger.com/atom/ns#'));
    $uri = "http://www.blogger.com/feeds/" . $this->blogID . "/posts/default";

    1 日に多数の投稿を行う場合は、確認用の文字の入力を求められます。 確認用の文字は、24 時間が経過すると自動的に削除されます 
    このためのエラー
    Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 400 Blog has exceeded rate limit or otherwise requires word verification for new posts' in C:\php\ZendGdata-1.7.3\library\Ze nd\Gdata\App.php:644

    Unityでドアの開閉はAnimatorそれともiTween?

    Mac Mini M2 の Unity で Sketchup のデータを復元したつづき。 以前、苦労して作成したドアの開閉が動作しないので修復する。 どうやって動かしていたのか、また忘れそうなので記録しておく。             Animator 左右のドア PlaneL,...