Re: [appengine-java] Re: Slow cold starts

2012-03-08 Thread Mark Rathwell
Just wanted to follow up on this:

Idle instances set to 1:  7 of 10 requests were loading requests (20-30 seconds)
Idle instances set to 2:  3 of 9 requests were loading requests (and
cost was about 4 times as much)

This is a test app, with no other traffic, no new versions uploaded,
etc., and these requests were about once a day for the last few weeks.
 I'm giving up on finding a setting that will mimic always on for low
traffic apps, and just setting up a cron job to ping the apps
regularly.


On Wed, Feb 29, 2012 at 10:51 PM, Anders  wrote:
> Hmm... Not good. Google writes that setting minimum number of instances
> means keeping them in reserve so that cold starts will be unlikely unless
> there are exceptionally high load spikes. Sounds like a bug in GAE then if
> your application is set to minimum one instance and you still get many cold
> starts.
>
> Plus to Google: Seems like my email address is sometimes published because I
> usually get zero spam mail in my Gmail account except when I have recently
> posted something in a Google Group like this. So spammers seem to be able to
> somehow get my email address by scraping information from Google Groups or
> via some subscription mechanism. Very bad indeed if true (with the
> disclaimer that maybe it's not Google that is leaking email addresses).
>
>
> On Wednesday, February 29, 2012 7:24:45 PM UTC+1, Mark Rathwell wrote:
>>
>> > Ok, interesting. Have you tried setting minimum instances to one?
>>
>> I have an app I've been testing, with billing enabled and minimum
>>
>>
>> instances set to one.  I check the app 1 - 2 times per day, and the
>> overwhelming majority of those requests are cold starts.  I just set
>> the minimum instances to 2, so I'll see how it responds over the next
>> few days.
>>
>> On Wed, Feb 29, 2012 at 6:25 AM, Anders wrote:
>> > Ok, interesting. Have you tried setting minimum instances to one?
>> >
>> >
>> > On Monday, February 27, 2012 8:40:41 AM UTC+1, Tapir wrote:
>> >>
>> >> From my experience, an app without billing enabled will encounter many
>> >> many slow cold starts.
>> >> That is why although my app visits is small but I still made my app
>> >> billing enabled.
>> >> But today, there are suddenly many cold starts again on my app even if
>> >> it is billing enabled.
>> >>
>> >> On Feb 27, 12:30 am, Anders wrote:
>> >> > Thanks. The app no longer has billing enabled (needed to be able to
>> >> > adjust
>> >> > minimum instances), but that could be worth trying.
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > On Sunday, February 26, 2012 2:26:00 PM UTC+1, Mike Lawrence wrote:
>> >> >
>> >> > > I noticed similar behavior.
>> >> > > I think the auto setting for minimum number
>> >> > > of instances changed from two to zero active
>> >> > > instances.
>> >> > > I changed from auto to one, and my app
>> >> > > is much more responsive. setting minimum
>> >> > > instances higher will co$t you more
>> >> >
>> >> > > On Feb 25, 9:36 am, Anders wrote:
>> >> > > > In the recent weeks the cold starts for Java apps have started to
>> >> > > > take a
>> >> > > > long time in my experience. More than three seconds to load a
>> >> > > > webpage is
>> >> > > > too long generally for a high quality end user experience. I
>> >> > > > assume
>> >> > > > it
>> >> > > > happens when the physical GAE servers become too crowded
>> >> > > > resulting
>> >> > > > in
>> >> > > > sluggish cold start loading of apps from the file system (and/or
>> >> > > > maybe
>> >> > > > because of delays in the distributed file system itself).
>> >
>> > --
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine-java/-/GZ1p0GyAe6MJ.
>
> To post to this group, send email to google-appengine-java@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.

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



Re: [appengine-java] Re: Slow cold starts

2012-02-29 Thread Mark Rathwell
> Ok, interesting. Have you tried setting minimum instances to one?

I have an app I've been testing, with billing enabled and minimum
instances set to one.  I check the app 1 - 2 times per day, and the
overwhelming majority of those requests are cold starts.  I just set
the minimum instances to 2, so I'll see how it responds over the next
few days.

On Wed, Feb 29, 2012 at 6:25 AM, Anders  wrote:
> Ok, interesting. Have you tried setting minimum instances to one?
>
>
> On Monday, February 27, 2012 8:40:41 AM UTC+1, Tapir wrote:
>>
>> From my experience, an app without billing enabled will encounter many
>> many slow cold starts.
>> That is why although my app visits is small but I still made my app
>> billing enabled.
>> But today, there are suddenly many cold starts again on my app even if
>> it is billing enabled.
>>
>> On Feb 27, 12:30 am, Anders  wrote:
>> > Thanks. The app no longer has billing enabled (needed to be able to
>> > adjust
>> > minimum instances), but that could be worth trying.
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Sunday, February 26, 2012 2:26:00 PM UTC+1, Mike Lawrence wrote:
>> >
>> > > I noticed similar behavior.
>> > > I think the auto setting for minimum number
>> > > of instances changed from two to zero active
>> > > instances.
>> > > I changed from auto to one, and my app
>> > > is much more responsive. setting minimum
>> > > instances higher will co$t you more
>> >
>> > > On Feb 25, 9:36 am, Anders  wrote:
>> > > > In the recent weeks the cold starts for Java apps have started to
>> > > > take a
>> > > > long time in my experience. More than three seconds to load a
>> > > > webpage is
>> > > > too long generally for a high quality end user experience. I assume
>> > > > it
>> > > > happens when the physical GAE servers become too crowded resulting
>> > > > in
>> > > > sluggish cold start loading of apps from the file system (and/or
>> > > > maybe
>> > > > because of delays in the distributed file system itself).
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine-java/-/gCjF8DpwWJcJ.
>
> To post to this group, send email to google-appengine-java@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.

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



[appengine-java] Re: app engine server availability

2012-01-27 Thread Mark
Me too, having exact same problem as you Carter.  My Dashboard only
shows last hour or so of activity http://tinypic.com/r/2yotlco/5.  I
also have only 1 instance running when I normally would have 3
running.  seems like the whole app engine had an issue and got
rebooted?

On Jan 27, 7:27 am, Carter Maslan  wrote:
> This has been bad for us.
> We've seen continual failures in our running app starting at:
> 2012-01-27 05:27:26.339 PST
> and continuing through:
> 2012-01-27 06:50:17.318 PST
>
> Things appear to be normal now, but we're missing Dashboard graphs for
> everything prior to 6:50 PST.
>
>
>
>
>
>
>
> On Fri, Jan 27, 2012 at 6:52 AM, Miroslav Genov  wrote:
> > Looks like there are latency issues:
> >http://code.google.com/status/appengine/detail/serving-java/2012/01/2...
>
> > Regards,
> >  Miroslav
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To view this discussion on the web visit
> >https://groups.google.com/d/msg/google-appengine-java/-/lwzi75o_Lm4J.
>
> > To post to this group, send email to
> > google-appengine-java@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine-java+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.

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



[appengine-java] Optimise billing on app engine for continual polling

2011-12-19 Thread Mark Silberbauer


I'm creating a service on appengine that feeds back measurements to the 
user. The measurements are collected by polling another server every 
fifteen minutes (the user needs four measurements over the last hour). I 
son't expect there to be a high load on the server so there won't be many 
requests coming in for the data, but because the user needs data over the 
last hour I am forced to poll continuously. This makes me concerned about 
billing because the new billing system charges per instance hour at a 15 
min granularity and this would mean I'd be running 24/7.

*Question*

So, I expect a low request rate and am not too concerned about latency etc. 
How can I optomise this setup for the lowest possible billing?

*What I had planned*

What I was planning to do was try and get away with the free quota for now 
by setting max idle instance to 1 and only using the frontend to do both 
polling and serving (I'm guessing site responsivness will suffer a fair 
amount) because the frontend has far more free instance hours (28) than the 
backend (9). Can the even frontend be set up to poll every 15 mins?

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/ISVXkNqL3ksJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Local datastore can't be browsed but has data

2011-10-10 Thread Mark Silberbauer
@gk. Yes, it was the app id after all.

Here is a stackoverflow question and answer that covers this topic: 
http://stackoverflow.com/questions/5443855/how-can-i-change-my-app-id-in-gae-and-still-access-the-same-permanent-datastore

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/UUXazRXbG1UJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Local datastore can't be browsed but has data

2011-10-08 Thread Mark Silberbauer
Hi, 

My local datastore in my development environment is about 4MB. After testing 
the deployment process to the cloud I noticed that when running on my local 
dev server the datastore started showing as empty (in the admin console and 
when loading in my code) but the file is still 4MB large. I may have changed 
the application ID during the "deploy to cloud" process. Is the datastore 
ties to an application ID? Would this be the cause of the store showing up 
as empty?

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/UBnIK9L64L8J.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Communication between Servlets and Tasks

2011-10-04 Thread Mark Silberbauer
I would like to write a method which handles the flow of communication on 
XMPP.  The sequence of things I'd like to do is:

1. Send message.
2. Wait for response.
3. Process the response.

Since we could be waiting longer than 30s for the response (step 2) I'll be 
teeing up a task to take care of this. This task will need to send the 
message and then wait for a response on the XMPP servlet handling the 
incoming message. My question is: How do I wait in the task servlet thread 
for the response to arrive in the XMPP Servlet? 

I'd normally use a listener pattern where the listener would store the 
message in a field in the Task object and then trigger a Semaphore to signal 
that a message has arrived. Like this:
1. Install listener in XMPP servlet in a static field.
2. Send message.
3. Wait for semaphore.   Meanwhile, in the XMPP servlet thread, a 
response will arrive and it will call the listener's callback method which 
stores the message and releases the semaphore.
4. Get message from field and process.

I tried this and it worked fine on the development server. However, when I 
uploaded to the cloud I found that I'd install the listener on the XMPP 
servlet (step 1) but then a new instance of the servlet would be 
instantiated when the message came in and there would no longer be a 
reference to the listener to call, event through the listener is a static 
field. My conclusion is XMPPServlet is run in a completely different VM 
meaning the static field is not shared between that servlet and the task 
one. Is this correct?

In general what is the best practice for communication between these 
servlets? How to I share data (normally I would've stored it in an object's 
field) and how do I signal from one to the other when events occur (normally 
I would've used a semaphore)? 

Sorry about the long winded question. Tell me if it's not clear and I'll 
refine it a bit.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/Ek_Xr5Etj20J.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Which credentials should I put in for Google App Engine BulkLoader at JAVA development server?

2011-10-01 Thread Mark Nuttall-Smith
Hi, in theory you should be able to enter any credentials, as long as the 
username is a valid email address. In practice I've never found that this 
works - I would always get an "Authentication Failed" error.

The solution in my case was to run an http proxy such as Charles in the 
background.

Not sure this is entirely the same situation as you however, as your problem 
seems to be something to do with the SSL configuration - can you switch this 
off as well perhaps?

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/u8zD8qS-l44J.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



Re: [appengine-java] datastore statistics vs quota usage (again)

2011-08-19 Thread mark-ns
Hi Ikai,

Thanks for the reply. 

Nope, the two indexed fields are a jodatime LocalDate (actually persisted as 
a string via an Objectify type converter) and a string. I've verified that 
the other properties are not indexed by trying to query against them in the 
datastore viewer console.

I have been quite concerned by this, so I actually created another project 
using the non-HFR datastore, but again I have very wacky statistics - 38Mb 
listed under Datastore Statistics, but 0.25Gb usage on Quote Details. The 
datastore hasn't been updated for at least a week now, so even if they are 
calculated asyncronously I would really expect them to be accurate by now.

I don't know if you have access to the admin console of users projects, but 
the non-HFR one is called mojointest if so.

Cheers,
Mark

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/D9-1DtuCKuMJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] datastore statistics vs quota usage (again)

2011-08-05 Thread mark-ns
Hi,

I saw another post where a user was asking a similar question to this, but 
he didn't seem to have quite the same scale of discrepancy as me:-

I have the following datastore statistics:

Total number of entities   Size of all entities 
39,307 12 MBytes

And here are my quota details for HR data:

High Replication Data 17% 0.08 of 0.50 GBytes Okay

I understand that indexes are not included in the datastore statistics, but 
only two of the seven fields on these entities are indexed (everything else 
marked with @Unindexed for Objectify). 

What can explain the ~7x size difference between datastore statistics and 
quota usage?

Thanks,
Mark



-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/QHlLOyuVwX4J.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: UnknownJavaServerError when bulkloading to dev appserver

2011-07-16 Thread mark-ns
Ok, a bit of ignorance on my part here - it didn't quite click that the 
bulkloader would be subject to the 30 second timeout when running against 
the dev appserver. Lo and behold when I increased the log level on the 
appserver, there were the errors.

However, I will say that tuning of the bulkloader seems to be a bit of a 
black art at the moment. I managed to get the data loaded by setting 
batch_size to 100 and rps_limit to 5000, but I can't find any clear 
guidelines on how to improve the efficiency of the upload. If something like 
that could be added to the documentation I'm sure it would be appreciated by 
people coming fresh to the platform.

Cheers,
Mark

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/aXiq53fCBboJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] UnknownJavaServerError when bulkloading to dev appserver

