ラベル Google の投稿を表示しています。 すべての投稿を表示
ラベル Google の投稿を表示しています。 すべての投稿を表示

2008年6月17日火曜日

Datastore Viewer Error

key ="agpoZWxsb3dvcmxkcgsLEgRCbG9nGPckDA"
r = db.get(key)
is OK.

But...
Google\google_appengine\google\appengine\ext\admin\__init__.py", line 542, in input_field
if len(sample_value) > 255 or sample_value.find('\n') >= 0:
TypeError: object of type 'NoneType' has no len()

Odd behaviour in admin interface
http://groups.google.com/group/google-appengine/browse_thread/thread/29cd28daea3c37d3?fwc=1

2008年6月13日金曜日

2つのdb.Modelの結合、そして back-references とは?

2つのdb.Modelの結合は Reference Property がないと遅い。

Reference Propertyを設定しても、ここに値(Key)が登録されていない場合、結合の際に以下のエラーとなる。(要エラー処理)
AttributeError: 'NoneType' object has no attribute 'entry_date'

1:1 の対応になるのであれば、大きな表形式にするのがやはり正しい。
ただし、1行ごとに fetch しながらの更新には時間がかかる。 
200レコード程度の処理に15分かかった。(Windows による開発環境にて)
後から Reference Property にしろ、実際に追加したいデータにしろ、更新処理によりつけ加えるのには非常に時間がかかる。これは覚悟しておく必要がある。

from datetime import *
import datetime
from google.appengine.ext import db

class Stock(db.Model):
nikkei_ave = db.FloatProperty()
entry_date = db.DateTimeProperty()
modified = db.DateTimeProperty(auto_now=True)
usd_jpy = db.FloatProperty()
class Kawase(db.Model):
author = db.UserProperty()
usd_jpy = db.FloatProperty()
entry_date = db.DateTimeProperty()
modified = db.DateTimeProperty(auto_now=True)
stock = db.ReferenceProperty(Stock)

start_time = datetime.datetime.today()
e1 = datetime.datetime.strptime( "2003-08-01" ,'%Y-%m-%d')
e2 = datetime.datetime.strptime( "2003-08-22" ,'%Y-%m-%d')

kawases = db.GqlQuery("SELECT * FROM Kawase where entry_date >=:1 and entry_date <:2 ", e1,e2 )
for kawase in kawases:
stocks = db.GqlQuery("select * from Stock where entry_date = :1", kawase.entry_date )
for stock in stocks:
kawase.stock = stock.key()
kawase.put()
end_time = datetime.datetime.today()
print end_time - start_time

Kawase(db.Model) 側に Stock を参照するための Reference Property を追加し、ここに対応する Stock(db.Model) の Key を登録しておくと、 Kawase 側から簡単に Stock側の値を結合することができる。
Reference Property が抜けている(未登録)とエラーになるので注意。
entity = db.GqlQuery("select * from Kawase")
for e in entity:
try:
print e.entry_date,e.usd_jpy, e.stock. entry_date, e.stock.nikkei_ave
except AttributeError:
print e.entry_date,e.usd_jpy, None,None

Kawase(db.Model) 側に Stock を参照するための Reference Property を追加し、ここに対応する Stock(db.Model) の Key を登録しておくと、 Kawase 側から簡単に Stock側の値を結合することができる。
Reference Property が抜けている(未登録)とエラーになるので注意。
entity = db.GqlQuery("select * from Kawase")
for e in entity:
try:
print e.entry_date,e.usd_jpy, e.stock. entry_date, e.stock.nikkei_ave
except AttributeError:
print e.entry_date,e.usd_jpy, None,None

Stock 側からの結合は Stock 1 レコード(entity)対して、複数 Kawase レコードが対応する可能性があるので2段階のループになる。
entity = db.GqlQuery("select * from Stock limit 10")
for e in entity:
for k in e.kawase_set:
print e.entry_date,e.nikkei_ave, k.entry_date, k.usd_jpy

Stock Kawase entry_datejoin するため、Kawase 側に ReferenceProperty を作成した。Master-Detail でいうと Stock が Master側になるわけだが、これからDetail側を参照するために自動的に kawase_set という擬似的なものが作成される。
確かにこれを back-references と呼ぶのは仕組みがわかってくると、適切なように思える。

