[google-appengine] help me

2017-09-06 Thread satoshi tagomori
GAE/PHP standard/us にて利用しています
CloudStorageはasia region です

$upload_url = CloudStorageTools::createUploadUrl('/api/upload/upload', 
$options);

にて生成したURLにmultipart/form-dataにて複数の画像とパラメーターをアップロードするような仕様です。

upload.php (アップロードリクエストを処理する)にて画像を受取、ブロブキーなどをDBに追加してレスポンスをjsonにて返却しています

処理自体は正常に終了し(response code 200)ているのですが、クライアントでのレスポンスが500になってしまいます。
GAEのコンソールログを確認しても、api/upload/uploadは正常に200を返しているのが確認できるのですが、クライアントには 
エラーが返ってきてしまいます。

以前は同様の現象はなかったと思いますが昨日始めて確認しました。

アップロードは正常に行われているのに、レスポンスが500なのでクライアントが勘違いして大量の画像をアップロードしてきており、早急に対応したいのですがどなたかお知恵を貸してください

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/9564c672-d02e-4ef4-ba24-759d89ff3f37%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[google-appengine] Help me, GAE/PHP Inexplicable behavior google cloud storage' s response

2017-09-06 Thread satoshi tagomori

upload image response returned status code 200 in code and log 
but client recived 500 error

help me.


createuploadurl.php

$upload_url = CloudStorageTools::createUploadUrl('/api/upload/upload', 
$options);


upload.php


header('Content-Type: application/json; charset=utf-8');
echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
syslog(LOG_DEBUG,"success.");


log is success

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/ba181782-722a-4dab-b829-cae9f72213a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[google-appengine] Re: Access from China dead

2010-12-09 Thread Satoshi
I am wondering if this issue is related to this:

"China Blocks News Websites In Protest Of Nobel Nominee"
http://www.itproportal.com/2010/12/9/china-blocks-news-websites-protest-nobel-nominee/

Satoshi

On Dec 8, 11:31 pm, zhang yu  wrote:
> appspot.com被墙了 <http://www.douban.com/group/topic/8928422/>
>
> 在 2010年12月9日 下午3:04,Will 写道:
>
>
>
> > 你的appspot可以访问吗?我的三个都不行。我在浙江。
>
> > Will
>
> > 2010/12/9 YF CAO 
>
> > 使用自己的Domain才会无法访问,
> >> appspot目前为止未发现被屏的现象,
> >> 可能是你上传的应用有问题,当然也有可能某些地区将appspot屏了。
>
> >> 2010/12/9 Will 
>
> >>> Accesses from China mainland to xxx.appspot.com are all dead, I've tried
> >>> 3 different apps.
>
> >>> Will
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Google App Engine" group.
> >>> To post to this group, send email to google-appeng...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> google-appengine+unsubscr...@googlegroups.com >>>  e...@googlegroups.com>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/google-appengine?hl=en.
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Google App Engine" group.
> >> To post to this group, send email to google-appeng...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> google-appengine+unsubscr...@googlegroups.com >>  e...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/google-appengine?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to google-appeng...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine+unsubscr...@googlegroups.com > e...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: Let's defend GAE!

2010-12-03 Thread Satoshi
This is my response to one of issues pointed out by the original
article (DeadlineExceededError).

http://satoshi.blogs.com/uie/2010/12/handing-and-testing-deadlineexceedederror.html

Feel free to criticize (either here or at my blog). I am trying to
learn something as well.

Satoshi

On Nov 23, 1:59 am, Wim den Ouden  wrote:
> Gae is just a subtitle, it is based on the google api's written in c,
> c++, python and the datastore containers all over the world. This
> distributed computing, programming model (based on open standards) is
> allready one off, or the largest network on the moment.
> gr
> wim
>
>
>
>
>
> On Tue, Nov 23, 2010 at 10:20 AM, Martin Webb  wrote:
> > All that GAE needs is someone in these forums to build, launch and run the
> > next killa app like twitter. Once that happens people will take the platform
> > more than seriously as the app will scale to millions trouble free overnight
> > - sending out big signals to developers that app engine is a serious, well
> > honed platform for building scalable apps. Lets hope that day comes soon, as
> > when it does im sure once the limelight is on - things can only get better.
> > Im sure someone somewhere is hard to work on just that.
>
> > Regards
>
> > Martin Webb
>
> > The information contained in this email is confidential and may contain
> > proprietary information. It is meant solely for the intended recipient.
> > Access to this email by anyone else is unauthorised. If you are not the
> > intended recipient, any disclosure, copying, distribution or any action
> > taken or omitted in reliance on this, is prohibited and may be unlawful. No
> > liability or responsibility is accepted if information or data is, for
> > whatever reason corrupted or does not reach its intended recipient. No
> > warranty is given that this email is free of viruses. The views expressed in
> > this email are, unless otherwise stated, those of the author
>
> > 
> > From: Tim Hoffman 
> > To: Google App Engine 
> > Sent: Tue, 23 November, 2010 8:11:35
> > Subject: [google-appengine] Re: Let'sdefendGAE!
>
> > Hi Adam
>
> > Couldn't agree more with your sentiments.  In addition to working on
> > fairly significant
> > projects with appengine, I run our small business web site on
> > appengine as well (www.fishandlily.com.au).
>
> > It is really a headache free environment if you get everything
> > sorted.  We don't have to
> > worry about os upgrades. Server/hardware problems etc... My wife
> > manages the content (again
> > a small cms for us) and I occasionally make some tweaks to the code
> > base.
>
> > With agressive use of memcache, we almost never see any of the major
> > problems of
> > increased datastore latency.
>
> > Rgds
>
> > Tim
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to google-appeng...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to google-appeng...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.
>
> --
> gr
> wdo
>
> Demo free E-business:https://e-comm.appspot.com
> Gae developer tipshttp://code.google.com/p/relat/wiki/gaetips
> Wim den Ouden Google app engine based (web) apps

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: Using GAE for a REST API