2011-07-16 Thread mark-ns
Hi all,

I've seen a few other people asking about this around the internet (eg. 
http://www.mail-archive.com/google-appengine@googlegroups.com/msg34608.html, 
http://markmail.org/message/o35btiibcsqurenv) but it appears that no one has 
got to the bottom of it yet.

I need to use the bulkloader to load a largish file (14.4Mb), the 
configuration works ok as sometimes I will be able to load the file 
successfully, but more often that not I get the UnknownJavaServerError shown 
in the log file below... which really doesn't tell me anything. I've tried 
reducing and increasing the batch size (set to 100 in log below), but that 
doesn't seem to have any impact. 

Could anyone please explain the inconsistent behaviour, and suggest a 
solution?

Many thanks,
Mark


Uploading data records.
[INFO] Logging to bulkloader-log-20110716.140518
[INFO] Throttling transfers:
[INFO] Bandwidth: 25 bytes/second
[INFO] HTTP connections: 8/second
[INFO] Entities inserted/fetched/modified: 20/second
[INFO] Batch Size: 100
[INFO] Opening database: bulkloader-progress-20110716.140518.sql3
[INFO] Connecting to localhost:8080/remote_api
[INFO] Starting import; maximum 100 entities per post
Password for marknuttallsm...@gmail.com: .[INFO] [WorkerThread-0] 
Backing off due to errors: 1.0 seconds
.[INFO] Resetting backoff to 0.0
..[ERROR
   
] [WorkerThread-2] WorkerThread:
Traceback (most recent call last):
  File 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/adaptive_thread_pool.py",
 
line 176, in WorkOnItems
status, instruction = item.PerformWork(self.__thread_pool)
  File 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/bulkloader.py",
 
line 764, in PerformWork
transfer_time = self._TransferItem(thread_pool)
  File 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/bulkloader.py",
 
line 935, in _TransferItem
self.request_manager.PostEntities(self.content)
  File 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/bulkloader.py",
 
line 1418, in PostEntities
datastore.Put(entities)
  File 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/datastore.py",
 
line 467, in Put
return PutAsync(entities, **kwargs).get_result()
  File 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py",
 
line 658, in get_result
results = self.__rpcs[0].get_result()
  File 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/apiproxy_stub_map.py",
 
line 592, in get_result
return self.__get_result_hook(self)
  File 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py",
 
line 1385, in __put_hook
self.check_rpc_success(rpc)
  File 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/datastore/datastore_rpc.py",
 
line 1072, in check_rpc_success
rpc.check_success()
  File 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/apiproxy_stub_map.py",
 
line 558, in check_success
self.__rpc.CheckSuccess()
  File 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/apiproxy_rpc.py",
 
line 156, in _WaitImpl
self.request, self.response)
  File 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py",
 
line 249, in MakeSyncCall
handler(request, response)
  File 
"/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py",
 
line 387, in _Dynamic_Put
'datastore_v3', 'Put', put_request, put_response

[appengine-java] Re: Python bulk loader tool with local dev server of GAE Java

2011-07-13 Thread mark-ns
Hi, 

If anyone is still suffering this problem, I've found that running a http 
proxy such as Charles will correct it. That said, I do not know what the 
underlying cause is.

Mark

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine-java/-/54TMHuS1jKUJ.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Integrating Flex/Flash/Silverlight/AJAX/Android with Java classes in GAE

2011-04-05 Thread Mark Piller
Hey guys,

I am not sure what the policy for announcements is on this forum, but I hope 
many of you will find it relevant. I just wanted to let you know that we 
released a version of our software which provides runtime integration 
between various client types and Java classes hosted in GAE. The supported 
client types include Flex, Flash, Silverlight, JavaScript/AJAX, Android, 
Windows Phone and in the very near future iOS. The product enabling the 
integration is called WebORB. It can be plugged into any GAE app. There is a 
video describing the integration at:
http://www.youtube.com/watch?v=NSx9oRj5v50

The doc describing the integration is available 
at: http://www.themidnightcoders.com/fileadmin/docs/java/v4/gae_overview.htm

Cheers,
Mark

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



[appengine-java] jetty java.lang.IllegalStateException: STREAM

2011-03-16 Thread Mark Harrison
Hi, can you explain why jetty is returning a 
java.lang.IllegalStateException: STREAM? 

Is this a known issue? 
Is there something wrong with my code that is causing the issue? 
Does this happen on other implementations of Jetty 

I am using the Java Environment with Google App Engine 1.4.2 with JRE 1.7 
(x64) for Mac OSX. No exception is caught from try..catch block. The 
exception seems to occur after the page has finished execution. I am calling 
the JSP page directly (i.e. entering name into browser window). 

Note: I cannot see this exception on GAE server it only happens when running 
the local jetty on my Dev Machine.


JSP 
== 

 
 
<% 
try 
{ 
response.sendError(401,"This will generate IllegalStateException"); 
// response.setStatus(401); 
} 
catch (Exception e) 
{ 
%> 
Caught exception with response.sendError(401) 
<% 
} 

%> 
 
 

EXCEPTION 
== 

Mar 16, 2011 12:19:32 PM com.google.apphosting.utils.jetty.JettyLogger warn 
WARNING: /Test.jsp 
java.lang.IllegalStateException: STREAM 
at org.mortbay.jetty.Response.getWriter(Response.java:616) 
at 
javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:112) 
at 
org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:125) 
at 
org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:118) 
at 
org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:188) 
at 
org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:118)
 
at 
org.apache.jasper.runtime.JspFactoryImpl.access$100(JspFactoryImpl.java:40) 
at 
org.apache.jasper.runtime.JspFactoryImpl$PrivilegedReleasePageContext.run(JspFactoryImpl.java:166)
 
at java.security.AccessController.doPrivileged(Native Method) 
at 
org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
 
at org.apache.jsp.Test_jsp._jspService(Test_jsp.java:83) 
at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377) 
at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) 
at 
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) 
at 
com.google.appengine.tools.development.PrivilegedJspServlet.access$101(PrivilegedJspServlet.java:23)
 
at 
com.google.appengine.tools.development.PrivilegedJspServlet$2.run(PrivilegedJspServlet.java:59)
 
at java.security.AccessController.doPrivileged(Native Method) 
at 
com.google.appengine.tools.development.PrivilegedJspServlet.service(PrivilegedJspServlet.java:57)
 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 
at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) 
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
 
at 
com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58)
 
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
 
at 
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
 
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
 
at 
com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
 
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
 
at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) 
at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) 
at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) 
at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) 
at 
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) 
at 
com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
 
at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
at 
com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:351)
 
at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
at org.mortbay.jetty.Server.handle(Server.java:326) 
at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) 
at 
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
 
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547) 
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) 
at

[appengine-java] Re: how would I setup ssl in eclipse dev http server

2011-03-06 Thread Mark
My app will require secure https connections and I would like to ensure the 
code that detects if the application is connected via a secure connection is 
always in place.  

I am thinking things are not going to be as straight forward if Google is 
using an embedded jetty server.  I haven't found where jetty exists to edit 
configuration files.  I have looked into setting up Jetty although I was 
derailed when I could not find a "jetty" folder.

My other options are to have code that detects if it is the development 
environment assume secure connection.  Although I would have to ensure that 
code is fully tested when deployed at the server.  I am not a fan of this to 
have code not tested until it is deployed into a production environment.

I'll keep researching to see if I can figure this out.  I am hoping another 
developer might have some tips for me.

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



[appengine-java] how would I setup ssl in eclipse dev http server

2011-03-05 Thread Mark
Hi,

How would I setup SSL for the Eclipse app engine dev http server? 

-Mark

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



[appengine-java] Cascading delete for entity groups - should it be working?

2011-01-14 Thread Mark
Hi,

I have a class "Message" which is part of a parent entity group class
"Conversation". When I delete a Conversation, shouldn't all Message
instances in the same entity group also be deleted?:

Conversation conversation = pm.getObjectById(...);
pm.deletePersistent(conversation);
// now all child Message instances should be deleted too?


I'm not seeing this behavior, the messages still exist, so I'm
probably doing something wrong:


@PersistenceCapable
public class Message
{
  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  @Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
  private String key;

  @Persistent
  @Extension(vendorName="datanucleus", key="gae.parent-pk",
value="true")
  private String parentKey;
}

I can see all my Message instances have the same parentKey value as
that of their parent Conversation instance. Is there something else I
need to do to get the cascading deletes working?

Thanks

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



[appengine-java] Can't update int[] array in a class?

2010-11-12 Thread Mark
Hi,

I'm having trouble updating a class which has an array of ints:

  @PersistenceCapable
  class Foo {
  @Persistent
  @Extension(vendorName = "datanucleus", key = "gae.unindexed",
value="true")
  int[] vals;
   }

  ...

  Foo foo = new Foo();
  foo.vals = new int[] { 1, 2, 3 };
  pm.makePersistent(foo);