また、back-references は遅いので注意。
上記の10件の join で 22秒もかかった。(SDKにて。 Kawase 1,935件、Stock 1,842件)

これは原則として Master側は1画面に1レコードとした使い方としないといけない。

Docs > Datastore API > Entities and Models で
ReferenceProperty has another handy feature: back-references. When a model has a ReferenceProperty to another model, each referenced entity gets a property whose value is a Query that returns all of the entities of the first model that refer to it.
と説明されている。

2008年5月15日木曜日

Entity Groups, Ancestors and Paths

  • Every entity belongs to an entity group, a set of one or more entities that can be manipulated in a single transaction.
    • Entity group relationships tell App Engine to store several entities in the same part of the distributed network.
    • A transaction sets up datastore operations for an entity group, and all of the operations are applied as a group, or not at all if the transaction fails.

  • When the application creates an entity, it can assign another entity as the parent of the new entity.
    • Assigning a parent to a new entity puts the new entity in the same entity group as the parent entity.

  • An entity without a parent is a root entity.
    • An entity that is a parent for another entity can also have a parent.
    • A chain of parent entities from an entity up to the root is the path for the entity, and members of the path are the entity's ancestors.
    • The parent of an entity is defined when the entity is created, and cannot be changed later.

Tips for using entity groups:

  • Only use entity groups when they are needed for transactions. For other relationships between entities, use ReferenceProperty properties and Key values, which can be used in queries.

    グループはトランザクションのため
    データの関連づけには ReferencePropertyKey を使う

class ReferenceProperty(reference_class=None, verbose_name=None, collection_name=None, ...)

A reference to another model instance. For example, a reference may indicate a many-to-one relationship between the model with the property and the model referenced by the property.

reference_class is the model class of the model instance being referenced. If specified, only model instances of the class can be assigned to this property. If None, any model instance can be the value of this property.

collection_name is the name of the property to give to the referenced model class whose value is a Query for all entities that reference the entity. If no collection_name is set, then modelname_set (with the name of the model in lowercase letters and "_set" added) is used.

ReferenceProperty automatically references and dereferences model instances as property values: A model instance can be assigned to a ReferenceProperty directly, and its key will be used. The ReferenceProperty value can be used as if it were a model instance, and the datastore entity will be fetched and the model instance created when it is first used in this way. Untouched reference properties do not query for unneeded data.

class Author(db.Model):
name
= db.StringProperty()

class Story(db.Model):
author
= db.ReferenceProperty(Author)

story
= db.get(story_key)
author_name
= story.author.name

As with a Key value, it is possible for a reference property value to refer to a data entity that does not exist. If a referenced entity is deleted from the datastore, references to the entity are not updated. An application can explicitly db.get() the value of a ReferenceProperty (which is a Key) to test whether the referenced entity exists.

Deleting an entity does not delete entities referred to by a ReferenceProperty.

See also this introduction to reference properties.

Value type: db.Key (see above)


Introduction to reference properties.
http://code.google.com/appengine/docs/datastore/entitiesandmodels.html#References

References

A property value can contain the key of another entity. The value is a Key instance.


# To fetch and iterate over every SecondModel entity that refers to the
# FirstModel instance obj1:
for obj in obj1.firstmodel_set:
# ...

The name of the back-reference property defaults to modelname_set (with the name of the model class in lowercase letters, and "_set" added to the end), and can be adjusted using the collection_name argument to the ReferenceProperty constructor.

Automatic referencing and dereferencing of model instances, type checking and back-references are only available using the ReferenceProperty model property class. Keys stored as values of Expando dynamic properties or ListProperty values do not have these features.

http://groups.google.com/group/google-appengine/browse_thread/thread/e9464ceb131c726f?hl=en
http://blog.arbingersys.com/2008/04/google-app-engine-better-many-to-many.html
http://cluebin.appspot.com/pasted/25


  • The more entity groups your application has―that is, the more root entities there are―the more efficiently the datastore can distribute the entity groups across datastore nodes. Better distribution improves the performance of creating and updating data. Also, multiple users attempting to update entities in the same entity group at the same time will cause some users to retry their transactions, possibly causing some to fail to commit changes. Do not put all of the application's entities under one root.
  • A good rule of thumb for entity groups is that they should be about the size of a single user's worth of data or smaller.
  • Entity groups do not have a significant impact on the speed of queries.