2010-11-29 Thread Satoshi
I also think GAE is an excellent platform to build REST services.
Recently, I have build a couple of web-applications with following
architecture.

Backend: GAE/Python (this is the MODEL)
Protocol: REST (JSON over HTTP)
Client-A: CONTROLLER implemented in JavaScript + Static HTML templates
loaded from GAE (VIEW)
Client-B: iPhone/iPad app written in Objective-C (CONTROLLER) +
Resource bundles edited by IB (VIEW)

By doing so I can (1) minimize the server side of code (and runtime
size because I don't need large framework - notice that I perform data-
view binding on the client side), (2) clearly separate the model, view
and controller, (3) use the exact same protocol among multiple
clients.

Satoshi

On Nov 24, 10:25 pm, James Broberg  wrote:
> GAE is fantastically suited for REST. I use GAE Java + Restlets + Freemarker
> myself.
>
> On 25 November 2010 08:41, supercobra  wrote:
>
>
>
> > Hello there,
>
> > What is your best practice to develop REST on GAE?
>
> > Daniel
> > --
> > superco...@gmail.com
>
> > On Wed, Nov 24, 2010 at 2:36 PM, Jay  wrote:
> > > Yahel, GAE is a great platform for building and delivering RESTful
> > > services. Of course there are quotas. But you are in control of how
> > > much quota you want to a large extent.
>
> > > On Nov 23, 9:43 pm, Yahel Carmon  wrote:
> > >> Hi all,
>
> > >> I'm new to playing with GAE, and I'm thinking of using it to build a
> > very
> > >> simple API for one of my projects. I like the idea of the
> > >> scaling  (mostly) handling itself for an API.
>
> > >> However, I've read things about things like rate limiting triggering
> > >> captchas for end users, a la Google services. Does that type of rate
> > >> limiting present problems with using GAE as a backend for a REST API?
>
> > >> I apologize if I'm asking a dumb or obvious question, but its
> > surprisingly
> > >> difficult to Google for if GAE can be used to build APIs without finding
> > >> pages* *about GAE's API.
>
> > >> Thanks in advance!
>
> > >> --
> > >> Yahel Carmon
> > >> (917) 445-3498
> > >> Twitter:http://twitter.com/yahelc
> > >> Facebook:http://facebook.com/yahel
> > >> LinkedIn:http://www.linkedin.com/in/yahelc
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > > To post to this group, send email to google-appeng...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > google-appengine+unsubscr...@googlegroups.com > e...@googlegroups.com>
> > .
> > > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to google-appeng...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine+unsubscr...@googlegroups.com > e...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: Blobstore upload handler is Base64 encoding strings?

2010-11-15 Thread Satoshi
Chris,
I really appreciate the information, but I would like to hear from
Google about this bug.

Q1. Are you going to fix this bug in near future?
Q2. Do you have any suggested way to work-around this bug, which won't
cause compatibility issue in future when you fix this bug?

Satoshi