The first time an instance is created, the values are all there ok. If
I try updating them though, the changes never persist:

  public void updateFoo(PersistenceManagerFactory pmf) {
  PersistenceManager pm = pmf.getPersistenceManager();
  Foo foo = pm.getObjectById(Foo.class, myKey);
  foo.vals[0] = 100;
  pm.makePersistent(foo);
  }

I print the values out directly after the call on the foo object
instance, and the update seems to have worked in memory. However, the
next time I call updateFoo(), the values are once again starting at
{ 1, 2, 3 }, and not { 100, 2, 3 } as I'm expecting. What am I doing
wrong?

Thanks

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



[appengine-java] Re: Are Text properties still not lazy loaded?

2010-11-11 Thread Mark
Thanks Ikai. I have an entity that has a bunch of Text properties,
they can each be quite large. I wanted to avoid loading them if
they're not going to be used for a specific query. For example, I have
a list of GameRoom objects:

class GameRoom {
   String gamename;
   String mapname;

   Text bigChunkOfJson1;
   Text bigChunkOfJson2;
   Text bigChunkOfJson3;
}

If a user wants to get a listing of games my service is hosting, it's
probably not wise for me to deserialize each "bigChunkOfJson" property
to give them a simple game listing. Only if they join a game do I need
to touch those Text properties. I read the Relationships page again
and it seems that child objects are lazy loaded:

"Child objects are loaded from the datastore when they are accessed
for the first time. If you do not access the child object on a parent
object, the entity for the child object is never loaded. If you want
to load the child, you can either "touch" it before closing the
PersistenceManager (e.g. by calling getContactInfo() in the above
example) or explicitly add the child field to the default fetch group
so it's retrieved and loaded with the parent"

So I figure I could split my class up like:

class Game {
String gamename;
String mapname;

MoreInfo more;
 }

So if I query for Game instances, so long as I don't access the
MoreInfo object, that data won't be fetched (if I understand
correctly). Then I can put all my Text objects in that class,

Thanks

http://code.google.com/appengine/docs/java/datastore/relationships.html



On Nov 11, 3:56 pm, "Ikai Lan (Google)" 
wrote:
> Text properties were never actually lazy loaded. We only lazy loaded them to
> match the JDO/JPA spec. In practice, the entire entity was being read and we
> just weren't populating the entity.
>
> Try running AppStats - though I suspect the deserialization shouldn't be
> *that* slow.
>
> --
> 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 Thu, Nov 11, 2010 at 8:38 AM, Mark  wrote:
> > Hi,
>
> > Is a Text property lazy loaded when I query for an instance of that
> > class? It seems to not be lazy loaded as of 2008, wondering if that's
> > still the case?:
>
> >http://groups.google.com/group/google-appengine/browse_thread/thread/...
>
> > I ask because I'm wondering if a query for a class is spending time
> > deserializing my large Text properties, or waiting until I actually
> > access them (if ever) after the query is already performed,
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to
> > google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine-java+unsubscr...@googlegroups.com > unsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.

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



[appengine-java] Are Text properties still not lazy loaded?

2010-11-11 Thread Mark
Hi,

Is a Text property lazy loaded when I query for an instance of that
class? It seems to not be lazy loaded as of 2008, wondering if that's
still the case?:

http://groups.google.com/group/google-appengine/browse_thread/thread/81ac0c2bba6e37c8/291625c1099711b0?lnk=gst&q=text+lazy#291625c1099711b0

I ask because I'm wondering if a query for a class is spending time
deserializing my large Text properties, or waiting until I actually
access them (if ever) after the query is already performed,

Thanks

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



[appengine-java] org.datanucleus.store.appengine.query.RuntimeExceptionWrappingIterator.hasNext(RuntimeExceptionWrappingIterator.java:44)

2010-11-01 Thread mark chen
Hi,

I am using JDO on GAE, and have been encountering this error. I
googled the error, and most of the solutions were related to setting
some properties in datastore-indexes.xml. However, I do not have this
config file in my app as GAE has enables the Automatic index
configuration. The piece of code which is giving me the error has been
indicated, with the corresponding error message pasted below. Would
appreciate any help. Thanks

BidDAO.java
//return a list of bids for a particular section
public static List read(String courseCode, String sectionCode) {
PersistenceManager pm = PMF.get().getPersistenceManager();
String query = "select from " + Bid.class.getName()
+ " where courseCode == courseCodeParam && sectionCode
== sectionCodeParam"
+ " parameters String courseCodeParam, String
sectionCodeParam order by amount desc";
List bids = (List)
pm.newQuery(query).execute(courseCode, sectionCode);

 ERROR--->   List detachedBids = (List)
pm.detachCopyAll(bids);

pm.close();
if (detachedBids.size() == 0) {
return null;
}
return detachedBids;
}

Uncaught exception from servlet
com.google.appengine.api.datastore.DatastoreNeedIndexException: no
matching index found..  






at com.google.appengine.runtime.Request.process-
f520ab98e5ed5cc2(Request.java)
at
com.google.appengine.api.datastore.DatastoreApiHelper.translateError(DatastoreApiHelper.java:
42)
at com.google.appengine.api.datastore.DatastoreApiHelper
$1.convertException(DatastoreApiHelper.java:98)
at
com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:
44)
at
com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:
42)
at
com.google.appengine.api.datastore.FutureHelper.getInternal(FutureHelper.java:
71)
at
com.google.appengine.api.datastore.FutureHelper.quietGet(FutureHelper.java:
32)
at
com.google.appengine.api.datastore.QueryResultsSourceImpl.loadMoreEntities(QueryResultsSourceImpl.java:
69)
at
com.google.appengine.api.datastore.QueryResultsSourceImpl.loadMoreEntities(QueryResultsSourceImpl.java:
56)
at
com.google.appengine.api.datastore.QueryResultIteratorImpl.ensureLoaded(QueryResultIteratorImpl.java:
156)
at
com.google.appengine.api.datastore.QueryResultIteratorImpl.hasNext(QueryResultIteratorImpl.java:
65)
at
org.datanucleus.store.appengine.query.RuntimeExceptionWrappingIterator.hasNext(RuntimeExceptionWrappingIterator.java:
44)
at
org.datanucleus.store.appengine.query.LazyResult.listIterator(LazyResult.java:
102)
at
org.datanucleus.store.appengine.query.StreamingQueryResult.iterator(StreamingQueryResult.java:
114)
at
org.datanucleus.jdo.JDOPersistenceManager.detachCopyAll(JDOPersistenceManager.java:
1174)
--->>   at com.bios.DAO.BidDAO.read(BidDAO.java:46)
at
com.bios.controller.AddBidServlet.validateBidStatus(AddBidServlet.java:
687)
at org.apache.jsp.mainMenu_jsp._jspService(mainMenu_jsp.java:119)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
511)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1166)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
388)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
182)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
418)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
542)
at org.mortbay.jetty.HttpConnection
$RequestHandler.headerComplete(HttpConnection.java:923)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at
com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest(BlockingApplicationHandler.java:
24)
at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:
418)
at com.google.net.rpc.impl.Server$RpcTask.runInContext(Server.java:
572)
at com.google.tracing.TraceContext$TraceContextRunnable
$1.run(TraceContext.java:448)
at com.google.tracing.TraceContext.runInCo

Re: [appengine-java] Get objects back in the order they were inserted into the data store?

2010-07-21 Thread Mark Wyszomierski
Hi Ikai,

Sorry to bug you, I didn't quite follow - reworded here:

I *do* need an index on the timestamp field because I want a desc filter.
This ordering may not exactly be the insertion order, but pretty close. If I
wanted to present the objects by real insertion order, I'd need an
additional index.

Did I follow right? Yeah I don't care about insertion order really, just
about the timestamp desc ordering - I figured timestamp desc and insertion
order (in my case) would produce nearly identical results, so was just going
to try springing on the timestamp index. Seems that I should definitely
index on it though,

Thanks,
Mark


On Wed, Jul 21, 2010 at 7:37 PM, Ikai L (Google)  wrote:

> You'll need an index no matter what, as if you did this, you'd need Key
> descending. Note that this may not be exact insert order but it'll be pretty
> close. This seems to save an index, though, as doing it another way requires
> both ascending and descending indexes.
>
> On Wed, Jul 21, 2010 at 5:52 AM, Mark  wrote:
>
>> Hi,
>>
>> I'm creating records of a user's actions. When I fetch these records,
>> I only ever want them sorted in reverse chronological ordering (the
>> order they were inserted into the datastore). Does app engine by
>> default return records in this order? I'm trying to avoid having to
>> keep an extra index on timestamp to reduce the number of indexes I
>> use. Example (in java):
>>
>>class Action {
>>@PrimaryKey
>>@Extension(vendorName="datanucleus", key="gae.encoded-pk",
>> value="true")
>>private String usernameOwner;
>>
>>@Persistent
>>long timestamp;
>>}
>>
>>public void userActionPerformed(PersistenceManager pm) {
>>pm.makePersistent(new Foo("myusername",
>> System.currentTimeMillis());
>>}
>>
>>public void getRecords(String username) {
>>String stmt = "SELECT FROM " + Action.class.getName() + "
>> WHERE usernameOwner = '" + username + "'";
>>Query q = pm.newQuery(stmt);
>>q.setOrdering("timestamp desc"); // want to avoid this.
>>
>>return (List)q.execute();
>>}
>>
>>// desired html: //
>>You performed a foo action on July 21 at 4:22pm!
>>You performed a boo action on July 21 at 3:21pm!
>>You performed a goo action on July 19 at 9:42pm!
>>...
>>
>> so, it would be great if I don't have to index on the timestamp - just
>> get the records back in the order I inserted them - possible?
>>
>> Thanks
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine for Java" group.
>> To post to this group, send email to
>> google-appengine-j...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine-java+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine-java?hl=en.
>>
>>
>
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> Blog: http://googleappengine.blogspot.com
> Twitter: http://twitter.com/app_engine
> Reddit: http://www.reddit.com/r/appengine
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>

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



Re: [appengine-java] Re: Tag clouds on GAE for Java - how to store and how to aggregate

2010-07-21 Thread Mark Wyszomierski
Cool, if you structure your entity class like this though:

class Entity {
 List tags;
 String foo;
 }

how are you going to query which Entity instances match a given tag? I think
that all the tags need to be indexed so your query statement can find them -
I'm not 100% sure on this, if you can somehow match on that List,
that would be new to me! I was thinking you might have to decide how many
tags an Entity can have, and explicitly declare each like:

class Entity {
 String tag1, tag2, tag3;
 String foo;
 }

only the first tag is required, the other two can be null. Then your query
statement would have to be something like:

select from Entity where tag1 == 'cow' || tag2 == 'cow' || tag3 ==
'cow';

not sure if there's a better way to do it, let us know what you try because
this is probably a pattern that can be reused for others wanting to do the
same thing,

Thanks,
Mark


On Wed, Jul 21, 2010 at 3:15 PM, planetjones  wrote:

> Mark,
>
> Thanks very much for this - it's useful.  I'm slowly getting used to
> this non-relational way of thinking.
>
> The count of the tags doesn't need to be 100% accurate, as it will
> only be used to approximate how many entries exist for a given tag -
> the tag cloud aim is to show tags associated with many entities in a
> larger font and tags associated with fewer entities in a smaller
> font.  If the insert, update or delete of Entity succeeds and gets
> committed, but the persistence action against the TagCounter fails in
> a few instances that would not be a big deal.
>
> I'll probably allow three tags per Entity, so was planning on:
>
>  class Entity {
>  List tags;
>  String foo;
>  }
>
> for flexibility in of the number of tags.
>
> So when inserting a new entity I would need to:
>
> Create Entity
> For each tag in Entity select TagCounter
> If tag counter exists for tag increment count by 1
> If tag counter does not exist for tag create TagCounter with count of
> 1
>
> When deleting an entity I would need to:
>
> For each tag in Entity select TagCounter
> Decrease count by 1 of TagCounter
> Delete Entity
>
> This sounds ok to me.  When a user clicks a tag the query is simple
> too.
>
> I'll give this a try and see how it looks.
>
> Thanks again.
>
> On Jul 21, 12:46 pm, Mark  wrote:
> > I probably have a naive understanding of what you're doing, maybe
> > explain a little more, but to me it looks like this:
> >
> > class TagCounter {
> > int count;
> > String label; // primary key, unique tag name.
> > }
> >
> > class Entity {
> > String tag;
> > String foo;
> > }
> >
> > whenever the user creates a new entity, record its tag(s), then
> > increment the appropriate TagCounter instance. Keeping counters like
> > this introduces a bottleneck and goes against what you want to be
> > doing for a highly scalable web service, so you may want to shard them
> > (imagine you have thousands of users all trying to increment a single
> > tag counter at once).   Since the above two classes won't be in the
> > same entity group, you wouldn't be able to perform both operations in
> > a single transaction. You can either accept the fact that your tag
> > count may be out of sync with the actual number of entities with that
> > tag, or you can have a multistep process and clean up dangling tag
> > counts with a task (eventual consistency might be the term here). I'm
> > referring to Nick Johnson's article on distributed transactions which
> > I think you can modify to do what you're looking for:
> >
> >http://blog.notdot.net/2009/9/Distributed-Transactions-on-App-Engine
> >
> > I'm still learning app engine so take the above with a big grain of
> > salt. To me, it seems that if you want to write a highly scalable web
> > service, you need to accept that you may lose some data precision, or
> > you have to put in additional work to get what you want (compared to
> > assuming a single mysql instance etc).
> >
> > Anyway, after you implement something like the above, your original
> > two queries should be easy to do. You probably want to define how many
> > tags an Entity can have. If an Entity can have more than one tag, I'd
> > explicitly state what that max is. Write out everything you need when
> > the user submits an entity, so that your reads will be fast as other
> > users browse the site.
> >
> > Mark
> >
> > On Jul 19, 9:16 am, planetjones  wrote:
> 

[appengine-java] Get objects back in the order they were inserted into the data store?

2010-07-21 Thread Mark
Hi,

I'm creating records of a user's actions. When I fetch these records,
I only ever want them sorted in reverse chronological ordering (the
order they were inserted into the datastore). Does app engine by
default return records in this order? I'm trying to avoid having to
keep an extra index on timestamp to reduce the number of indexes I
use. Example (in java):

class Action {
@PrimaryKey
@Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
private String usernameOwner;

@Persistent
long timestamp;
}

public void userActionPerformed(PersistenceManager pm) {
pm.makePersistent(new Foo("myusername",
System.currentTimeMillis());
}

public void getRecords(String username) {
String stmt = "SELECT FROM " + Action.class.getName() + "
WHERE usernameOwner = '" + username + "'";
Query q = pm.newQuery(stmt);
q.setOrdering("timestamp desc"); // want to avoid this.

return (List)q.execute();
}

// desired html: //
You performed a foo action on July 21 at 4:22pm!
You performed a boo action on July 21 at 3:21pm!
You performed a goo action on July 19 at 9:42pm!
...

so, it would be great if I don't have to index on the timestamp - just
get the records back in the order I inserted them - possible?

Thanks

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



[appengine-java] Re: Tag clouds on GAE for Java - how to store and how to aggregate

2010-07-21 Thread Mark
I probably have a naive understanding of what you're doing, maybe
explain a little more, but to me it looks like this:

class TagCounter {
int count;
String label; // primary key, unique tag name.
}

class Entity {
String tag;
String foo;
}

whenever the user creates a new entity, record its tag(s), then
increment the appropriate TagCounter instance. Keeping counters like
this introduces a bottleneck and goes against what you want to be
doing for a highly scalable web service, so you may want to shard them
(imagine you have thousands of users all trying to increment a single
tag counter at once).   Since the above two classes won't be in the
same entity group, you wouldn't be able to perform both operations in
a single transaction. You can either accept the fact that your tag
count may be out of sync with the actual number of entities with that
tag, or you can have a multistep process and clean up dangling tag
counts with a task (eventual consistency might be the term here). I'm
referring to Nick Johnson's article on distributed transactions which
I think you can modify to do what you're looking for:

http://blog.notdot.net/2009/9/Distributed-Transactions-on-App-Engine

I'm still learning app engine so take the above with a big grain of
salt. To me, it seems that if you want to write a highly scalable web
service, you need to accept that you may lose some data precision, or
you have to put in additional work to get what you want (compared to
assuming a single mysql instance etc).

Anyway, after you implement something like the above, your original
two queries should be easy to do. You probably want to define how many
tags an Entity can have. If an Entity can have more than one tag, I'd
explicitly state what that max is. Write out everything you need when
the user submits an entity, so that your reads will be fast as other
users browse the site.

Mark

On Jul 19, 9:16 am, planetjones  wrote:
> Hi,
> I'm looking to store entities using GAE Java which have 1-many tags.
> I
> would like to display a tag cloud, so will need to know how many
> times
> each tag occurs (can't use aggregate functions and group by on GAE to
> do this like I would in SQL). And when I click a tag I would like to
> retrieve all entities with the selected tag.
> Does anyone have any examples of what my Classes should look like to
> do this optimally and efficiently? Sample JPA code would be great
> too.
> Cheers - Jonathan

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



[appengine-java] Length of member variable names contributes to storage space used?

2010-07-19 Thread Mark
Hi,

I read in a post that the length of member variable names contributes
to the amount of storage space your app uses, example:

class Farm {
private String mFarmersFavoriteCropToPlant;
}

would take more space to store than:

class Farm {
private String m;
}

might not matter for a handful of instances, but if I have thousands
of records... is this true?

Thanks

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



[appengine-java] Getting oauth twitter to work, using dyuproject

2010-07-11 Thread Mark
Hi,

I just found dyuproject by David Yu:

http://dyuproject.appspot.com/oauth
http://code.google.com/p/dyuproject/

which is great, very easy to integrate and get oauth working. The demo
project at appspot shows twitter working, but I cannot find the
corresponding source code in the repository:

 
http://code.google.com/p/dyuproject/source/browse/#svn/trunk/modules/demos/oauth-consumer-servlet/src/main/java/com/dyuproject/demos/oauthconsumer

am I not looking in the right place?

Thanks

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



[appengine-java] Re: Upload to Blob Storage from Silverlight 4

2010-07-06 Thread Mark
Hi,

It'd be great if you can share what you did,

Thanks

On May 25, 3:03 pm, Patrick Brown  wrote:
> Hi
>
>    I found a solution to this issue, if there is any interest out
> there I can write something up on what I did.
>
> Thanks,
> Patrick
>
> On May 19, 4:36 pm, Patrick Brown  wrote:
>
>
>
> > Hi
>
> >    I just noticed something interesting - on the dev server if I can
> > see my __BlobUploadSessions__ created prior to forwarding my call on
> > to have the blobs created, if I skip that forward the sessions stay as
> > I would expect, if I do the same on the AppEngine I don't see the
> > __BlobUploadSessions__, it appears that they are not being created
> > successfully and that is maybe what is "Not found"
>
> > Thank you,
> > Patrick
>
> > On May 19, 3:58 pm, Patrick Brown  wrote:
>
> > > Hi
>
> > >    Sorry to reply to my own message but I am a bit stuck for now, has
> > > anyone done anything similar or have any pointers on where I should
> > > research?
>
> > > Thanks,
> > > Patrick
>
> > > On May 17, 2:13 pm, Patrick Brown  wrote:
>
> > > > Hello
>
> > > >    I have a silverlight application hosted in my Index.html page that
> > > > I am able to upload blobs through to the DevAppServer.  Last week I
> > > > enabled billing in my application, when I attempt in production I
> > > > receive a "Not Found" exception after post but prior to my success
> > > > handler being called.  To make this work I am creating a multipart
> > > > form in silverlight and posting to an "attach" servlet ( shown here ),
> > > > I see all the log messages but my upload handler is not hit running
> > > > under the AppEngine.  Any ideas where I am going wrong or is there a
> > > > better approach?
>
> > > >   I should say, I am very new to all of the technologies I am using
> > > > here so I am sorry if my description is a bit rough.
>
> > > > Thank you for your time and ideas.
> > > > Patrick
>
> > > > public void doPost(HttpServletRequest req, HttpServletResponse resp)
> > > > throws IOException
> > > > {
> > > >   log.info("Post attachment started");
> > > >   BlobstoreService blobstoreService =
> > > > BlobstoreServiceFactory.getBlobstoreService();
> > > >   String uploadUrl = blobstoreService.createUploadUrl("/upload");
>
> > > >   log.info("Upload URL created");
> > > >   RequestDispatcher dispatcher =
> > > > req.getRequestDispatcher(uploadUrl);
> > > >   log.info(String.format("dispatcher for %s retrieved", uploadUrl));
>
> > > >   try {
> > > >      log.info("forwarding");
> > > >      dispatcher.forward(req, resp);
> > > >      log.info("forwarded");
> > > >   } catch (ServletException e) {
> > > >      e.printStackTrace();
> > > >      log.info(e.getMessage());
> > > >   }
>
> > > > }
>
> > > > --
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "Google App Engine for Java" group.
> > > > To post to this group, send email to 
> > > > google-appengine-j...@googlegroups.com.
> > > > To unsubscribe from this group, send email to 
> > > > google-appengine-java+unsubscr...@googlegroups.com.
> > > > For more options, visit this group 
> > > > athttp://groups.google.com/group/google-appengine-java?hl=en.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Google App Engine for Java" group.
> > > To post to this group, send email to 
> > > google-appengine-j...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > google-appengine-java+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/google-appengine-java?hl=en.-Hidequoted 
> > > text -
>
> > > - Show quoted text -
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Google App Engine for Java" group.
> > To post to this group, send email to google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > google-appengine-java+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/google-appengine-java?hl=en.-Hide quoted 
> > text -
>
> > - Show quoted text -

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



[appengine-java] Getting images from the blobstore - going to be slow?

2010-07-06 Thread Mark
Hi,

I'd like to serve user avatar pics. I can store them in blobstore. I
think I can modify the blobstore example to make it work like this:

// sevlet which serves my images:
public class Serve extends HttpServlet {
private BlobstoreService blobstoreService =
BlobstoreServiceFactory.getBlobstoreService();

public void doGet(HttpServletRequest req, HttpServletResponse
res)
  throws IOException {
BlobKey blobKey = new BlobKey(req.getParameter("img_id"));
blobstoreService.serve(blobKey, res);
}
}

// user jsp page:

  


this is all we really need, right? In my example, I can locate a
user's avatar image blob by using their unique username.

Is this a lot slower than just hosting the avatar on a static url like
on a php server for example?:



I'm worried that every time a user's avatar is served, the
BlobstoreServiceFactory.getBlobstoreService() method needs to be
called and then a fetch from the datastore must be done - if I have a
few dozen such images to locate on a single page, am I going to be in
trouble?

Thanks

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



[appengine-java] Key command to restart dev server in eclipse?

2010-06-24 Thread Mark
Hi,

I'm using eclipse for development. Is there a way we can bind
restarting the dev server to a key command? I find it takes a bit of
time to restart manually, especially when using a laptop trackpad!

Thanks

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



[appengine-java] Using the prepackaged json classes in com.google.appengine.repackaged.org.json?

2010-06-17 Thread Mark
Hi,

I'm using the 1.3.4 version of app engine. I noticed that now we have:

 com.google.appengine.repackaged.org.json.*

available. I can use the json classes and compilation is fine, but at
runtime loading of the json classes fails, I think:

 java.lang.UnsupportedClassVersionError: Bad version number
in .class file

not sure what's causing this, is it possible that the repackaged
classes were compiled using a different jdk version than what I'm
using? I'm using java compatibility = 1.5. I can just include the json
files from json.org myself, but would be more convenient to use the
ones already provided,

Thanks

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



[appengine-java] Re: Performance issue for GAE auto-restart

2010-06-15 Thread Mark
My naive understanding of the problem is that it takes a long time to
initialize the jdo/jpa bridge over the datastore. I haven't had a
chance to try out slim3, but Thomas was stating that the startup time
for instances using slim3 is 1 to 3 seconds (I think). I believe this
is because slim3 is a thin wrapper around the native datastore
interface.

I would also really like to see the out-of-the-box implementation have
a faster startup though.

On Jun 15, 8:27 am, Rahul  wrote:
> Jake,
>
> Thanks for giving me a heads up about this.
> I have read that post in past but is there any official documentation
> other then group posts which mentions something for this. I know we
> can reduce the app start to 3-4 seconds but even that is something
> which is not acceptable in various scenarios.
>
> Is there anything we can do to bring this issue on the top burner so
> we can use our appengine apps for production purpose other then just
> playing around with the stuff.
>
> Thanks,
> Rahul
>
> On Jun 14, 1:10 pm, Jake  wrote:
>
>
>
> > Hey Rahul,
>
> > Seehttp://groups.google.com/group/google-appengine-java/browse_thread/th...
> > for an official discussion of this issue.  The first post talks about
> > "discouraged" workarounds, but doesn't cite the 60-second ping
> > specifically.  This was the result, though, of a string of prior
> > threads that discussed this issue and workaround.  As you can see from
> > the date, this is not a new problem.  Again, I used the 60-second ping
> > for awhile and it really didn't solve the problem - just ensured that
> > the loading requests happened every 60 seconds :)
>
> > As for the framework, good point.  I use Wicket which is pretty
> > powerful.  I've gotten it down to about 3-4 seconds load.  One plugin
> > had a dependency on Spring that I removed.  As discussed 
> > here:http://code.google.com/p/objectify-appengine/wiki/BestPractices#Autom...
> > anything that scans the classpath can be pretty demanding.
>
> > That being said, I'm not currently using my deployed application for
> > demonstrations - I use a development server hosted on our own
> > machines.  My hope is that the restart issue will be resolved someday.
>
> > Jake
>
> > On Jun 11, 11:07 am, Rahul  wrote:
>
> > > Jake,
>
> > > Is there any official comments on this from google which says that it
> > > discourage the pinging every 60 seconds or so.
>
> > > Also if we have some framework which we will always like to have if
> > > doing some production application then what is the way out.
>
> > > Thanks,
> > > Rahul
>
> > > On Jun 11, 10:16 am, Jake  wrote:
>
> > > > Hi Mark,
>
> > > > Yes, you can do better than 4.5 seconds without a framework.  Also,
> > > > there are layers that can be placed over the low level datastore (e.g
> > > > Objectify) that add ease-of-use without noticeable additions to the
> > > > startup time.
>
> > > > The 60 second pinging thing is, indeed, done by some users and is
> > > > officially discouraged by Google.  At one point, I set up a similar
> > > > pinging feature and found that it really didn't work.  Theoretically
> > > > it should, but the pings just caused loading requests every minute or
> > > > so, which simply reduced the likelihood that a user would see the
> > > > loading request; it didn't solve the problem.
>
> > > > Jake
>
> > > > On Jun 11, 7:32 am, Mark  wrote:
>
> > > > > Hi, just joining in, trying to sum up:
>
> > > > > In the best case (if we only use the low level datastore + no
> > > > > frameworks on top) we can only hope that a fresh restart of our app
> > > > > will take 4.5 seconds?
>
> > > > > However if at least one user is hitting the site every 60 seconds from
> > > > > somewhere in the world, then our app should be kept alive and no need
> > > > > for restarts?
>
> > > > > Not that I'm planning on doing it, but what prevents developers from
> > > > > simply pinging the site every 60 seconds to force the app to stay in
> > > > > memory? I ask what prevents it because if I play by the rules, I'm
> > > > > going to get penalized if other developers are 'cheating' and doing
> > > > > the artificial pinging,
>
> > > > > Thanks
>
> > > > > On Jun 9, 5:49 am, Jake  wrote:
>
> > > > > > Hey Tin,
>
&g

Re: [appengine-java] Re: Performance issue for GAE auto-restart

2010-06-11 Thread Mark Wyszomierski
Hmm ok I see, so I'm just using JDO without any frameworks on top of that,
but as mentioned in the slim3 tests, JDO does add overhead (sometimes a
significant amount). I don't plan to be doing any large queries (the slim3
example fetches 10,000 objects which I don't plan on doing at any point),
but what is important to me is that startup time. One to two seconds is
fine, four seconds starts pushing it, anything above that is pretty bad.

If we start using slim3 though, we lose the flexibility in moving to another
host (not that I know of any that can compare to app engine) since it'll be
interacting directly with big table instead of using jdo or jpa is an
intermediate?

Thanks

On Fri, Jun 11, 2010 at 8:07 AM, Rahul  wrote:

> Jake,
>
> Is there any official comments on this from google which says that it
> discourage the pinging every 60 seconds or so.
>
> Also if we have some framework which we will always like to have if
> doing some production application then what is the way out.
>
> Thanks,
> Rahul
>
> On Jun 11, 10:16 am, Jake  wrote:
> > Hi Mark,
> >
> > Yes, you can do better than 4.5 seconds without a framework.  Also,
> > there are layers that can be placed over the low level datastore (e.g
> > Objectify) that add ease-of-use without noticeable additions to the
> > startup time.
> >
> > The 60 second pinging thing is, indeed, done by some users and is
> > officially discouraged by Google.  At one point, I set up a similar
> > pinging feature and found that it really didn't work.  Theoretically
> > it should, but the pings just caused loading requests every minute or
> > so, which simply reduced the likelihood that a user would see the
> > loading request; it didn't solve the problem.
> >
> > Jake
> >
> > On Jun 11, 7:32 am, Mark  wrote:
> >
> >
> >
> > > Hi, just joining in, trying to sum up:
> >
> > > In the best case (if we only use the low level datastore + no
> > > frameworks on top) we can only hope that a fresh restart of our app
> > > will take 4.5 seconds?
> >
> > > However if at least one user is hitting the site every 60 seconds from
> > > somewhere in the world, then our app should be kept alive and no need
> > > for restarts?
> >
> > > Not that I'm planning on doing it, but what prevents developers from
> > > simply pinging the site every 60 seconds to force the app to stay in
> > > memory? I ask what prevents it because if I play by the rules, I'm
> > > going to get penalized if other developers are 'cheating' and doing
> > > the artificial pinging,
> >
> > > Thanks
> >
> > > On Jun 9, 5:49 am, Jake  wrote:
> >
> > > > Hey Tin,
> >
> > > > Several people were using GAE's built in timing mechanism to ping the
> > > > server to accomplish the same thing.  Google came out and officially
> > > > discouraged this as it tends to throw off any attempts they are
> > > > currently making to fix the problem.  I can't tell people what to do,
> > > > but I opted to stop using this hack in the hopes that they will solve
> > > > the problem.
> >
> > > > Besides, you'll notice that this hack doesn't really work over the
> > > > long run.  It will essentially restart your server every minute and
> > > > won't really prevent the loading request from falling on your users
> > > > instead of on your ping.
> >
> > > > Jake
> >
> > > > On Jun 8, 1:54 pm, Tin  wrote:
> >
> > > > > Hi all:
> >
> > > > > We have found a temporary solution for this issue:
> > > > > Try with an AJAX timer kicking the server (doing nothing), maybe
> one
> > > > > request per minute (or less) and GAE will keep our site / users in
> the
> > > > > same node.
> > > > > In our testing it could avoid the GAE web instance reloaded, but if
> > > > > the request interval is long, it would cause another Datastore
> > > > > performance issue:http://goo.gl/98zkthatwillbefixed in near
> > > > > future.
> >
> > > > > More info please refer to here:http://goo.gl/mzQR
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

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



[appengine-java] Re: Performance issue for GAE auto-restart

2010-06-11 Thread Mark
Hi, just joining in, trying to sum up:

In the best case (if we only use the low level datastore + no
frameworks on top) we can only hope that a fresh restart of our app
will take 4.5 seconds?

However if at least one user is hitting the site every 60 seconds from
somewhere in the world, then our app should be kept alive and no need
for restarts?

Not that I'm planning on doing it, but what prevents developers from
simply pinging the site every 60 seconds to force the app to stay in
memory? I ask what prevents it because if I play by the rules, I'm
going to get penalized if other developers are 'cheating' and doing
the artificial pinging,

Thanks

On Jun 9, 5:49 am, Jake  wrote:
> Hey Tin,
>
> Several people were using GAE's built in timing mechanism to ping the
> server to accomplish the same thing.  Google came out and officially
> discouraged this as it tends to throw off any attempts they are
> currently making to fix the problem.  I can't tell people what to do,
> but I opted to stop using this hack in the hopes that they will solve
> the problem.
>
> Besides, you'll notice that this hack doesn't really work over the
> long run.  It will essentially restart your server every minute and
> won't really prevent the loading request from falling on your users
> instead of on your ping.
>
> Jake
>
> On Jun 8, 1:54 pm, Tin  wrote:
>
>
>
> > Hi all:
>
> > We have found a temporary solution for this issue:
> > Try with an AJAX timer kicking the server (doing nothing), maybe one
> > request per minute (or less) and GAE will keep our site / users in the
> > same node.
> > In our testing it could avoid the GAE web instance reloaded, but if
> > the request interval is long, it would cause another Datastore
> > performance issue:http://goo.gl/98zkthatwill be fixed in near
> > future.
>
> > More info please refer to here:http://goo.gl/mzQR

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



[appengine-java] Re: How to use OpenID on the GAE (with the GWT frontend)

2010-05-15 Thread Mark Renouf
The button displays an alert, but does not redirect. Copying the URL
from the alert dialog and manually visiting it does work, and I'm
logged into your app via my Yahoo account.

Can you share your example code for this project?

On May 15, 6:29 am, Drasko  wrote:
> And just as I managed to make it working, the new release 1.3.4 got
> released and really got me totally scared as no more federated methods
> were there. Luckily it was just an API cleanup and now both the
> "Google Account API" and the "(Experimental) Federated Login" are
> using the same User class and the methods to obtain login and logout
> redirects ... COOL ;-)
>
> The extended "Web Application Starter Project" using a widget to
> authenticate users via OpenID is available onhttp://super-easy.appspot.com
>
> On May 14, 12:16 pm, Drasko  wrote:
>
>
>
>
>
> > I am doing a major rewrite of a working website. We have chosen GWT
> > and GAE as the target architecture.
>
> > I would like to complement our propriatory user authentication schema
> > with OpenID. Hence, I was very happy that GAE supports the "federated
> > login". After spending the last 8 hours, I have failed to discover any
> > useful artifacts that would make me understand how to use the User API
> > in the federated mode.
>
> > Additionally, I found out that the guestbook sample gets broken when
> > switching the authentication option from the "Google Account API" to
> > the "Federated Login", causing the login page to be repeatedly called
> > (shortly showing the CheckCookie URL inbetween). I guess this is not a
> > planned behaviour, even thought the method used for obtaining the
> > redirect URL is not forseen for the federated mode (createLoginURL vs
> > createFederatedLoginURL).
>
> > I would appreciate any comments and/or pointers on this topic as I am
> > aiming on producing a set of basic demo applications using the most
> > promising libraries. The findings will be published in the  blog
> > (super-easy.blogspot.com) with the hope that others won't need to
> > waste so much time.
>
> > I read lots of posts reffering to the dyuproject as a viable OpenID
> > library for GAE and will use it as the next candidate.
>
> > Thanks for your help
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Google App Engine for Java" group.
> > To post to this group, send email to google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > google-appengine-java+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/google-appengine-java?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/google-appengine-java?hl=en.

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