2008年5月12日月曜日

urlfetch で rss.xml より img を検出





http://localhost:8080/_ah/admin/interactive より実行


from google.appengine.api import urlfetch
from elementtree.ElementTree import *
import re

rss1 = 'http://movies.go.com/xml/rss/intheaters.xml'
url = rss1
rss = urlfetch.Fetch(url)
print rss
tree = ElementTree(fromstring(rss.content))

img_re = re.compile('<img src="([a-zA-Z0-9/:._\-]+)" ')
for item in tree.findall('.//item'):
title = item.find('title').text.strip()
description = item.find('description').text.strip()
imageMatch = img_re.search(description)
if (imageMatch):
picture_url = imageMatch.groups()[0]
print title
print picture_url

---

Speed Racer
http://movies.go.com/i/movies/895881/895881.jpg



--- 特定のページの src = .jpg 検出 ---

from google.appengine.api import urlfetch
from elementtree.ElementTree import *
import re
url = 'http://webdba.blogspot.com/2008/05/urlfetch-rss-img.html'
content = urlfetch.Fetch(url).content
img_re = re.compile('<img src="([a-zA-Z0-9/:._\-]+)" ',re.I)
img_re = re.compile('src="([a-zA-Z0-9/:._\-]+).jpg" ',re.I)
img_re = re.compile('src="([a-zA-Z0-9/:._\-]+[jpg|gif|png])" ',re.I)

imageMatch = img_re.search(content)
imageMatch = img_re.findall(content)
print imageMatch
for i in imageMatch:
print i

---

['http://code.google.com/appengine/images/appengine_lowres.jpg']
http://code.google.com/appengine/images/appengine_lowres.jpg

2008年5月9日金曜日

正規表現, 文字列の置換



文字列の置換 string.replace()


---
import string
str1 = "http://localhost"
str2 = string.replace(str1, 'http', 'file')
print str1
print str2
---
http://localhost
file://localhost
-----------------------------------

リテラルのバックスラッシュにマッチさせるには、正規表現文字列として
'\\\\'


Python では raw 文字列(raw string)表記を正規表現に利用
先頭に  r  を付加する
p = re.compile(r'([^"])\b((http|https)://[^ \t\n\r<>\(\)&"]+' \
r'[^ \t\n\r<>\(\)&"\.])')


http://www.python.jp/Zope/articles/tips/regex_howto/regex_howto_3
http://reddog.s35.xrea.com/wiki/Python%C8%F7%CB%BA%CF%BF.html Python備忘録


改行文字を取り除くときは、 s[:-1] または s.rstrip('\n')

-------------------------------------------------------------
import re
p = re.compile("ab.", re.I)
result = p.findall("AbdABCAAbb")
print result

p = re.compile("ab.")
print p.sub("xxx", "abcdeaabcde")
print p.sub("xxx", "Abcdeaabcde")

p = re.compile("ab.", re.I)
print p.sub("xxx", "Abcdeaabcde")
print "------------"

url = "aa https://aa.com/ bb"

p = re.compile(r'([^"])\b((http|https)://[^ \t\n\r<>\(\)&"]+' \
r'[^ \t\n\r<>\(\)&"\.])')

m = p.match('aa http://aa.com/ bb' + url + url )
print m
m = p.sub('XXX','aa http://aa.com/ bb' + url + url )
print m
print "------------"

# print m.group(0)

print "-- " + url + " --"
print "->"
print p.sub("xxx", url )

p = re.compile('[a-z]+')
m = p.match('tempo')
print m
print m.group(0)

-----

from google.appengine.api import urlfetch
from elementtree.ElementTree import *
import re

url = 'http://blog.goo.ne.jp/xxxxxx/m/200803'
#content = urlfetch.Fetch(url).content.decode("euc-jp")
content = url.split('/')