On Nov 13, 10:38 am, Chris Copeland  wrote:
> In Python the text is encoded as quoted printable (I think).
>
> See issue 
> #3761<http://code.google.com/p/googleappengine/issues/detail?id=3761>and
> Stack
> Overflow 
> question<http://stackoverflow.com/questions/3624226/encoding-problem-in-app-en...>.
>
> I've worked around it by decoding with quopri if the post is coming through
> the blob uploader.
>
>
>
> On Sat, Nov 13, 2010 at 9:30 AM, Satoshi  wrote:
> > I also wrote an upload code in Objective-C, explicitly specifying the
> > "Content-Type: text/plain; charset=UTF-8",
> > but got the same result as HTML form sample above.
>
> > "日本語" becomes "5pel5pys6Kqe"
>
> > Satoshi
>
> > On Nov 13, 7:01 am, Satoshi  wrote:
> > > I wrote a test code, and verified this bug (it happens in Japanese as
> > > well).
>
> > > Here is the form:
>
> > >  > > enctype="multipart/form-data">
> > >     
> > >         File:
> > >         
> > >         
> > >     
> > >     
> > >         Description
> > >         
> > >     
> > > 
>
> > > Satoshi
>
> > > On Nov 12, 11:52 am, "Ikai Lan (Google)" 
> > > 
>
> > > wrote:
>
> > > > Do you guys have any sample code? I'm testing this and seeing that the
> > local
> > > > dev server gives me some strange characters (I'm using Java). What does
> > the
> > > > form look like? How are you reading the input from the form submission?
>
> > > > --
> > > > Ikai Lan
> > > > Developer Programs Engineer, Google App Engine
> > > > Blogger:http://googleappengine.blogspot.com
> > > > Reddit:http://www.reddit.com/r/appengine
> > > > Twitter:http://twitter.com/app_engine
>
> > > > On Fri, Nov 12, 2010 at 5:09 AM, msmart  > >wrote:
>
> > > > > I ran into the same issue.
>
> > > > > Has anyone found the corresponding issue in the bug tracker (or a
> > nice
> > > > > workaround)?
>
> > > > > Michael.
>
> > > > > On 26 Okt., 09:28, Kenneth  wrote:
> > > > > > This is a pretty shocking bug (or lack of documentation?) from
> > > > > > Google.  There doesn't appear to be a consistent way to decode the
> > > > > > post results that come from the BlobstoreUploadHandler.  There was
> > a
> > > > > > bug in the issues list for this but I can't find it.  I should put
> > in
> > > > > > another one really but there doesn't seem to be any point.
>
> > > > > > What I do is when the user hits the submit button I send the form
> > > > > > results via an ajax request and once that returns I submit the form
> > to
> > > > > > do the file upload.
>
> > > > > > Pretty sad you have to do that and it means you're requiring
> > > > > > javascript for something that really shouldn't need it.
>
> > > > > > On Oct 25, 10:49 am, Agustin Horischnik  wrote:
>
> > > > > > > Hey, no luck with this? Did you solve this at all?
>
> > > > > > > On Aug 31, 12:40 pm, Agustin Horischnik 
> > wrote:
>
> > > > > > > > I think I'm having the same issue...
>
> > > > > > > > I have a multi-part form posting to ablobstoreuploadhandler.
> > > > > > > > There's four form fields:
>
> > > > > > > > 2 input type=file
> > > > > > > > 1 input type=text
> > > > > > > > 1 textarea
>
> > > > > > > > Those map to...
>
> > > > > > > > 2blobstore.BlobReferenceProperty
> > > > > > > > 1 StringProperty
> > > > > > > > 1 TextProperty
>
> > > > > > > > ... respectively, on my model class.
>
> > > > > > > > And the problem is... when I submit an input string such as "á
> > é í ó
> > > > > ú
> > > > > > > > and ñ",

[google-appengine] Re: Blobstore upload handler is Base64 encoding strings?

2010-11-13 Thread Satoshi
I also wrote an upload code in Objective-C, explicitly specifying the
"Content-Type: text/plain; charset=UTF-8",
but got the same result as HTML form sample above.

"日本語" becomes "5pel5pys6Kqe"

Satoshi

On Nov 13, 7:01 am, Satoshi  wrote:
> I wrote a test code, and verified this bug (it happens in Japanese as
> well).
>
> Here is the form:
>
>  enctype="multipart/form-data">
>     
>         File:
>         
>         
>     
>     
>         Description
>         
>     
> 
>
> Satoshi
>
> On Nov 12, 11:52 am, "Ikai Lan (Google)" 
> wrote:
>
>
>
> > Do you guys have any sample code? I'm testing this and seeing that the local
> > dev server gives me some strange characters (I'm using Java). What does the
> > form look like? How are you reading the input from the form submission?
>
> > --
> > Ikai Lan
> > Developer Programs Engineer, Google App Engine
> > Blogger:http://googleappengine.blogspot.com
> > Reddit:http://www.reddit.com/r/appengine
> > Twitter:http://twitter.com/app_engine
>
> > On Fri, Nov 12, 2010 at 5:09 AM, msmart wrote:
>
> > > I ran into the same issue.
>
> > > Has anyone found the corresponding issue in the bug tracker (or a nice
> > > workaround)?
>
> > > Michael.
>
> > > On 26 Okt., 09:28, Kenneth  wrote:
> > > > This is a pretty shocking bug (or lack of documentation?) from
> > > > Google.  There doesn't appear to be a consistent way to decode the
> > > > post results that come from the BlobstoreUploadHandler.  There was a
> > > > bug in the issues list for this but I can't find it.  I should put in
> > > > another one really but there doesn't seem to be any point.
>
> > > > What I do is when the user hits the submit button I send the form
> > > > results via an ajax request and once that returns I submit the form to
> > > > do the file upload.
>
> > > > Pretty sad you have to do that and it means you're requiring
> > > > javascript for something that really shouldn't need it.
>
> > > > On Oct 25, 10:49 am, Agustin Horischnik  wrote:
>
> > > > > Hey, no luck with this? Did you solve this at all?
>
> > > > > On Aug 31, 12:40 pm, Agustin Horischnik  wrote:
>
> > > > > > I think I'm having the same issue...
>
> > > > > > I have a multi-part form posting to ablobstoreuploadhandler.
> > > > > > There's four form fields:
>
> > > > > > 2 input type=file
> > > > > > 1 input type=text
> > > > > > 1 textarea
>
> > > > > > Those map to...
>
> > > > > > 2blobstore.BlobReferenceProperty
> > > > > > 1 StringProperty
> > > > > > 1 TextProperty
>
> > > > > > ... respectively, on my model class.
>
> > > > > > And the problem is... when I submit an input string such as "á é í ó
> > > ú
> > > > > > and ñ", I get: "IuEg6SDtIPMg+iBhbmQg8SI=", both on the 
> > > > > > StringProperty
> > > > > > and TextProperty.
> > > > > > At least, this is what I see on the Data viewer or when I output on
> > > > > > the app.
>
> > > > > > Any workarounds you can think of? Anybody else is having this
> > > problem?
>
> > > > > > On Aug 3, 3:54 pm, ekampf  wrote:
>
> > > > > > > yep..
> > > > > > > It doesnt happend on the local dev server... its definately
> > > something
> > > > > > > undocumented happening on AppEngine
>
> > > > > > > On Aug 3, 10:54 am, alon  wrote:
>
> > > > > > > > it outputs as abase64string? im guessing the post is multi-part
> > > post
> > > > > > > > right?
>
> > > > > > > > On Aug 3, 10:39 am, ekampf  wrote:
>
> > > > > > > > > This happens when text fields are sent via POST and go through
> > > the
> > > > > > > > >Blobstoreuploadhandler.
> > > > > > > > > When English text is used I get the text.
> > > > > > > > > When Hebrew is used I get abase64string...
>
> > > > > > > > > I'm not looking at the datastore dashboard. I'm looking at the
> > > actual
> > > > > > 

[google-appengine] Re: Blobstore upload handler is Base64 encoding strings?

2010-11-13 Thread Satoshi
I wrote a test code, and verified this bug (it happens in Japanese as
well).

Here is the form:



File:




Description




Satoshi


On Nov 12, 11:52 am, "Ikai Lan (Google)" 
wrote:
> Do you guys have any sample code? I'm testing this and seeing that the local
> dev server gives me some strange characters (I'm using Java). What does the
> form look like? How are you reading the input from the form submission?
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> Blogger:http://googleappengine.blogspot.com
> Reddit:http://www.reddit.com/r/appengine
> Twitter:http://twitter.com/app_engine
>
> On Fri, Nov 12, 2010 at 5:09 AM, msmart wrote:
>
>
>
> > I ran into the same issue.
>
> > Has anyone found the corresponding issue in the bug tracker (or a nice
> > workaround)?
>
> > Michael.
>
> > On 26 Okt., 09:28, Kenneth  wrote:
> > > This is a pretty shocking bug (or lack of documentation?) from
> > > Google.  There doesn't appear to be a consistent way to decode the
> > > post results that come from the BlobstoreUploadHandler.  There was a
> > > bug in the issues list for this but I can't find it.  I should put in
> > > another one really but there doesn't seem to be any point.
>
> > > What I do is when the user hits the submit button I send the form
> > > results via an ajax request and once that returns I submit the form to
> > > do the file upload.
>
> > > Pretty sad you have to do that and it means you're requiring
> > > javascript for something that really shouldn't need it.
>
> > > On Oct 25, 10:49 am, Agustin Horischnik  wrote:
>
> > > > Hey, no luck with this? Did you solve this at all?
>
> > > > On Aug 31, 12:40 pm, Agustin Horischnik  wrote:
>
> > > > > I think I'm having the same issue...
>
> > > > > I have a multi-part form posting to ablobstoreuploadhandler.
> > > > > There's four form fields:
>
> > > > > 2 input type=file
> > > > > 1 input type=text
> > > > > 1 textarea
>
> > > > > Those map to...
>
> > > > > 2blobstore.BlobReferenceProperty
> > > > > 1 StringProperty
> > > > > 1 TextProperty
>
> > > > > ... respectively, on my model class.
>
> > > > > And the problem is... when I submit an input string such as "á é í ó
> > ú
> > > > > and ñ", I get: "IuEg6SDtIPMg+iBhbmQg8SI=", both on the StringProperty
> > > > > and TextProperty.
> > > > > At least, this is what I see on the Data viewer or when I output on
> > > > > the app.
>
> > > > > Any workarounds you can think of? Anybody else is having this
> > problem?
>
> > > > > On Aug 3, 3:54 pm, ekampf  wrote:
>
> > > > > > yep..
> > > > > > It doesnt happend on the local dev server... its definately
> > something
> > > > > > undocumented happening on AppEngine
>
> > > > > > On Aug 3, 10:54 am, alon  wrote:
>
> > > > > > > it outputs as abase64string? im guessing the post is multi-part
> > post
> > > > > > > right?
>
> > > > > > > On Aug 3, 10:39 am, ekampf  wrote:
>
> > > > > > > > This happens when text fields are sent via POST and go through
> > the
> > > > > > > >Blobstoreuploadhandler.
> > > > > > > > When English text is used I get the text.
> > > > > > > > When Hebrew is used I get abase64string...
>
> > > > > > > > I'm not looking at the datastore dashboard. I'm looking at the
> > actual
> > > > > > > > POST data (via logging)
>
> > > > > > > > On Aug 3, 10:18 am, alon  wrote:
>
> > > > > > > > > Does that happen everytime on theblobstoreonly api? or
> > regular text -
>
> > > > > > > > > > datastore?
>
> > > > > > > > > One more thing, there is a huge difference on how the text is
> > being
> > > > > > > > > displayed on the datastore dashboard. are you sure its being
> > saved as
> > > > > > > > >base64? the pageencodingfor the production datastore browser
> > is
> > > > > > > > > massed up and cant display hebrew correctly in o

[google-appengine] Re: Attempts to deploy result in 500 Server Error

2010-11-06 Thread Satoshi
I was having the same problem (error 500 when deploying my app) this
morning (between 9am and 10am Pacific time), but it is working now
(10:20am Pacific time).

Satoshi

On Nov 6, 9:20 am, Chris Copeland  wrote:
> +1
>
> Can't deploy.  Can't access console.  Maintenance isn't scheduled to start
> for 2.5 hours.
>
> Error 500: --- begin server output ---
>
> Error: Server Error
> The server encountered an error and could not complete your
> request.If the problem persists, please  HREF="http://code.google.com/appengine/community.html";>report your 
> problem and
> mention this error message and the query that caused it.
>
> On Sat, Nov 6, 2010 at 11:17 AM, Jeremy Benetz wrote:
>
>
>
> > I'm getting 500 errors  when simply trying to open the admin console for my
> > apps.  Something is seriously wrong with the app engine this morning.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to google-appeng...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine+unsubscr...@googlegroups.com > e...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: Passing other parameters when uploading data to a blob store

2010-11-03 Thread Satoshi
I found the bug. It was caused by the extra space after "name=", which
the SDK version of app engine ignores gracefully, but the appspot.com
version can't handle.

I wasted probably three hours tracking this bug. I love software
engineering in general, but sometimes hate my job - I think the
software engineering is the only job in the world where just an extra
space causes such a pain!

Satoshi

On Nov 3, 5:03 pm, Satoshi  wrote:
> I am wring an iPhone app that uploads an image to a blob via HTTP-
> POST. Everything has been working great so far.
>
> Recently, I decided to send a parameter "uuid" along with the image.
> My python code on the server side (subclass of
> blobstore_handlers.BlobstoreUploadHandler) receives this uuid (along
> with the image) correctly as long as I run it under SDK, but fails to
> receive the uuid when I deploy this app to the actual sever on
> appspot.com. Is there any known issue with this additional parameter
> to BlobstoreUploadHandler?
>
> Here is my python code:
>
> gdispatch.route(lambda: ('/blob/upload', UploadHandler))
> class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
>     @gdispatch.kwargs
>     def post(self, uuid):
>         upload_files = self.get_uploads('file')  # 'file' is file
> upload field in the form
>         blob_info = upload_files[0]
>         logging.info("/blog/upload uuid=%s" % uuid)
>         ...
>
> gdispatch.kwargs is a decorator to make those parameters accessible as
> arguments:
>
> def kwargs(original_func):
>     """ This decorator allows RequestHandlers to receive get/post
> parameters as named arguments """
>     import inspect
>     argspec = inspect.getargspec(original_func)
>     args = tuple(argspec[0][1:])
>     def decorated_func(rh):
>         kwargs = dict([(arg, rh.request.get(arg)) for arg in args])
>         return original_func(rh, **kwargs)
>     return decorated_func
>
> Here is the actually data I am posting:
>
> --somethingUniquegc0p4Jq0M2Yt08jU534c0p
> Content-Disposition: form-data; name= "uuid"
>
> 4123DD08-A663-485B-AC03-EBC62B1F46C8
> --somethingUniquegc0p4Jq0M2Yt08jU534c0p
> Content-Disposition: form-data; name="file"; filename="Library Image"
> Content-Type: image/jpeg
> {... actual image data in binary format ...}
>
> --somethingUniquegc0p4Jq0M2Yt08jU534c0p--

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Passing other parameters when uploading data to a blob store

2010-11-03 Thread Satoshi
I am wring an iPhone app that uploads an image to a blob via HTTP-
POST. Everything has been working great so far.

Recently, I decided to send a parameter "uuid" along with the image.
My python code on the server side (subclass of
blobstore_handlers.BlobstoreUploadHandler) receives this uuid (along
with the image) correctly as long as I run it under SDK, but fails to
receive the uuid when I deploy this app to the actual sever on
appspot.com. Is there any known issue with this additional parameter
to BlobstoreUploadHandler?

Here is my python code:

gdispatch.route(lambda: ('/blob/upload', UploadHandler))
class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
@gdispatch.kwargs
def post(self, uuid):
upload_files = self.get_uploads('file')  # 'file' is file
upload field in the form
blob_info = upload_files[0]
logging.info("/blog/upload uuid=%s" % uuid)
...

gdispatch.kwargs is a decorator to make those parameters accessible as
arguments:

def kwargs(original_func):
""" This decorator allows RequestHandlers to receive get/post
parameters as named arguments """
import inspect
argspec = inspect.getargspec(original_func)
args = tuple(argspec[0][1:])
def decorated_func(rh):
kwargs = dict([(arg, rh.request.get(arg)) for arg in args])
return original_func(rh, **kwargs)
return decorated_func

Here is the actually data I am posting:

--somethingUniquegc0p4Jq0M2Yt08jU534c0p
Content-Disposition: form-data; name= "uuid"

4123DD08-A663-485B-AC03-EBC62B1F46C8
--somethingUniquegc0p4Jq0M2Yt08jU534c0p
Content-Disposition: form-data; name="file"; filename="Library Image"
Content-Type: image/jpeg
{... actual image data in binary format ...}

--somethingUniquegc0p4Jq0M2Yt08jU534c0p--

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Admin UI issue

2010-05-28 Thread Satoshi
As the result of the international launch of iPad, my app
(CloudReaders - a PDF/comic reader) became quite popular (great new),
but the back-end server on app-engine is totally overloaded exceeding
the daily paid quota (bad news). I have already set it as a paid
account ($2.00/day), but I need to change the configuration to respond
to this sharp increase of traffic (I need more "Outgoing Bandwidth").

The really bad news is in the fact that I am not able to find any link
or button in the admin page (the "Billing Settings" page), which
allows me to increase the quota.

I can see the "Billing Status",
I see my name as the "Billing Administrator",
I see the "Current Balance" and "Resource Allocations:",
but there is no UI that allows me to pay more.

Where do I have to go to re-configure my billing settings?

Regards,
Satoshi "an iPad Developer who also loves Python and App Engine"
Nakajima

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: simultaneous dynamic request limit

2010-03-01 Thread Satoshi
I've got the same warnings several time today too. The peak access
rate was only 3.00 requests/sec, and the CPU time usage over the last
24 hours is 6% (1.08 CPU hours) out of 18.50 CPU hours (I am a paying
customer).

Satoshi

On Mar 1, 6:51 pm, David  wrote:
> I am losing sleep over this, so any help would be greatly appreciated!
>
> APP ID: conit-app01
>
> Since our app released about a week ago, it has been getting an
> average of about 60 requests/second.  On February 27, our app suddenly
> crashed and was down for several hours, with thousands of these errors
> appearing in the logs:
>
> Request was aborted after waiting too long to attempt to service your
> request. Most likely, this indicates that you have reached your
> simultaneous dynamic request limit. This is almost always due to
> excessively high latency in your app. Please 
> seehttp://code.google.com/appengine/docs/quotas.htmlfor more details.
>
> Since getting this error, I filled out a request to increase this
> limit 
> at:http://code.google.com/support/bin/request.py?contact_type=AppEngineC...
>
> This request was denied, because, "your app has been using, over the
> past 24 hours, on average 60 QPS with a peak of ~135 QPS; thus you're
> well under the 500 QPS limit described above."
>
> Since this crash, I've also been working to decrease calls to the
> datastore, and I think our average CPU time has decreased around 30%.
> In the dashboard, one of our pages still appears "yellow" under the
> column "Average CPU (API)", with a speed of about 1100.  This page is
> about 6% of the volume of our app.  The other pages don't have any
> warnings.  We are well within the limits of our billing.
>
> I would feel much better if I could understand the math/metrics that
> go into producing this error, so it doesn't happen again.  How can I
> know if my page request times are low enough?  If I add a new page
> with a higher CPU time, how can I know if it would make the app crash?
>
> Any help or references to details on this error would be appreciated.
>
> Thank you in advance.
> -David

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: Conserve outgoing bandwidth

2010-02-18 Thread Satoshi
You need to explicitly specify the expiration date in app.yaml like
this:

- url: /images
  static_dir: images
  expiration: 10d

If you are already using firebug, I strongly recommend YSlow (a
firebug extension), which will tell you which files are missing expire
headers.

Satoshi

On Feb 18, 4:41 pm, Anekdotz  wrote:
> I've been using firebug and it seems to be setting the cache headers
> correctly (firefox doesn't re-download static files each time).  I
> guess it's just a problem I have to deal with.  I think you're right
> about the load-tester not using headers, so maybe it won't be as big a
> problem as I thought.
>
> One more thing though.. In the appengine dashboard the static requests
> claim to be consuming 0kb, even when I clear my browser's cache.  Yet
> these requests seem to be counting against the quota..  Does it just
> report it incorrectly?
>
> Thanks again..
>
> On Feb 18, 5:49 pm, Locke  wrote:
>
>
>
> > Just use the "Live HTTP headers" Firefox add-on. Look for HTTP code
> > "304 Not Modified" after refreshing a page. If you don't see it, your
> > cache headers aren't being set properly.
>
> > It could be the case that your load-tester is not obeying HTTP or not
> > providing accurate simulations of real-world scenarios. Even if you
> > have lots of hits, many of them will be repeat hits from users who
> > already have your static content cached locally.
>
> > On Feb 18, 5:34 pm, Anekdotz  wrote:
>
> > > From reading other threads I was under the impression that AppEngine
> > > sets cache headers automatically if you define static directories in
> > > app.yaml..  Am I misinformed?
>
> > > Arjun
>
> > > On Feb 18, 2:59 pm, "Ikai L (Google)"  wrote:
>
> > > > Do you have cache headers for your assets? This'll cause browsers not 
> > > > to try
> > > > to redownload them for repeat visitors - this is a good practice in 
> > > > general
> > > > for fast websites.
>
> > > > On Wed, Feb 17, 2010 at 7:11 PM, Anekdotz  
> > > > wrote:
> > > > > I recently stress tested my app with some troublesome results.  While
> > > > > the CPU, Datastore and Memcache quotas were barely consumed, my
> > > > > Outgoing Bandwidth quota was used approximately 30 times as much.
> > > > > I.e. for usage of 1% CPU I had used 28% of my bandwidth quota.
>
> > > > > The vast majority of the bandwidth was used for static files (image/
> > > > > css/javascript).  I've heavily optimized most operations so this is
> > > > > kind of annoying.  Also, since my app does not store large files for
> > > > > download, I feel like I'm "wasting" this resource with respect to the
> > > > > others.
>
> > > > > I'm thinking of moving these files to another location, like storing
> > > > > them on google sites or google code.  Since these aren't optimized for
> > > > > serving files I would like to use appengine to serve them until the
> > > > > bandwidth quota is getting close to depleted and then dynamically
> > > > > switching to the external services.  For this I would need to
> > > > > programmatically determine how much bandwidth is being used, but
> > > > > unfortunately the Quota API seems to only provide CPU usage.
>
> > > > > Does anyone know of a way to do this?  Or if you have any better ideas
> > > > > on preserving bandwidth with respect to the other resources, I'm all
> > > > > ears.
>
> > > > > Thanks,
> > > > > Arjun
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google 
> > > > > Groups
> > > > > "Google App Engine" group.
> > > > > To post to this group, send email to 
> > > > > google-appeng...@googlegroups.com.
> > > > > To unsubscribe from this group, send email to
> > > > > google-appengine+unsubscr...@googlegroups.com > > > >  e...@googlegroups.com>
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/google-appengine?hl=en.
>
> > > > --
> > > > Ikai Lan
> > > > Developer Programs Engineer, Google App 
> > > > Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] obsolete indexes

2010-02-08 Thread Satoshi
I have an app on Google App Engine, which has evolved over time. As
the result, a model "Plan" on the server has six indexes even though I
need only four of them.

I've clean-up the index.yaml file (which has four indexes for Plan),
and re-deployed the app several times since then but those extra
indexes never disappear from the server.

Here are my questions:

Q1. Is there any extra cost in 'put' operations because of those those
extra indexes?
Q2. Is there any way to remove those extra indexes?

Satoshi

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: Best practice for caching frequent datastore reads

2010-02-01 Thread Satoshi
First of all, if you really care about the performance, store those
data in static directly and let the app engine directly return it (and
update the whole app when you need to update the data).

Second, please be aware that caching object may not be the most
efficient way. In many cases, caching the final output (typically HTML
file or JSON file) in memcache gives you the best performance. I am
using this technique in all my projects, and it is working very
well.

If you still want to cache objects, here is my suggestion.

While creating a fancy generic class that automatically performs
caching seems clever and elegant, that kind of architecture tends to
create more headache in future when the project gets bigger and more
engineers are involved. I much prefer to hook get/put accesses
explicitly for each class.

Here is a piece of code I am using in my project (cacheman is my
memcache name space manager where I can easily control the namespace -
which is a good practice).

SEC_USER = 60*60 # one hour

@classmethod
def get_user(cls, uid):
cache_key = cacheman.user(uid) # which performs ("/user/
%s" %s uid)
user = memcache.get(cache_key)
if user:
return user
user = cls.get_by_key_name(uid)
if user:
memcache.set(cache_key, user, SEC_USER)
return user

def put(self):
cache_key = cacheman.user(self.key().name())
memcache.set(cache_key, self, SEC_USER)
return super(User, self).put()

Please notice that I am overriding put() method so that I always call
memcache.set, but NOT overriding get_key_by_name (this is just my
preferred coding style, which you don't need to follow).

Please be aware that you need to just get keys when you perform query,
and use the accessor (in my case get_user) to get the actual object.

Satoshi

On Feb 1, 3:40 am, k3xji  wrote:
> Hi all,
>
> I am thinking of away to imlement a generic way for my frequently
> readed data models. The access pattern for these models is that they
> will be retrieved very frequently but updated maybe once in a month.
> Think aboiut a game site. Game categories will not and should not be
> updated at the time they are created. BUt these will be used in my
> front page so every page request will query the db for all the game
> categories. So best way is to memcache these entries.
>
> So, what you prefere as a best practice for these kind of things? I am
> thinking of a generic class that takes a model as a parameter and
> hooks the put() method of it. If model is somehow changed, I will
> update a dirty flag and retrive the contents from the DS, otherwise
> get it from the memcache. But not sure, how to hook all db
> operationsof a model, there are many ways to do that and I am assuming
> there must be a better way to do this, maybe someone else has already
> done this work? Is there a generic way to do this?
>
> Thanks,

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: How memcache work?

2010-02-01 Thread Satoshi
There is no transaction mechanism around memcache. Although it is
technically possible to use an entity group (or groups) on the
datastore to create a transaction mechainsm on top of memcache, it
does not make sense to use slower mechanism (datastore) on top of
faster mechanism (memcache).

Generally speaking, you should use memcache to return a "snapshot" of
data to the client. If you need transactions, go directly to the
datastore.

Satoshi

On Feb 1, 6:35 am, masterzim  wrote:
> In official documentation I didn't find nothing about memcache
> transaction. What happens if I access to memcache from different
> request( this is save? ) , is transactions atomic? This will be great
> if somebody can explain this.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] question about memcache time

2010-01-27 Thread Satoshi
I am building a social network site, which involves a lot of
activities by users. I am using memcache to keep track of "who is
online". Whenever a user access my site, I store some user information
(name, etc.) to memcache using the user id as the memcache key. By
making the memcache timer short (a few minutes), I am able to quickly
detect a particular user is on-line or not.

In order to fully optimize this algorithm, I would like to know if the
memcache timer (started as the result of previous memcache.set) will
be reset when I call memcache.get or not.

If memcache.get does reset the timer, I will simply call memcache.get
each time the user accesses the site, and do nothing if it succeeds
(and call memcache.set if it fails).

If it does not, I need to call memcache.set whenever the user access
the site (to explicitly reset the timer).

I'd appreciate your help.
Satoshi

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.



[google-appengine] Re: This App Engine is a JOKE

2010-01-13 Thread Satoshi
> 2. Use the flash to retrieve the data from datastore. If the request
> failed, retrieve it again.

This can be done using HTML+JavaScript as well. Here is the piece of
code from my app (notice that it uses jQuery), which performs HTTP-GET
(which could be HTML, JSON or anything) and retry up to three times.

var fetch = function(url, callback) {
var retry = 0;
var _attempt = function() {
$.ajax({
type: "GET",
url: url,
success: function(data) {
callback(data);
},
error: function () {
if (retry<3) {
retry++;
_attempt();
} else {
// display error to the user
...
}
}
});
};
_attempt();
}
-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




[google-appengine] Re: Best way to model relations

2010-01-07 Thread Satoshi
I'd add "reference_count" property (IntegerProperty(default=0)) to
Photo entity, and increment it each time a reference happens. Then,
call Photo.all().order("-reference_count").fetch(100) to get the top
100 most referenced photos.

A few additional notes:
1. If you need an accurate reference count number, you need to put the
routine (which reads the Photo entity, increment the reference count,
and put it back to the database) into a transaction, but it is
relatively expensive. I usually don't put it in a transaction unless I
absolutely need an accurate number.
2. Making too many put() calls in one HTTP request is not a good idea.
I'd suggest to perform non critical operations (such as incrementing
reference count) asynchronously using Task Queue.

Satoshi

On Jan 6, 4:15 pm, Daniel Aguilar  wrote:
> Hi Satoshi,
>
> thanks for your reply, it really helped.
> In fact I just read this 
> artile:http://code.google.com/appengine/articles/modeling.html
> and have started implementing based on it.
> Still wondering a couple of things, though...
> for instance, in my app I have another class called Collage.
> A collage entity has properties like name, date_created, etc... but also
> layer_0, layer_1 and layer_2, which are references to Photo entities.
> What kind of query could i perform in order to get the most referenced
> Photos?
>
> Thanks again!
>
> need to keep track of how many times
>
>
>
> On Thu, Jan 7, 2010 at 12:51 AM, Satoshi  wrote:
> > First of all, please remember that GAE/database is an Object-database,
> > not a Relational-database. You can design your database with
> > relations, but you will likely hit a roadblock later if you heavily
> > rely on relations (because of the lack of JOIN and the performance
> > problem of nested queries).
>
> > If I were you, I would simply create two models (Artist and Photo),
> > and have the "artist" property on Photo class, which is just a
> > reference to an Artist entity (ReferenceProperty).  If you want to
> > show all the Photos done by a particular Artist, you just need to
> > query it (Photos.all().filter('artist', ...)).
>
> > Alternatively, you could specify the Artist entity as the parent
> > entity of each Photo, which essentially creates an entity group for
> > each Artist - which has pros (transactions) and cons (possible
> > performance hit because of transactions).
>
> > Third alternative is ListProperty, but this is difficult to do it
> > right without putting them in an entity group (which is alternative
> > two)...
>
> > Satoshi
>
> > On Jan 5, 9:52 am, Daniel A  wrote:
> > > Hi there,
>
> > > I just started writting my first app after reading some documentation
> > > and tutorials.
> > > Looks like an exciting platform to develop on, but there're many
> > > things I still have doubts about.
> > > I used to develop in PHP/MySQL, and I quite don't get how should I
> > > proceed in order to get an efficient relational model.
>
> > > To simplify things, I have two kind of entities: Artist and Photo. I
> > > need to define relations one-to-many between instances of these two
> > > entities. That is, an Artist can have many Photos, and a Photo can
> > > only have one Artist.
>
> > > In my table-shaped mind, I would model three kinds of entities
> > > (Artist, Photo, ArtistPhotoRelation). Would this approach be the right
> > > thing in GAE/datastore? Maybe I should avoid the relational entity,
> > > and use multiple-valued properties in the Artist instead?
>
> > > Thanks a lot!
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine" group.
> > To post to this group, send email to google-appeng...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine+unsubscr...@googlegroups.com > e...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine?hl=en.
-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




[google-appengine] Re: Best way to model relations

2010-01-06 Thread Satoshi
First of all, please remember that GAE/database is an Object-database,
not a Relational-database. You can design your database with
relations, but you will likely hit a roadblock later if you heavily
rely on relations (because of the lack of JOIN and the performance
problem of nested queries).

If I were you, I would simply create two models (Artist and Photo),
and have the "artist" property on Photo class, which is just a
reference to an Artist entity (ReferenceProperty).  If you want to
show all the Photos done by a particular Artist, you just need to
query it (Photos.all().filter('artist', ...)).

Alternatively, you could specify the Artist entity as the parent
entity of each Photo, which essentially creates an entity group for
each Artist - which has pros (transactions) and cons (possible
performance hit because of transactions).

Third alternative is ListProperty, but this is difficult to do it
right without putting them in an entity group (which is alternative
two)...

Satoshi

On Jan 5, 9:52 am, Daniel A  wrote:
> Hi there,
>
> I just started writting my first app after reading some documentation
> and tutorials.
> Looks like an exciting platform to develop on, but there're many
> things I still have doubts about.
> I used to develop in PHP/MySQL, and I quite don't get how should I
> proceed in order to get an efficient relational model.
>
> To simplify things, I have two kind of entities: Artist and Photo. I
> need to define relations one-to-many between instances of these two
> entities. That is, an Artist can have many Photos, and a Photo can
> only have one Artist.
>
> In my table-shaped mind, I would model three kinds of entities
> (Artist, Photo, ArtistPhotoRelation). Would this approach be the right
> thing in GAE/datastore? Maybe I should avoid the relational entity,
> and use multiple-valued properties in the Artist instead?
>
> Thanks a lot!
-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




[google-appengine] Re: Using memcache effectively

2010-01-06 Thread Satoshi
It probably depends on the type of application, but memcache does not
help you much if you have a lot of customized output (which are
different
from one user to another).

My application (social network application) has a very similar
requirement,
and I am solving this problem by doing following:

1. Break the data into pieces, so that each data is identical to all
the users,
2. Assign a unique URL to each data, and cache them in memcache using
the URL as the key,
3. Write some JavaScript code on the client side and construct the
custom page
by retrieving those data using AJAX (typically in JSON format, but you
can use HTML-let as well).

In other word, the server side of code is mostly acting as Model (in
MVC), and
the JavaScript code on the client side is acting as Controller.

I found that this architecture works really well with App Engine and
memcache, allowing me
to keep the cache hit rate very high (>95%) and the average access
time to below 100 cpu_ms.

By the way, please aware that you still need to put some access
control on the server side (above memcache).
For example, the "profile of each user" can be accessed via "http://
myapp.appspot.com/profile?uid={user_id}"
(which can be cached in memcache), you want to make it sure that only
friends can access that profile.

Satoshi

On Jan 5, 1:21 pm, dburns  wrote:
> My app may display a lot of different output for a given page
> (customized per user amongst other things), and I'm wondering how best
> to use memcache.
>
> My current scheme is to estimate that a given user's output might be
> useful for, say 10 minutes, after which time the user has probably
> gone away so there's no point caching it.  It's not that the content
> is invalid after 10 minutes (I explicitly clear memcache if content
> becomes invalid).  Rather, I'm trying to aid memcache in determining
> what it can get rid of.
>
> Is this a good idea, or am I interfering with memcache's algorithm?
> It may all depend on the exact details of the application, but I'm
> wondering if there any general advice on memcache usage.
>
> Thanks.
-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.




[google-appengine] Is Model.get_or_insert with no parent really thread safe?

2009-11-10 Thread Satoshi

I am implementing a mechanism to guarantee the uniqueness of property
value (account name of User entity). I am using Model.get_or_insert
mechanism in this process, but the following description in the
document makes me wonder if it is really thread-safe.

|   In other words, get_or_insert() is equivalent to this Python code:
|
|   def txn():
| entity = MyModel.get_by_key_name(key_name, parent=kwds.get
('parent'))
| if entity is None:
|   entity = MyModel(key_name=key_name, **kwds)
|   entity.put()
| return entity
|
|   return db.run_in_transaction(txn)

I understand that this is thread-safe when I specify a parent, because
both new entity and existing entity share the same parent, which means
both belong to the same entity group.

What I don't understand is the case where I don't specify a parent. In
that case, new entity and existing entity are root entities - which
means there are not in the same entity group. In such a case, it seems
that there is a small chance that two threads see None as the result
of get_by_key_name, and got into a race condition.

It really depends how Google implements Model.get_or_insert(), and I'd
really appreciate if somebody in Google could give me the answer.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---