[appengine-java] Setting some Cookies?

2010-05-13 Thread Mark
Hi,

I'd like to add a cookie to a client request. I have a jsp page I'm
serving from app engine. Is this correct?:

  // index.jsp:
  <%@ page import="com.me.myproject.server.Util" %>

  Util.addCookie(response);



  // Util.java
  import javax.servlet.http.Cookie;
  import javax.servlet.http.HttpServletResponse;

  public class Util {

  public static void addCookie(HttpServletResponse response) {
  Cookie cookie1 = new Cookie("param1", 123);
  Cookie cookie2 = new Cookie("param2", 456);
  response.addCookie(cookie1);
  response.addCookie(cookie2);
  }
  }

mostly confused about 'response' just being globally available in my
jsp (I think this is just how jsps works) and if it is in fact of type
"HttpServletResponse"? I think then that it's ok to just pass it to my
java file from the jsp page?

Thanks

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



[appengine-java] Re: How to detect GAE is in maintenance?

2010-05-05 Thread Mark
Sorry I don't have an answer, but would also be interested in knowing
how to do this. I will dig around today in the meantime.

On May 4, 3:10 pm, Jerome  wrote:
> I would like my app to inform the visitor we are in maintenance, such
> as it does not let them do operations that will fail when we try to
> write in the Data Store.
>
> Last week, I implemented the code snipped as documented at the bottom
> of this page:http://code.google.com/appengine/docs/java/howto/maintenance.html
>
>         public static boolean isGAEDowntime() {
>                 MemcacheService ms = 
> MemcacheServiceFactory.getMemcacheService();
>                 ms.setErrorHandler(new StrictErrorHandler());
>
>                 try {
>                     ms.put("test", "test");
>                 } catch 
> (com.google.appengine.api.memcache.MemcacheServiceException
> e) {
>                     return true;
>                 }
>                 return false;
>         }
>
> But, during the downtime, this method was still return false.
>
> What is the best option to figure out we are in the downtime period?
>
> Jerome
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/google-appengine-java?hl=en.

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