print content[0]
print content[1]
print content[2]
print content[3]

content = url.split('/')[2]
print content

google.appengine.api.datastore


cccwiki サンプルではPage オブジェクトを作成している
 
 この内容は Datastore Viewerでも参照することができる。
























 その基本動作の確認

c:/Program Files/Google/google_appengine/google/appengine/api/datastore.py

import os
from google.appengine.api import datastore
from google.appengine.api import datastore_types

name = 'test'
entity = datastore.Entity('Page')
entity['name'] = name

query = datastore.Query('Page')
query['name ='] = name
entities = query.Get(1)
print >> sys.stdout, len(entities)
print >> sys.stdout, entities[0]
print >> sys.stdout, entities[0]['user']
print >> sys.stdout, entities[0].key()
print >> sys.stdout, entities[0].key().id()
------
1
{u'content': u'<h1>test</h1>', u'user': users.User(email='test@example.com'), u'modified': datetime.datetime(2008, 5, 9, 14, 41, 30, 62000), u'name': u'test', u'created': datetime.datetime(2008, 5, 9, 14, 41, 30, 62000)}
test@example.com
agpoZWxsb3dvcmxkcgsLEgRQYWdlGJQBDA
148

DatePropertyにはやはり不具合(bug)あり



date = db.DateTimeProperty(auto_now_add=True) の値が
対象の datastore のデータを更新する度に、時刻が進んでいってしまう現象は
以下の Patch により直った。 ( SDK 1.0.1)

DateProperty does not work properly in dev environment
http://code.google.com/p/googleappengine/issues/detail?id=131

c:/Program Files/Google/google_appengine/google/appengine/api/datastore_types.py

I tried a patch to module datastore_types.py, which seems to work:

change line 1033
from
lambda val: datetime.datetime.fromtimestamp(float(val) / 1000000.0),
to
lambda val: datetime.datetime.utcfromtimestamp(float(val) / 1000000.0),

Per the Python doc, fromtimestamp() converts to the local timezone.

2008年4月25日金曜日

Google App Engine / flickr API 表示サイズ


http://www.flickr.com/services/api/  で検索結果の画像の表示のサイズの変更について、テストした結果をメモしておく。
テンプレートの変更による。 ( 送信するパラメータは変更なし)
検索キーワードは "Michaelangelo Moses" を設定







/sizes/
_m.jpg




























/sizes/
.jpg

  • 拡張子なし。
  • これが一番大きな検索結果が表示された。




















/sizes/l/
_b.jpg



  • _b.jpg だと一部の画像が表示されない
  • UNAVAILABLE の表示であっても、クリックした先の flickr のサイトの画像は表示される。


















/sizes/sq/
_s.jpg

















/sizes/t/
_t.jpg
















/sizes/o/
_o.jpg



  • UNAVAILABLE の表示
  • クリック : flickr のサイトのオリジナルサイズの画像が表示される。




















2008年4月23日水曜日

Google App Engine Google Data Python Library


Getting Started with the Google Data Python Library

http://code.google.com/support/bin/answer.py?answer=75582

これはきちんと理解しておかないと、いろいろなエラーに時間をとられる。


C:\work\gdata.py-1.0.12.1>c:\python25\python ./setup.py install

-- gdata_test.py を変更

# from xml.etree import ElementTree
from xml.etree import ElementTree, SimpleXMLTreeBuilder
ElementTree.XMLTreeBuilder = SimpleXMLTreeBuilder.TreeBuilder
except ImportError:
# from elementtree import ElementTree
from xml.etree import ElementTre


C:\work\gdata.py-1.0.12.1>c:\python25\python ./tests/run_data_tests.py
Running all tests in module gdata_test...............
----------------------------------------------------------------------
Ran 15 tests in 0.031s
OK


サンプルプログラム muvmuv を下記からダウロ
ードして実行してみたのだが
http://code.google.com/support/bin/answer.py?answer=75582

起動
C:\google>dev_appserver.py muvmuv/
これはOK

実行
http://localhost:8080/build
しかし、これが NG

原因検索
http://groups.google.com/group/google-appengine/browse_thread/thread/b7399a91c9525c97

対策
http://effbot.org/downloads/ からelementtree-1.2.7-20070827-preview.win32.exe [52k]
を入れ、これを直接 project フォルダ以下に置いたが
C:\google\muvmuv\elementtree

結論としては windows SDK の不具合で fix 待ち 
http://code.google.com/p/googleappengine/issues/detail?id=222 this is a current issue with the Windows SDK.


--- その他 作業memo ---

Python版インストール(Windows) を参考に
PYTHONPATH=C:\Python25\Lib\site-packages を一応、設定

C:\google\muvmuv\ElementTree.py in ()
cannot import name SimpleXMLTreeBuilder

エラー例
Then I got "No module named expat: use SimpleXMLTreeBuilder instead".
'SimpleXMLTreeBuilder' is not defined

File "C:\google\muvmuv\main.py", line 235, in getMoviesFromRss
tree = ElementTree(fromstring(rss.content))
NameError: global name 'fromstring' is not define

Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 484, in __call__
handler.get(*groups)
File "C:\google\muvmuv\main.py", line 215, in get
movies = self.getMoviesFromRss(rss1, build_only)
File "C:\google\muvmuv\main.py", line 235, in getMoviesFromRss
tree = ElementTree(fromstring(rss.content))
File "C:\google\muvmuv\elementtree\ElementTree.py", line 1013, in XML
return api.fromstring(text)
File "C:\google\muvmuv\elementtree\ElementTree.py", line 181, in fromstring
parser = XMLTreeBuilder()
File "C:\google\muvmuv\elementtree\ElementTree.py", line 1171, in __init__
self._parser = parser = expat.ParserCreate(None, "}")
NameError: global name 'expat' is not defined

---
Please see http://code.google.com/p/googleappengine/issues/detail?id=222 this is a current issue with the Windows SDK.

expat.py は pyexpat.py を import
コマンドラインからはエラーは発生しない DLLs/pyexpat.pyd などがある。

C:\google>c:\python25\pythonPython 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] onwin32Type "help", "copyright", "credits" or "license" for more information.
>>> from pyexpat import *


SDK102 にしたら build できた


最初起動時に simplejsonエラーが発生したが
以前どうやら django 以下に試行錯誤で置いた
ファイルをプロジェクトフォルダに copy して対応。


exec module_code in script_module.__dict__ File "C:\google\muvmuv\main.py", line 8, in import simplejson ImportError: No module named simplejson

 画像をクリックすると
 以下のエラーが発生しているが、これは
 対応できそうである。











File "C:\google\muvmuv\main.py", line 43, in get
template_values = {'login': loign, 'logout': logout, 'user': user}
NameError: global name 'loign' is not defined


2008年4月19日土曜日

Google App Engine /GqlQuery object and JSON


how to convert GqlQuery object to JSON format



http://groups.google.com/group/google-appengine/browse_thread/thread/634e7b9a2e584dd3?hl=en

How to use simplejson with GqlQuary object for example how to convert
marker_list to JSON for format
marker_list = db.GqlQuery('SELECT * FROM Marker')

I think you should dump queryset or row to python data, then convert
them to json format, here is my testing code:

def dumprow(r):
import datetime
a = {}
for k in r.fields().keys():
v = getattr(r, k)
a['id'] = r.key().id()
a['key'] = str(r.key())
if isinstance(v, str):
a[k] = str(v)
elif isinstance(v, unicode):
a[k] = unicode(v)
elif isinstance(v, datetime.datetime):
a[k] = v.strftime('%Y-%m-%d %H:%M:%S')
elif isinstance(v, datetime.date):
a[k] = v.strftime('%Y-%m-%d')
elif isinstance(v, datetime.time):
a[k] = v.strftime('%H:%M:%S')
elif isinstance(v, (int, float, list)):
a[k] = v
else:
a[k] = str(v)

return a

def dumpquery(query):
s = []
for r in query:
s.append(dumprow(r))
return s

2008年4月14日月曜日