[appengine-java] An entity group whose parent uses an unencoded String primary key?

2010-05-03 Thread Mark
Hi,

How do we make an entity group with a parent that has an encoded or
raw string for its primary key? The examples in the docs use Key (I
can get those to work). I need something like:

  class User {

  @PrimaryKey
  private String username;
  }

  class FavAnimal {
  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  @Extension(vendorName="datanucleus", key="gae.encoded-pk",
value="true")
  private String key;

  @Persistent
  @Extension(vendorName="datanucleus", key="gae.parent-pk",
value="true")
  private String parentKey;
  }

when I want to create a FavAnimal, I want to do something like:

  FavAnimal fa = new FavAnimal();
  fa.setParentKey(user.getUsername());
  pm.makePersistent(fa); // generate 'key' upon saving.

where the FavAnimal's 'key' value would be left null, and generated by
the datastore. Again, I can get this to work with real Key types, but
I wanted to use Strings instead to try to maintain some portability.
When I try the above example, I'll get an exception thrown on
persisting:

  Attempt was made to set parent to johndoe but this cannot be
converted into a Key

(here I used johndoe as the parent username),

Thanks

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



[appengine-java] Re: How to deal with large collections of objects?

2010-04-27 Thread Mark
Thanks Andrey, that works perfectly. I wasn't understanding the
example in the docs about this:

  http://code.google.com/appengine/docs/java/datastore/transactions.html

section titled "Creating Entities With Entity Groups".

Your example makes it clear,

Thanks

On Apr 27, 6:04 am, ailinykh  wrote:
> define Cow as
>
> class Cow {
> @PrimaryKey
>     @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>     private Key id;
>
>         @Persistent
>     @Extension(vendorName="datanucleus", key="gae.parent-pk",
> value="true")
>     private Key farmKey;
>
> }
>
> If you set farmKey to farm id then both farm and cow will be in the
> same entity group.
>
> this code should work:
>
> tx.begin()
>
> Farm f = getFarm();
> Cow c = new Cow();
> c.setFarmKey(f.getId());
> f.incCowCounter();
> pm.makePersistent(c);  //if you need to know new cow id.
>
> tx.commit();
>
> Andrey
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/google-appengine-java?hl=en.

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



[appengine-java] How to deal with large collections of objects?

2010-04-26 Thread Mark
Hi,

I'm confused as to how to deal with a large number of objects and
transactions. I will use a Farm and Cows to illustrate my confusion:

Option1:
Create an owned relationship:

   class Farm {
   Cows mCows;
   int mNumCows;
   }

   class Cows {
   List mCowList;
   }

   class Cow {
   }

I have a problem understanding how I would add new cows though,
because I can have thousands of cows per farm:

tx.begin();

// Cows not loaded from datastore yet.
Farm farm = "select from datastore where farm.id = farmid";

// What happens here if I have 10k cows? Probably just timeout
here?
Cows cows = farm.getCows();
cows.addCow(new Cow());

// This is safe, we are in a transaction.
farm.mNumCows++;

// Persists the added cow, and count in one shot, great.
pm.makePersistent(farm);

tx.commit();

in the above, I don't know what will happen when my # of cows grows to
a huge amount. There's really no need for me though to keep the cows
as a child of Farm entities, other than to provide support for
transactions. That is option #2:


Option 2:
The two classes are unowned. Now it should be really fast to add new
Cow instances. I can still look up cows by an owner farmId:

class Farm {
int mNumCows;
}

class Cow {
Key mFarmOwnerKey;
}

tx.begin(); // <- illegal!

Farm farm = "select from datastore where farm.id = farmid";

Cow cow = new Cow();
cow.mFarmOwnerKey = farm.getKey();
pm.makePersistent(cow);

farm.mNumCows++;
pm.makePersistent(farm);

tx.commit(); // <- illegal!

so the above would be really easy to do , but now I can't use
transactions to safely increment the # of Cows on a Farm when I add a
new Cow. It would have to be something more like:

tx.begin();
// add cow
tx.end();

tx.begin();
// increment cow count on farm.
tx.end();

so this would happen in two separate transactions. The problem here is
that it's possible for the first transaction to fail, but the first to
work, so the # of cows may go out of sync with what's actually in the
datastore.

After watching some of the google i/o videos it seems like the
recommended practice is to always write to the datastore to do fast
reads later on. So every time I add a cow to the datastore, I want to
be able to write out a bunch of statistics to the owner Farm object so
that reads will be very fast, as this is how most users of my site
will be interacting with these objects (mostly just reading Farms).

I can't figure out a good solution for this pattern, how do we handle
this? I'm probably just still stuck in relational-database thinking,
cannot figure this out,

Thanks

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



Re: [appengine-java] Re: Hosting gwt project at myapp.com, pulling data from api.myapp.com ?

2010-04-17 Thread Mark Wyszomierski
Hi Stephen,

How does app engine know to let them both access the same data store, is it
just that the last portion of the app identifier is the same? For example,
my project is called "orange":

orange.appspot.com

blah.whatever.orange.appspot.com

is it just because "orange" appears before .appspot, that this linking takes
place? We don't have to set anything up in the xml files to support this?

Thanks


On Sat, Apr 17, 2010 at 4:11 PM, Houston startup coder <
stephenh...@gmail.com> wrote:

> Just create a new version of your app and point api.myproject.com to
> that.  For example, if your app is at
>
> some-name.appspot.com
>
> you can create a version called
>
> another-version.latest.some-name.appspot.com
>
> and that other version can be a separate application with a completely
> different codebase (you can even write it in Python with your original
> app being in Java) and both versions of the app will be using the same
> datastore.
>
> See this link...
>
> http://code.google.com/appengine/docs/java/config/appconfig.html#About_appengine_web_xml
>
> ...and this:
>
> http://googleappengine.blogspot.com/2009/06/10-things-you-probably-didnt-know-about.html
>
>
> Have fun!
>
> - Stephen Huey
> http://www.google.com/profiles/stephenhuey
>
>
>
> On Apr 16, 1:43 pm, Mark  wrote:
> > Hi,
> >
> > I have my gwt project hosted on app engine. This is resolving to:
> >
> >  http://www.myproject.com
> >
> > how would I go about serving data from:
> >
> >  http://api.myproject.com
> >
> > from the same datastore? I'd like the gwt project above to be able to
> > pull its data from api.myproject.com,
> >
> > Thanks
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> > To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> > For more options, visit this group athttp://
> groups.google.com/group/google-appengine-java?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

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



[appengine-java] Hosting gwt project at myapp.com, pulling data from api.myapp.com ?

2010-04-16 Thread Mark
Hi,

I have my gwt project hosted on app engine. This is resolving to:

  http://www.myproject.com

how would I go about serving data from:

  http://api.myproject.com

from the same datastore? I'd like the gwt project above to be able to
pull its data from api.myproject.com,

Thanks

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



[appengine-java] LocalServiceTestHelper is not supported

2010-04-13 Thread Mark
Hi Folks,

I'm stumped and I haven't found any references to a solution for this
one.  I added to my project the example code you'll find here:
http://code.google.com/appengine/docs/java/tools/localunittesting.html

Eclipse is complaining about the reference to LocalServiceTestHelper
with this message:
com.google.appengine.tools.development.testing.LocalServiceTestHelper
is not supported by Google App Engine's Java runtime environment

In addition, the attributes such as "Before", "After", etc. are not
working - the error message is:
org.junit.After is not supported by Google App Engine's Java runtime
environment

Thanks,
Mark

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



[appengine-java] Re: A catch-all servlet?

2010-04-07 Thread Mark
John, thanks so much, this works. I added this as the filter:

  
forwardFilter
com.markww.usermaps.server.ForwardFilter

  target
  UserMaps.jsp

  

  