Google App Engine 入門7 検索まとめ

 

  こでまでの作業のまとめ
 以下が追加事項一覧です。

  1. dataJST を追加し、時刻を加工しJSTの時刻も合わせて登録するようにした。
    (が、時間の足し引きの値の理屈がどもう怪しい)
  2. 検索機能 (JQuery にて同じ画面内に絞り込んだ検索結果を表示)
  3. 該当件数表示
  4. Javascript (JQuery のライブラリ)を利用するようにした。
  5. スタイルシート main.css を多少加工した。
  6. イメージ画像の追加 ( app.yaml をよく理解していないこともあり、苦労した。Configuring an App もみてみたが、やはり実例がわかりやすい)
  • テンプレートを使用しないと datastore からの検索結果と同時に日本語を表示しようとすると UnicodeDecodeエラーが発生することから、これを利用。 やはりテンプレートは楽だと思います。

  • ただし、JQuery で検索結果をダイナミックに表示する部分はテンプレートは使用せずに直接記述しました。

  • テンプレートにタグを追加しようと調べたましたが、簡単ではないので中止。

Google App Engine 入門5 検索


Datastore API > Creating, Getting and Deleting Data にQuery と GqlQuery の2通りの例がありますが、今回は Query を利用してみます。


1. 単純動作テスト 検索条件の追加
content の値が 'Foo'  のものだけ表示するようにしてみます。
greetings = Greeting.all().order('-date')
greetings.
filter('content =', 'Foo')       # 追加
これは素直に動作しました。

2.  Key とは ?

rowid にあたるような、ものがあります。
unique key that represents the object.
Doc だと APIs > Datastore API > Reference > Key です。

The key() method で得た値(Key object)を put() in the datastore したりすると NotSavedError エラーになるとあります。 RDBMS の場合の一意制約違反のエラーのようなものだと思います。

instance for a given Key using the get() function.
この部分は実際のデータをみてみないとこの先の機能の意味がつかめそうもありません。
key = greeting.key()
self.response.out.write('%s' % str(key) )
self.response.out.write('%s' % greeting.get(key) )
          このような値が返ってきていました。
agpoZWxsb3dvcmxkcg4LEghHcmVldGluZxgTDA
<__main__.Greeting object at 0x02600B30>
なるほど、key がわかれば、 get(key) でたどって実際の値もわかるということです。

key の理解にはReferenceProperty model とういうのもポイントのようです。
あと、ancestor() methods on the object というのが、まだよく理解できていません。


さて、ようやくある程度、検索が動作すようになったと思っていたら、日本語からみのいやなエラーが発生しだしました。

body 内に日本語を使用する self.response.out.write("日本語") だけでエラーとなります。 
INFO 2008-04-16 16:24:10,546 dev_appserver.py] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
File "C:\Python25\lib\wsgiref\handlers.py", line 92, in run
self.result = application(self.environ, self.start_response)
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__i
nit__.py", line 504, in __call__
response.wsgi_write(start_response)
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__i
nit__.py", line 223, in wsgi_write
body = self.out.getvalue()
File "C:\Python25\lib\StringIO.py", line 270, in getvalue
self.buf += ''.join(self.buflist)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 13: ordinal
not in range(128)
発生するようになったタイミングはこの部分の追加以降
greetings = db.GqlQuery("SELECT * FROM Greeting ORDER BY date DESC LIMIT 10")
for greeting in greetings:
if greeting.author:
self.response.out.write('wrote:' )
self.response.out.write('%s wrote:' % greeting.author.nickname())
else:
self.response.out.write('An anonymous person wrote:')
self.response.out.write('%s' %
cgi.escape(greeting.content))


困ったものです
self.response.headers['Content-Type'] = 'text/html'
self.response.headers['charset'] = 'UTF-8'
では効果なし。
発生例はかなり報告されていますが・・・

いろいろ試してもうまくいきませんが、テンプレートを利用した場合はこうした日本語の問題は発生しないようですので、やはりテンプレート利用する方向になりそうです。

2008年4月11日金曜日

Google App Engine 入門1



「Google App Engine」の登場とPaaS--Web 2.5がもたらす変化 2008/04/10 17:27
http://japan.cnet.com/column/pers/story/0,2000055923,20371171,00.htm


1. Google App Engine SDK は Python 2.5 が前提
Python 2.5 をインストール         http://www.python.org/download/

2. SDK をインストール
Google App Engine General Questions http://code.google.com/appengine/kb/general.html
Download the SDK をダウンロード    http://code.google.com/appengine/downloads.html


既にパスは通っている。
C:\>path
PATH=C:\WINDOWS\system32;
C:\Program Files\Google\google_appengine\


3. helloworld を動かす

Docs >Getting Started >Hello, World!
を参考に





3.1  2つのファイルを作成

 C:> cd Documents and Settings\user\My Documents\google
 C:> md helloworld

helloworld ディレクトリに以下の2つのファイルを作成

-helloworld.py-

#!-*- coding:utf-8 -*-
print 'Content-Type: text/plain'
print ''
print 'Hello, world!'


* ローカルでなく、 Google Upload の場合、日本語対応には必要
  [ #!-*- coding:utf-8 -*- ] c.f

-app.yaml -
application: helloworld
version: 1
runtime: pythonapi_version: 1
handlers:- url: /.*
script: helloworld.py

5.  DOS prompt より以下のコマンドを実行 (自動的に webサーバーが起動される)
C:\Documents and Settings\user\My Documents\google>dev_appserver.py helloworld/

6.  ブラウザデアクセスしてみる










7.  DOS prompt の出力の様子

C:\Documents and Settings\user\My Documents\google>dev_appserver.py helloworld/
Allow dev_appserver to check for updates on startup? (Y/n): y
dev_appserver will check for updates on startup. To change this setting, edit C:\Documents and Settings\user/.appcfg_nag

INFO 2008-04-11 11:28:02,328 appcfg.py] Checking for updates to the SDK.
INFO 2008-04-11 11:28:02,733 appcfg.py] The SDK is up to date.
WARNING 2008-04-11 11:28:02,733 datastore_file_stub.py] Could not read datastore data from c:\docume~1\user\locals~1\temp\dev_appserver.datastore
WARNING 2008-04-11 11:28:02,733 datastore_file_stub.py] Could not read datastore data from c:\docume~1\user\locals~1\temp\dev_appserver.datastore.history
INFO 2008-04-11 11:28:02,750 dev_appserver_main.py] Running application helloworld on port 8080:
http://localhost:8080

INFO 2008-04-11 11:31:28,092 dev_appserver.py] "GET / HTTP/1.1" 200 -
INFO 2008-04-11 11:31:28,108 dev_appserver_index.py] Updating C:\Documents and Settings\user\My Documents\google\helloworld\index.yaml
INFO 2008-04-11 11:31:28,171 dev_appserver.py] "GET /favicon.ico HTTP/1.1" 200 -
INFO 2008-04-11 11:31:41,296 dev_appserver.py] "GET / HTTP/1.1" 200 -
INFO 2008-04-11 11:31:42,217 dev_appserver.py] "GET / HTTP/1.1" 200 -
INFO 2008-04-11 11:31:45,296 dev_appserver.py] "GET / HTTP/1.1" 200 -



拡張子 .py が Python と関連付けられている。
以前、install した python22 を uninstall した
際、この情報も削除され
c:> dev_appserver.py が起動しなくなった。

Python.exe に PATH が通っている必要はないが
拡張子 .py との関連付けは必要。










8. 紹介 Vide の様子  ひと昔まえまではこうした雰囲気を味わうには会場のいくしかなかった。

http://code.google.com/appengine/

Announcing Google App Engine at Campfire One on April 7, 2008

2007年12月11日火曜日

Google Map , Calendar , Sketchup

Google Map APIのSign up for a Google Maps API key. で表示するドメイン用の API Key を取得する必要があった?
現在は  Google マップを自分のサイトに貼り付けよう にしたがって、貼り付けるだけで表示は可能。


カレンダー

sketchup
 Video チュートリアル
 sketchupを楽しもう
 レイヤーの変更

Sketchup のデータを Second Life にもっていくには blender 経由、あるいは Google Sketchup -> Second Life export にあるように ruby APIを使うとある程度可能な様子。Ruby スクリプトにサンプルがある。


Lib PC Parts
Google Sketchup Paradise


背景を透明にする方法(Photoshop Elements)

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

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