forwardFilter
/*
  

test is working here:

  http://usermaps.appspot.com/

just forwards all urls like:

  http://usermaps.appspot.com/abc

to my gwt jsp project file. Spent a day trying to get this to work,
thanks again,

Mark




On Apr 6, 11:09 pm, John Patterson  wrote:
> You could create a filter that is mapped to "/*" and does a forward to  
> your jsp.
>
> This one remembers the original path:
>
> public class ForwardFilter implements Filter
> {
>         public static final String SERVLET_PATH =  
> ForwardFilter.class.getName() + ".servletPath";
>         private String target;
>
>         public void destroy()
>         {
>         }
>
>         public void doFilter(ServletRequest request, ServletResponse  
> response, FilterChain chain)
>                         throws IOException, ServletException
>         {
>                 request.setAttribute(SERVLET_PATH, ((HttpServletRequest)  
> request).getServletPath());
>                 request.getRequestDispatcher(target).forward(request, 
> response);
>         }
>
>         public void init(FilterConfig config) throws ServletException
>         {
>                 target = config.getInitParameter("target");
>         }
>
> }
>
> On 7 Apr 2010, at 10:28, Mark wrote:
>
>
>
> > Hi,
>
> > I'm using GWT and GAE. I want to serve my project's one and only jsp
> > file no matter what url is entered by the user in their browser. So
> > the web.xml file looks like this:
>
> >  
> >    UserMaps.jsp
> >  
>
> >  
> >    indexpage
> >    UserMaps.jsp
> >  
> >  
> >    indexpage
> >    /*
> >  
>
> > when I run this locally, it works fine. Any of the following urls
> > serve my gwt app with UserMaps.jsp:
>
> >  http://localhost:/
> >  http://localhost:/JohnDoe
> >  http://localhost:/JaneDoe
>
> > when I publish to GAE, it stops working, none of the urls can find
> > UserMaps.jsp:
>
> >  http://usermaps.appspot.com/
> >  http://usermaps.appspot.com/JohnDoe/
> >  http://usermaps.appspot.com/JaneDoe/
>
> > I'm not sure if this should work, I'm looking at the reference here:
>
> >  http://code.google.com/appengine/docs/java/config/webxml.html#The_Wel...
>
> > My real goal is to support a twitter-like url mapping scheme where a
> > user can enter my domain/username, and I'll show them their customized
> > user page (by pulling some info out of the data store and dynamically
> > rendering a page for them),
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google  
> > Groups "Google App Engine for Java" group.
> > To post to this group, send email to google-appengine-java@googlegroups.com
> > .
> > To unsubscribe from this group, send email to 
> > google-appengine-java+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group 
> > athttp://groups.google.com/group/google-appengine-java?hl=en
> > .

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



[appengine-java] A catch-all servlet?

2010-04-06 Thread Mark
Hi,

I'm using GWT and GAE. I want to serve my project's one and only jsp
file no matter what url is entered by the user in their browser. So
the web.xml file looks like this:

  
UserMaps.jsp
  

  
indexpage
UserMaps.jsp
  
  
indexpage
/*
  

when I run this locally, it works fine. Any of the following urls
serve my gwt app with UserMaps.jsp:

  http://localhost:/
  http://localhost:/JohnDoe
  http://localhost:/JaneDoe

when I publish to GAE, it stops working, none of the urls can find
UserMaps.jsp:

  http://usermaps.appspot.com/
  http://usermaps.appspot.com/JohnDoe/
  http://usermaps.appspot.com/JaneDoe/

I'm not sure if this should work, I'm looking at the reference here:

  
http://code.google.com/appengine/docs/java/config/webxml.html#The_Welcome_File_List

My real goal is to support a twitter-like url mapping scheme where a
user can enter my domain/username, and I'll show them their customized
user page (by pulling some info out of the data store and dynamically
rendering a page for them),

Thanks

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



[appengine-java] Re: How to find an object which uses a Key as its primary key?

2010-04-05 Thread Mark
Thanks!

On Apr 5, 7:34 am, Thomas  wrote:
> Hi Mark:
>
>     The KeyFactory.keyToString and KeyFactory.stringToKey should be
> what you want. KeyFactory.keyToString converts a Key instance to a
> plain String which can be passed to browser and then be sent back to
> server later by another user request. The server can convert it to a
> Key by calling KeyFactory.stringToKey and use the key in a query.
>
> Thomas
>
> On 4月5日, 下午10時22分, Mark  wrote:
>
>
>
> > Hi,
>
> > I set up a persistent class like this:
>
> >   @PersistenceCapable
> >   public class Farm
> >   {
> >       @PrimaryKey
> >       @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> >       private Key mKey;
> >   }
>
> > I might send a representation of this object down to a client browser.
> > I imagine it could be in JSON format. How can I include the mKey id so
> > that the client can interact with the Farm instance later on? I see
> > Key has a method getId() which returns a long. Is this what we can
> > send down to the client? I basically want to expose a service like
> > this:
>
> >   mysite.com/plowfarm?id=abc
>
> > so I need a way to get this particular Farm instance out of the data
> > store again from some random client, which will only know about
> > strings it reads from a JSON object:
>
> >   String qs = "SELECT FROM org.myproject.farms.server.data.Farm WHERE
> > mKey == " + id;
>
> > Is that long id the answer to this?
>
> > Thanks

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



[appengine-java] How to find an object which uses a Key as its primary key?

2010-04-05 Thread Mark
Hi,

I set up a persistent class like this:

  @PersistenceCapable
  public class Farm
  {
  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  private Key mKey;
  }

I might send a representation of this object down to a client browser.
I imagine it could be in JSON format. How can I include the mKey id so
that the client can interact with the Farm instance later on? I see
Key has a method getId() which returns a long. Is this what we can
send down to the client? I basically want to expose a service like
this:

  mysite.com/plowfarm?id=abc

so I need a way to get this particular Farm instance out of the data
store again from some random client, which will only know about
strings it reads from a JSON object:

  String qs = "SELECT FROM org.myproject.farms.server.data.Farm WHERE
mKey == " + id;

Is that long id the answer to this?

Thanks

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



[appengine-java] How to properly persist an unowned object?

2010-03-18 Thread Mark
Hi,

I'm not understanding how to implement a simple unowned relationship.
I have two classes like:

  class Farm {
List mHorses;
  }

  class Horse {
@PrimaryKey
Key mKey;
  }

so a Farm can have some horses. I'd like to create a new horse, then
put it on a farm, in one transaction. But how do I know the key of the
horse during the transaction?:

  Farm farm = loadFarm(...);
  Horse horse = new Horse();
  horse.setName("Roger");
  try {
tx = pm.currentTransaction();
tx.begin();
pm.makePersistent(horse); // is the key available now?
farm.mHorses.add(horse.mKey);
pm.makePersistent(farm);
tx.commit();
  }

when is the Horse.mKey value actually set and ready for use? Or do I
have to do this as two separate atomic operations:

  1) Save the horse which generates its mKey value.
  2) If that worked, add it to the farm, persist the farm again.
  3) If that worked, all good, if not, have to delete the horse cause
now it's in limbo?

Thanks

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



[appengine-java] Re: Why not use integer primary keys?

2009-12-12 Thread Mark
You can use Long type as primary key.

On Dec 12, 3:27 am, Hershiv Haria  wrote:
> Hi all,
>
> I understand this is a relatively basic question, but I have been
> searching around and can't find an answer that explains it. According
> tohttp://www.datanucleus.org/products/accessplatform/jdo/types.html
> there shouldn't be any problem with using an int as a PK, but when I
> use it in my app it throws the following exception:
>
> Error in meta-data for my.syncdroidserver.Box.boxID: Unsupported
> primary key type: int
>
> I'd like to know why I can't use ints and any ideas of what else to
> use. I'd like to stick with simple types such as ints as the id is
> going to be used as an index in arrays.
>
> Thanks,
>
> Hershiv

--

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




[appengine-java] Re: ServerError (500) after bulk upload

2009-10-28 Thread Mark Stephens
It's doing it again now because I maxxed out the cpu trying to load more
data.   Is it possible to get more resources so I can load the rest of my
data?  It's a list of upc symbols and their description, it's 1.2 million
rows.

Thanks,
Mark

On Wed, Oct 28, 2009 at 1:57 PM, Jason (Google)  wrote:

> What is your application ID?
>
> - Jason
>
> On Tue, Oct 27, 2009 at 8:56 AM, fence  wrote:
>
>>
>> I used the python bulk uploader ( appcfg.py upload_data ) to upload
>> data last night.  Eventually I ran out of CPU trying to load 66 megs,
>> 1.2 million rows.  Now when I try and click on anything under
>> Datastore in the dashboard I get a 500 error.
>>
>>
>>
>>
>
> >
>

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



[appengine-java] Re: ServerError (500) after bulk upload

2009-10-28 Thread Mark Stephens
suprcoupon

It's back now.  I figured it would happen when my limits got reset.

Thanks,
Mark


On Wed, Oct 28, 2009 at 1:57 PM, Jason (Google)  wrote:

> What is your application ID?
>
> - Jason
>
> On Tue, Oct 27, 2009 at 8:56 AM, fence  wrote:
>
>>
>> I used the python bulk uploader ( appcfg.py upload_data ) to upload
>> data last night.  Eventually I ran out of CPU trying to load 66 megs,
>> 1.2 million rows.  Now when I try and click on anything under
>> Datastore in the dashboard I get a 500 error.
>>
>>
>>
>>
>
> >
>

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



[appengine-java] Re: JPA and Scala

2009-10-19 Thread Mark Essel

Hello Chris. I'm also interested in building a scala app on the Google
App Engine. I have a simple working (empty) lift/scala template here:
http://dl.getdropbox.com/u/1127092/lift4gaeTEMPLATE.zip

But I haven't been able to cross the bridge from scala GAE app to wave
robot.
As I understand it there are examples of java wave robots floating
around so I tried using their guidance
Settings for bots: http://code.google.com/apis/wave/extensions/robots/
Java wave bot: http://www.vogella.de/articles/GoogleWave/article.html#robot

Once I get this working I'll add it the code/how to information to
this google wave:
https://wave.google.com/wave/#restored:search:by%253Ame,restored:wave:googlewave.com!w%252BRz-PM7LmK




On Oct 14, 1:02 am, chrislewis  wrote:
> Hi all,
>
> I've spent hours wrestling with getting some form of a working dev
> environment for aScala(Lift) app on app engine. Gettingscalagoing
> is cake, lift not much harder. The pain point is using the datastore.
> Given the choice between JDO and JPA, I'm choosing JPA. After spending
> hours getting a frankenbuild working, I'm now at issues with the
> datastore that have me stumped. Using the following class,
> successfully built and enhanced, appengine (under eclipse) throws the
> following error when I try to merge() an entity:
>
> javax.jdo.JDOFatalInternalException: It's illegal to call
> jdoCopyKeyFieldsToObjectId for a class with SingleFieldIdentity.
>
> The class:
>
> import javax.persistence._
>
> @Entity
> class Author {
>
>   @Id
>   @GeneratedValue{ val strategy = GenerationType.IDENTITY }
>   var id: java.lang.Long = _
>
>   var name: String = _
>
> }
>
> Can anyone shed some light on this? Thanks!

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



[appengine-java] Re: appcfg can't find javac?

2009-09-25 Thread Mark Space

Thanks for the reply.  However, I think this is already the case.  I
do apologize for the java/javac typo above.  The JDK is the only thing
on my PATH, there's no JRE.  (Note this is from the Windows shell, but
the Cygwin utility "which" prepends /cygdrive/ anyway.)  This shows
that the JDK is the first and only "javac" accessible on my path.

Why would appcfg be looking for javac in the JRE6 folders?  Something
is fishy here.


C:\Users\Brenden>which javac
/cygdrive/c/Program Files/Java/jdk1.6.0/bin/javac

C:\Users\Brenden>path
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Users
\Brenden\Do
wnloads\Maven\apache-maven-2.0.9\bin;c:\usr\bin;C:\Program Files
\Common Files\Ro
xio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared
\9.0\DLLShared\;
C:\Program Files\Common Files\GTK\2.0\bin;C:\Program Files\Java
\jdk1.6.0\bin;c:\
cygwin\bin;C:\usr\svn\bin;C:\Program Files\MySQL\MySQL Server
5.0\bin;C:\Program
 Files\glassfish-v2\bin;C:\Program Files\PHP;C:\Program Files
\Mercurial;C:\Progr
am Files\QuickTime\QTSystem\


My JAVA_HOME is set to the JDK too:


C:\Users\Brenden>set | grep HOME
COMPUTERNAME=HOMER
HOMEDRIVE=C:
HOMEPATH=\Users\Brenden
JAVA_HOME=C:\Program Files\Java\jdk1.6.0


On Sep 25, 9:53 pm, Toby Reyelts  wrote:
> If you look closer at the message, you can see that it's looking for the
> java compiler - *javac.exe* not java.exe. The JRE does not contain the Java
> compiler. Instead, you'll need to put the JDK on your PATH ahead of your
> JRE.

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



[appengine-java] appcfg can't find javac?

2009-09-25 Thread Mark Space

Hi all, I just tried appcfg for the first time and I got some odd
errors.  The error is odd because my javac is exactly where the error
says it is looking.



C:\Users\Brenden\Downloads\GoogleAppEngine\appengine-java-
sdk-1.2.5\appengine-ja
va-sdk-1.2.5\bin>appcfg.cmd update c:\Users\Brenden\Dev\GAE1\web
Reading application configuration data...
Beginning server interaction for paixweb...
0% Creating staging directory
5% Scanning for jsp files.
8% Compiling jsp files.
11% Compiling java files.

Error Details:
Sep 25, 2009 7:34:34 PM org.apache.jasper.JspC processFile
INFO: Built File: \index.jsp


java.lang.IllegalStateException: cannot find javac executable based on
java.home
, tried "C:\Program Files\Java\jre6\bin\javac.exe" and "C:\Program
Files\Java\bi
n\javac.exe"
Unable to upload app: cannot find javac executable based on java.home,
tried "C:
\Program Files\Java\jre6\bin\javac.exe" and "C:\Program Files\Java\bin
\javac.exe
"
Please see the logs [C:\Users\Brenden\AppData\Local\Temp
\appcfg80867784232196126
55.log] for further information.


C:\Users\Brenden>dir "C:\Program Files\Java\jre6\bin\java.exe"
 Volume in drive C is OS
 Volume Serial Number is 2225-A6A0

 Directory of C:\Program Files\Java\jre6\bin

07/25/2009  05:23 AM   145,184 java.exe
   1 File(s)145,184 bytes
   0 Dir(s)  23,832,948,736 bytes free

C:\Users\Brenden>

**


Does anyone have an idea what might be going on?


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



[appengine-java] Cannot delete objects

2009-09-22 Thread Mark Renouf

I can't seem to cascade delete anything...  any ideas?

AppEngine/Java 1.2.5

Attempt was made to modify the primary key of an object of type
com.examplel.data.Item identified by key Location("FOO")/Menu(10)/Item
(11)  Primary keys are immutable.  (New value: Item(11)
org.datanucleus.exceptions.NucleusUserException: Attempt was made to
modify the primary key of an object of type
com.aerva.client.mcd.portal.data.Item identified by key Location
("FOO")/Menu(10)/Item(11)  Primary keys are immutable.  (New value:
Item(11)
at org.datanucleus.store.appengine.DatastoreFieldManager.storeKeyPK
(DatastoreFieldManager.java:639)
at
org.datanucleus.store.appengine.DatastoreFieldManager.storePKIdField
(DatastoreFieldManager.java:450)
at
org.datanucleus.store.appengine.DatastoreFieldManager.storeObjectField
(DatastoreFieldManager.java:751)
at org.datanucleus.state.AbstractStateManager.providedObjectField
(AbstractStateManager.java:1037)


Code (First version):

   // Already retreived object to be deleted:
   Location location = ...;

PersistenceManager pm = PMF.get().getPersistenceManager();
Transaction tx = pm.currentTransaction();

try {
tx.begin();
pm.deletePersistent(location);
tx.commit();
return Response.noContent().build();

}
finally {
if (tx.isActive())
tx.rollback();
}

Code (Second version):


PersistenceManager pm = PMF.get().getPersistenceManager();
Transaction tx = pm.currentTransaction();

try {
tx.begin();
Query q = pm.newQuery(Location.class);
q.setFilter("id == '" + loc.getId() + "'");
q.deletePersistentAll();
tx.commit();
return Response.noContent().build();

}
finally {
if (tx.isActive())
tx.rollback();
}


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



[appengine-java] java.lang.ClassCastException: java.lang.ClassCastException cannot be cast to javax.servlet.ServletException

2009-09-13 Thread Mark Bakker

I am upgrading to the new appengine 1.2.5, since then I get this
exception, has anyone a idea? It seems related to my index.jsp what
straits the following;

<%@ page session="false" %>




java.lang.ClassCastException: java.lang.ClassCastException cannot be
cast to javax.servlet.ServletException
at org.apache.jasper.runtime.PageContextImpl.handlePageException
(PageContextImpl.java:754)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:51)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
487)
at org.mortbay.jetty.servlet.ServletHandler.handle
(ServletHandler.java:362)
at org.mortbay.jetty.security.SecurityHandler.handle
(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle
(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle
(ContextHandler.java:712)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
405)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:268)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
at
com.google.apphosting.runtime.jetty.ResourceFileServlet.serveWelcomeFileAsForward
(ResourceFileServlet.java:321)
at
com.google.apphosting.runtime.jetty.ResourceFileServlet.maybeServeWelcomeFile
(ResourceFileServlet.java:258)
at com.google.apphosting.runtime.jetty.ResourceFileServlet.doGet
(ResourceFileServlet.java:132)
at com.google.apphosting.runtime.jetty.ResourceFileServlet.doPost
(ResourceFileServlet.java:187)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1093)
at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter
(SaveSessionFilter.java:35)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle
(ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle
(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle
(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle
(ContextHandler.java:712)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
405)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle
(AppVersionHandlerMap.java:237)
at org.mortbay.jetty.handler.HandlerWrapper.handle
(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:313)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
506)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
(HttpConnection.java:830)
at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable
(RpcRequestParser.java:76)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
at
com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest
(JettyServletEngineAdapter.java:139)
at com.google.apphosting.runtime.JavaRuntime.handleRequest
(JavaRuntime.java:235)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:4950)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:4948)
at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest
(BlockingApplicationHandler.java:24)
at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:
359)
at com.google.net.rpc.impl.Server$2.run(Server.java:823)
at com.google.tracing.LocalTraceSpanRunnable.run
(LocalTraceSpanRunnable.java:56)
at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan
(LocalTraceSpanBuilder.java:516)
at com.google.net.rpc.impl.Server.startRpc(Server.java:778)
at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
at com.google.net.rpc.impl.ServerConnection.messageReceived
(ServerConnection.java:437)
at com.google.net.rpc.impl.RpcConnection.parseMessages
(RpcConnection.java:319)
at com.google.net.rpc.impl.RpcConnection.dataReceived
(RpcConnection.java:290)
at com.google.net.async.Connection.handleReadEvent(Connection.java:
428)
at com.google.net.async.EventDispatcher.processNetworkEvents
(EventDispatcher.java:7

[appengine-java] Re: Are 1.2.2 sdk jars available in a public maven repository?

2009-09-07 Thread Mark Tye

Don't be ridiculous, of course Google provides a Maven repository.
It's right here:

http://code.google.com/p/google-maven-repository/

The problem is, that repo hasn't been updated since version 1.2.1.
There's been two releases since then.

I filed an issue on this a month ago, it's got 6 stars, we're still
waiting on a response:

http://code.google.com/p/googleappengine/issues/detail?id=1969

- Mark

On Aug 25, 4:02 pm, "Jason (Google)"  wrote:
> It looks like you already found this 
> thread:http://groups.google.com/group/google-appengine-java/browse_thread/th...
>
> In short, no, Google does not provide a Maven repository although there are
> user-provided Maven descriptors available.
>
> - Jason
>
> On Sat, Aug 22, 2009 at 12:45 PM, Marcel Overdijk
> wrote:
>
>
>
> > Are 1.2.2 sdk jars available in a public maven repository?
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~--~~~~--~~--~--~---