Re: [appengine-java] Quiz

2011-09-29 Thread Stephen Johnson
So the answer is false. Forgot to actually state that.

On Thu, Sep 29, 2011 at 3:44 PM, Stephen Johnson wrote:

> That's easy. You are not supposed to return a value in the finally block
> since it overwrites any previous return values and also any exceptions that
> are thrown. Return statements in a finally block are a big NO-NO.
>
> Stephen
> CortexConnect.com
>
>
> On Thu, Sep 29, 2011 at 3:36 PM, gk  wrote:
>
>> What is the output of the following method?
>>
>> public boolean whatDoesItDo()
>> {
>>try
>>{
>>if(true)
>>{
>>throw new IllegalStateException();
>>}
>>return true;
>>}
>>finally
>>{
>>if(true)
>>{
>>return false;
>>}
>>}
>> }
>>
>> Have a nice time figuring it out ;-)
>>
>> --
>> 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.
>>
>>
>

-- 
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] Quiz

2011-09-29 Thread Stephen Johnson
That's easy. You are not supposed to return a value in the finally block
since it overwrites any previous return values and also any exceptions that
are thrown. Return statements in a finally block are a big NO-NO.

Stephen
CortexConnect.com

On Thu, Sep 29, 2011 at 3:36 PM, gk  wrote:

> What is the output of the following method?
>
> public boolean whatDoesItDo()
> {
>try
>{
>if(true)
>{
>throw new IllegalStateException();
>}
>return true;
>}
>finally
>{
>if(true)
>{
>return false;
>}
>}
> }
>
> Have a nice time figuring it out ;-)
>
> --
> 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.
>
>

-- 
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] Cronjob "every 1 minutes" executes every 2 minutes

2011-09-28 Thread Stephen Johnson
Great! Glad it worked for you.

On Wed, Sep 28, 2011 at 10:38 AM, dimi  wrote:

> Thanks Stephen, works like a charm!
>
> I don't really understand the explanation about synchronized in the manual,
> so I didn't try it out.
>
> But it works,... as long as the request doesn't exceeds 60 seconds. If it
> does, the cron executes a minute later.
>
> --
> 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/-/KVIzJWFHU5wJ.
>
> 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] Cronjob "every 1 minutes" executes every 2 minutes

2011-09-28 Thread Stephen Johnson
Sounds like you need to add "synchronized" to the schedule, thus "every 1
minutes synchronized", to get it what you want to do if I'm understanding
you correctly.

Stephen
CortexConnect.com

On Wed, Sep 28, 2011 at 8:38 AM, dimi  wrote:

> Hi guys,
>
> I define my cron job with every 1 minutes.
>
> The job fetches an XML every 5 seconds (Thread.sleep(5 * 1000);). In
> total, the job runs for 60 seconds.
> While testing I notice that the job doesn't run every 1 minute, but every 2
> minutes.
>
> This means that "every N minutes" means: when a job has finished running,
> start the next one N minutes from now.
> I tried my logic by putting a cronjob online with every 2
> minutes. And this job runs every 4 minutes (the job runs for 2
> minutes and waits until 2 minutes are over)
>
> Is that a bug or is this intentional? And how to get around this?
>
> I need to load this XML every 5 seconds. (the IT guys who publish the XML
> cannot notify me when the information updates)
>
> Thnx!
>
> --
> 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/-/bPipwpjpVVUJ.
> 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] Servlet Mapping not working as expected

2011-09-26 Thread Stephen Johnson
My guess is that Google is interpreting them as static files and Google's
infrastructure is handling them before it reaches your app. So, read up on
excluding static files so they aren't served up by Google's infrastructure
at http://code.google.com/appengine/docs/java/config/appconfig.html

Also, I put my JSP files in my WEB-INF and you may want to do that as well
with your vm files. Then there shouldn't be any way they will be served as
static files by Google.

Stephen
CortexConnect.com


On Sun, Sep 25, 2011 at 11:50 AM, Andrew Ducker wrote:

> I'm trying to get Velocity up and running with GAE, and the first
> problem I'm bumping into is that servlet mapping doesn't seem to be
> working as I'd expect.
>
> I've cut down the Web.xml to its bare minimum:
> 
>velocity
>org.apache.velocity.tools.view.VelocityViewServlet servlet-class>
> 
> 
>velocity
>*.vm
> 
> 
>index.vm
> 
>
> Now, when I access http://localhost:/ it presents with me with a
> page that looks as I'd expect (give or take).  But when I access
> http://localhost:/index.vm it shows me the source of the page,
> rather than the processed version.
>
> With "*.vm" in the url-pattern, I'd have expected it to work exactly
> the same in both cases.
>
> I did a bit of further testing, rerouting things to my own servlet to
> see when it got called and when it didn't.  If I use a uri to a file
> that exists then I get the source of it.  If I use a uri for a file
> that doesn't exist (i.e. http://localhost:/DoesntExist.vm) then my
> servlet is called.
>
> Any suggestions as to why it would be getting the file directly rather
> than calling the servlet?  Is there a setting I need to configure to
> tell it to call the servlet even if the file exists?
>
> Cheers,
>
> Andy
>
> --
> 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.
>
>

-- 
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] how to set text to the com.google.appengine.api.datastore.Text in app engine

2011-08-29 Thread Stephen Johnson
Uh...perhaps you might want to say what the error is or per chance even a
stack trace or should we get out the crystal ball.

Stephen
www.cortexconnect.com

On Fri, Aug 26, 2011 at 7:27 AM, Sundi  wrote:

> i am trying to append charcters to the
> com.google.appengine.api.datastore.Text  object but its thrwoing error
> any pointers will be helpful
> com.google.appengine.api.datastore.Text reasonatedBy;
>
> public void setReasonatedBy(String reasonatedByNew) {
>this.reasonatedBy = new Text(reasonatedBy.toString() +
> reasonatedByNew);
>}
>
> --
> 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.
>
>

-- 
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: GWT will serialize java.util.Hashet and won't serialize org.datanucleus.sco.backed.HashSet from JDO. Why?

2011-08-23 Thread Stephen Johnson
Good to know. Not sure what all the low-level difference between the two is
either but glad one of them worked.

On Tue, Aug 23, 2011 at 3:19 PM, Brandon Donnelson
wrote:

> Ah, I thought they were both the same at first, so after you said that I
> tried pm.makeTransient(j); and it won't work for me. Thanks for the help.
>
> Brandon
>
> --
> 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/-/-cOOHJDt4YUJ.
>
> 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: GWT will serialize java.util.Hashet and won't serialize org.datanucleus.sco.backed.HashSet from JDO. Why?

2011-08-23 Thread Stephen Johnson
I wasn't sure detachCopy would work but I figured makeTransient should. Glad
to see detachCopy does the trick for you!

On Tue, Aug 23, 2011 at 3:08 PM, Brandon Donnelson
wrote:

> Wow, that worked, your my best friend :)
>
> How I got it to work:
>
> if (j != null) {
>   classJdo detatched = pm.detachCopy(j);
>   a.add(detatched.getData());
> }
>
>
> Thanks,
> Brandon Donnelson
> http://gwt-examples.google.com
>
> --
> 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/-/WHNAPM0VlqYJ.
>
> 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] Upload attachments Google Sites

2011-08-23 Thread Stephen Johnson
Happy to help. Ikai's right, the best way would be if you can subclass
MediaFileSource. Here's a quick and dirty attempt. Didn't try to compile it
or anything like that. Just threw it together. The only question is whether
or not getMediaFile is called by anything else within the API. I've coded
this one to through an UnsupportedException if it is. Not sure what to do if
the API uses that method call. Hopefully it doesn't. If it does, then I
guess you'd have to subclass java.io.File and fake a File object.

public class Memory*MediaFileSource* extends MediaFileSource {

  private byte[] mediaBuf;

  public *MediaFileSource*(byte[] mediaBuf, String mediaType, String name,
DateTime lastModified) {

super(mediaType);

this.mediaBuf = mediaBuf;

this.contentLength = buf.length();

this.lastModified = lastModified;

this.name = name;

  }

 public InputStream getInputStream() throws IOException {

return new ByteArrayInputStream(buf);

  }

  public OutputStream getOutputStream() {

throw new UnsupportedOperationException("Cannot write to *
MediaFileSource*");

  }

  public File getMediaFile() {

   throw new UnsupportedOperationException("No associated file object for
memory source");

  }

}

On Tue, Aug 23, 2011 at 2:53 PM, Ikai Lan (Google) wrote:

> Hah, I should have looked at the code. Yeah, my example writes the thing to
> disk. Thanks for the catch, Stephen!
>
> The GData protocol is open source, so you can probably poke around and
> figure out what it actually does with the File instance. If you look at this
> code here:
>
>
> http://www.google.com/codesearch#EOYaOg_yTgg/trunk/java/src/com/google/gdata/data/media/MediaFileSource.java&q=mediafilesource%20package:http://gdata-java-client%5C.googlecode%5C.com
>
> MediaFileSource has a getInputStream() method that just turns the File into
> an InputStream *anyway*. You can probably create your own subclass of
> BaseMediaSource that takes an InputStream and just directly return that.
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> plus.ikailan.com | twitter.com/ikai
>
>
>
> On Tue, Aug 23, 2011 at 2:42 PM, Stephen Johnson 
> wrote:
>
>> A File object isn't really the file, it's a reference to the file and you
>> can use it to get its associated metadata (permissions,size,etc.) The
>> example Ikai is referring to creates a new file on disk which isn't allowed
>> on AppEngine so this isn't going to work. Nicolo, perhaps you can create
>> your own multi-part http request and post it using the protocol instead of
>> the API using URLFetch.  An example from the docs is shown below. Definitely
>> not as easy as the API.
>>
>> Stephen
>> www.cortexconnect.com
>>
>> POST /feeds/content/domainName/siteName HTTP/1.1
>> Host: sites.google.com
>> GData-Version: 1.4
>> Authorization: 
>> Content-Length: 7221984
>> Content-Type: multipart/related; boundary=END_OF_PART
>> --END_OF_PART
>> Content-Type: application/atom+xml
>> http://www.w3.org/2005/Atom";>
>>   http://schemas.google.com/g/2005#kind";
>>   term="http://schemas.google.com/sites/2008#attachment"; 
>> label="attachment"/>
>>   http://schemas.google.com/sites/2008#parent"; 
>> type="application/atom+xml"
>> 
>> href="https://sites.google.com/feeds/content/domainName/siteName/PARENT_ENTRY_ID"/>
>>   PDF File
>>   HR packet
>> 
>> --END_OF_PART
>> Content-Type: application/pdf
>>
>> ... pdf contents here ...
>>
>> --END_OF_PART--
>>
>>
>> On Tue, Aug 23, 2011 at 1:48 PM, Ikai Lan (Google) wrote:
>>
>>> I just took a look at the GData library, and it shouldn't be that hard to
>>> convert an InputStream to a File instance. Here's something I found
>>> searching:
>>>
>>> http://www.roseindia.net/java/java-conversion/InputstreamToFile.shtml
>>>
>>> --
>>> Ikai Lan
>>> Developer Programs Engineer, Google App Engine
>>> plus.ikailan.com | twitter.com/ikai
>>>
>>>
>>>
>>> On Sun, Aug 21, 2011 at 8:01 AM, Nicolò Brognoli <
>>> nicolo.brogn...@gmail.com> wrote:
>>>
>>>> Hello,
>>>> I want to upload an InputStream object onto Google sites. The sites API
>>>> manage only "File" objects, but I can't use the OuputStream to generate the
>>>> File from the InputStream.
>>>>
>>>> How can I upload the InputStream object to Google Sites?
>>>> Should I do that with a 

Re: [appengine-java] Re: GWT will serialize java.util.Hashet and won't serialize org.datanucleus.sco.backed.HashSet from JDO. Why?

2011-08-23 Thread Stephen Johnson
Brandon, did you try making your object transient by using the makeTransient
call? Not sure if that would do the trick for you or not. Just curious.

Stephen
www.cortexconnect.com

On Tue, Aug 23, 2011 at 2:43 PM, Brandon Donnelson
wrote:

> The workaround for GWT HashSet transport.
>
>   // this wont work
>   java.util.HashSet hs = jdoIds;
>
>   // work around
>   private HashSet getChildren() {
> if (jdoIds == null || jdoIds.size() == 0) {
>   return null;
> }
> java.util.HashSet r = new java.util.HashSet();
> Iterator itr = jdoIds.iterator();
> while (itr.hasNext()) {
>   Long l = itr.next();
>   if (l != null) {
> r.add(l);
>   }
> }
> return r;
>   }
>
>
> Brandon Donnelson
> http://gwt-examples.googlecode.com
>
> --
> 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/-/SlXJM72IP2cJ.
>
> 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] Upload attachments Google Sites

2011-08-23 Thread Stephen Johnson
A File object isn't really the file, it's a reference to the file and you
can use it to get its associated metadata (permissions,size,etc.) The
example Ikai is referring to creates a new file on disk which isn't allowed
on AppEngine so this isn't going to work. Nicolo, perhaps you can create
your own multi-part http request and post it using the protocol instead of
the API using URLFetch.  An example from the docs is shown below. Definitely
not as easy as the API.

Stephen
www.cortexconnect.com

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: 
Content-Length: 7221984
Content-Type: multipart/related; boundary=END_OF_PART
--END_OF_PART
Content-Type: application/atom+xml
http://www.w3.org/2005/Atom";>
  http://schemas.google.com/g/2005#kind";
  term="http://schemas.google.com/sites/2008#attachment";
label="attachment"/>
  http://schemas.google.com/sites/2008#parent";
type="application/atom+xml"

href="https://sites.google.com/feeds/content/domainName/siteName/PARENT_ENTRY_ID"/>
  PDF File
  HR packet

--END_OF_PART
Content-Type: application/pdf

... pdf contents here ...

--END_OF_PART--


On Tue, Aug 23, 2011 at 1:48 PM, Ikai Lan (Google) wrote:

> I just took a look at the GData library, and it shouldn't be that hard to
> convert an InputStream to a File instance. Here's something I found
> searching:
>
> http://www.roseindia.net/java/java-conversion/InputstreamToFile.shtml
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> plus.ikailan.com | twitter.com/ikai
>
>
>
> On Sun, Aug 21, 2011 at 8:01 AM, Nicolò Brognoli <
> nicolo.brogn...@gmail.com> wrote:
>
>> Hello,
>> I want to upload an InputStream object onto Google sites. The sites API
>> manage only "File" objects, but I can't use the OuputStream to generate the
>> File from the InputStream.
>>
>> How can I upload the InputStream object to Google Sites?
>> Should I do that with a POST request? And if so, how can I create such
>> request?
>>
>> Thanks.
>>
>> --
>> 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/-/xu1WcvMjvXMJ.
>> 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.
>

-- 
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] appengine complained can't seriialize javax.faces.component.UIParameter object???

2011-08-22 Thread Stephen Johnson
Hi,
The local dev stores session information in memory so you won't get the
NotSerializableException on local dev because the local dev doesn't need to
serialize the objects that are in the session. I think that may also be the
case with glassfish and tomcat if you haven't set up a database to store
session information in. When you deploy to GAE, sessions are stored in the
datastore and thus the objects in the session have to be serialized. The
UIParameter object in your session isn't serializable but a quick glance at
the docs indicates it has saveState and restoreState methods that may be
what you are supposed to use.

Stephen
www.cortexconnect.com

On Sun, Aug 21, 2011 at 4:49 AM, nella  wrote:

> Hi,  I have a JSF2 app that is able to run on my local instance.  However,
> after I deployed to GAE, i encountered an object serialization runtime error
> on pages containing a UIPrameter object  (e.g.value="foo" />)
>
> I've tried the same app on glassfish (local) and tomcat (local), and they
> both run fine.  I suspect maybe it is not as simple as object serialization
> problem?  Could it be concurrent thread related issue? I can use an extra
> pair of eyes to spot what am I missing here.  Thank you
>
>
> [code]
>
> Uncaught exception from servlet
> java.lang.RuntimeException: java.io.NotSerializableException: 
> javax.faces.component.UIParameter
>   at 
> com.google.apphosting.runtime.jetty.SessionManager.serialize(SessionManager.java:358)
>   at 
> com.google.apphosting.runtime.jetty.DatastoreSessionStore.createEntityForSession(DatastoreSessionStore.java:71)
>   at 
> com.google.apphosting.runtime.jetty.DatastoreSessionStore.saveSession(DatastoreSessionStore.java:93)
>   at 
> com.google.apphosting.runtime.jetty.SessionManager$AppEngineSession.save(SessionManager.java:153)
>   at 
> com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:41)
>   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 
> 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.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:249)
>   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 
> com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
>   at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>   at 
> com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:135)
>   at 
> com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:262)
>   at 
> com.google.apphosting.base.RuntimePb$EvaluationRuntime$2.handleRequest(RuntimePb.java:9819)
>   at com.google.net.rpc.impl.RpcUtil.handleRequest(RpcUtil.java:445)
>   at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:414)
>   at com.google.net.rpc.impl.Server$RpcTask.runInContext(Server.java:579)
>   at 
> com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:454)
>   at com.google.tracing.TraceContext.runInContext(TraceContext.java:694)
>   at 
> com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:332)
>   at 
> com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:324)
>   at 
> com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:452)
>   at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>   at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>   at java.lang.Thread.run(Thread.java:636)
> Caused by: java.io.NotSerializableException: javax.faces.component.UIParameter
>   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1173)
>   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:343)
>   at java.util.ArrayList.writeObject(ArrayList.java:673)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Re: [appengine-java] Server error while doing a large loop

2011-07-28 Thread Stephen Johnson
A couple other things. Make sure you warm up your instance before doing your
test. If you try that loop as your initial hit to the server than the
instance has to start up which could also cause you to timeout. Also, run
the test a few times. With Java's JIT thresholds your going to get a speed
bump once it has run several times.

On Thu, Jul 28, 2011 at 4:30 PM, Stephen Johnson wrote:

> You'll probably want to look at and test backends where you can pick your
> processor speed to see what kind of performance you can get. I think the
> front-end instances are configured similar to B1's, but i can't remember if
> I saw that somewhere or am basing it on the fact that in the new pricing
> model on-demand hours are priced at $.08, so maybe it is similar to B2,
> maybe someone else knows. Also, it was mentioned a while back that a B8
> can't do any faster calculations on a single thread than a B4 so you'll
> probably see similar results if you test your computations on a B4 and B8.
> But once again, not completely sure about that assertion. The upside to a B8
> from a B4 is, from what I gathered, increased memory and if using Java then
> can have multiple requests running at same time on different threads, it's
> just that a single thread can't do better than B4.
>
>  B1 128MB 600MHz $0.08 B2 (default) 256MB 1.2GHz $0.16 B4 512MB 2.4GHz$0.32
> B8 1024MB 4.8GHz $0.64
>
>
> Stephen
> CortexConnect
> http://cortexconnect.appspot.com
>
> On Wed, Jul 27, 2011 at 5:00 PM, SudoKU  wrote:
>
>> I am a new comer to the Google App Engine. I was testing whether I can use
>> Google app engine for a real-time calculations of our geophysical model. The
>> idea is that scientists can calculate / run my model online and plot the
>> results rather than running natively on their computer.  I am testing the
>> free version of google app engine. To test the speed of computation, I wrote
>> the following loop in the Java servlet. I wanted to know how fast Google App
>> Engine can compute my codes.
>>
>>
>>
>> for (int i = 1 ; i < 10 ; i = i+1)
>>
>> {
>>
>> for (int j = 1 ; j < 10 ; j = j+1)
>>
>> {
>>
>>  for (int k = 1 ; k < 10 ; k = k+1)
>>
>> {
>>
>>  int h = i + j + k;
>>
>> }
>>
>>
>>
>> }
>>
>>
>>
>> }
>>
>>
>> While the local deployment in my laptop (I am using eclipse & google
>> plugin - localhost:) completed the calculation in 8 seconds, google app
>> reports error after a few seconds. If I remove the outer loop, Google App
>> engine complete the calculation in about 4-6 seconds.  While the actual
>> computational burden of my model can be less than that of the above codes, I
>> was a disappointed by the fact that Goggle App Engine runs slower than my
>> laptop. Is this because of the free version ?. Will the speed increase, if I
>> pay for App Engine use ?
>>
>>
>> Thanks
>>
>>
>>
>>  --
>> 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/-/VpNTC_2FI3wJ.
>> 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] Server error while doing a large loop

2011-07-28 Thread Stephen Johnson
You'll probably want to look at and test backends where you can pick your
processor speed to see what kind of performance you can get. I think the
front-end instances are configured similar to B1's, but i can't remember if
I saw that somewhere or am basing it on the fact that in the new pricing
model on-demand hours are priced at $.08, so maybe it is similar to B2,
maybe someone else knows. Also, it was mentioned a while back that a B8
can't do any faster calculations on a single thread than a B4 so you'll
probably see similar results if you test your computations on a B4 and B8.
But once again, not completely sure about that assertion. The upside to a B8
from a B4 is, from what I gathered, increased memory and if using Java then
can have multiple requests running at same time on different threads, it's
just that a single thread can't do better than B4.

B1128MB600MHz$0.08B2 (default)256MB1.2GHz$0.16B4512MB2.4GHz$0.32B81024MB
4.8GHz$0.64


Stephen
CortexConnect
http://cortexconnect.appspot.com

On Wed, Jul 27, 2011 at 5:00 PM, SudoKU  wrote:

> I am a new comer to the Google App Engine. I was testing whether I can use
> Google app engine for a real-time calculations of our geophysical model. The
> idea is that scientists can calculate / run my model online and plot the
> results rather than running natively on their computer.  I am testing the
> free version of google app engine. To test the speed of computation, I wrote
> the following loop in the Java servlet. I wanted to know how fast Google App
> Engine can compute my codes.
>
>
>
> for (int i = 1 ; i < 10 ; i = i+1)
>
> {
>
> for (int j = 1 ; j < 10 ; j = j+1)
>
> {
>
>  for (int k = 1 ; k < 10 ; k = k+1)
>
> {
>
>  int h = i + j + k;
>
> }
>
>
>
> }
>
>
>
> }
>
>
> While the local deployment in my laptop (I am using eclipse & google plugin
> - localhost:) completed the calculation in 8 seconds, google app reports
> error after a few seconds. If I remove the outer loop, Google App engine
> complete the calculation in about 4-6 seconds.  While the actual
> computational burden of my model can be less than that of the above codes, I
> was a disappointed by the fact that Goggle App Engine runs slower than my
> laptop. Is this because of the free version ?. Will the speed increase, if I
> pay for App Engine use ?
>
>
> Thanks
>
>
>
>  --
> 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/-/VpNTC_2FI3wJ.
> 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: Blobstore and upload question

2011-07-28 Thread Stephen Johnson
If your data is never more than 32K in size then the datastore is definitely
the way to go. Way easier and simpler IMHO.

On Thu, Jul 28, 2011 at 10:30 AM, GeorgeS  wrote:

> Stephen, thanks for the information!
>
> I had started to put the text into a Datastore but somehow the Blobstore
> looked easier to deal with. I'll revisit the datastore idea. I don't have to
> worry about breaking the data up since these files are never more than 32K
> in size and that is an extreme case.
>
> I was figuring that POSTing from VB.Net was the way to upload the document
> but it helps to know I'm on the right track there.
>
> --
> 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/-/YsIiLkwiK0QJ.
>
> 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: Mining logs for performance data

2011-07-28 Thread Stephen Johnson
I don't know if this will help you or not but you can read about a utility I
wrote a while back that uses XMPP to send log info for real-time monitoring.
These messages can be saved to files I believe by some of the chat clients
out there or probably a custom chat client could be built to save the data
to files in your own format. Maybe it will give you an idea of what you can
do.

It can be found at www.professionalintellectualdevelopment.com and there's a
link to the code at Google Project Hosting there as well.

Stephen
CortexConnect
cortexconnect.appspot.com

On Thu, Jul 28, 2011 at 9:40 AM, Kesava Neeli  wrote:

> Anyone from GAE team has better suggestions for this? Normally we setup a
> separate metrics logger in log4j which would log all metric events in a
> separate log file. Then we generate reports out of it. On GAE, we cannot
> define a logfile for a separate logger and don't have access to download any
> log file..
>
> --
> 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/-/t63On0QqjvkJ.
>
> 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: Blobstore and upload question

2011-07-28 Thread Stephen Johnson
There is a 1MB limit for entities in the datastore so if your data fits
within that limit than the datastore is a good option. My app stores all its
data in the datastore including videos, audio files, images, pdf's, etc. I
started it before the blobstore existed. So, if your data is greater than
the 1MB limit you'll need to break it up in to pieces which isn't as
difficult as it seems but depends on your comfort level. What I'd do is add
to the end of your key (which should be a string) a file segment number so
it would be something like "key:01","key:02". The reason you should pad it
with zeros is so that all of your file entries will be ordered by segment.
If you do "key:1","key:2",. and then you have "key:11", they will be
ordered "key:1","key:11","key:2", which may not bother you but when looking
in the DatastoreViewer, etc. it's nice to see them in order by segment
number. Then when it's time to retrieve the file, you do a range query like
key >= "key:" && key <= "key:~" this will get you the file segments. I use
the ~ (tilde) character as my upper limit character when doing these type of
operations but other characters can be used depending on your data set. My
approach is slightly more involved than this do to the large file sizes I
support and other criteria, but this approach should work for your case.

Okay, from the client perspective, VB.NET shouldn't be a problem, my upload
tool is written in C#. The easiest approach is to read in the text file and
put it's content as the POST data, you can add other parameters to the query
string part of the url if additional information is needed or format the
post to include the file and data together. I myself put the contents of the
file into XML format which i put as the POST data, so I can include all my
data including additional information about the file into the XML. Since
your file is text either approach should work fine. For binary data, you'd
need to base64 encode the data or something like that (which is what I do).

Okay, from the user perspective of uploading the file from a browser to your
app, you'll need to parse the file out of the multi-part format. Here is an
article on how to use an Apache/Jakarta library to do just that:
http://www.developershome.com/wap/wapUpload/wap_upload.asp?page=jsp  This
seems to be a pretty good write up on how to use it. I haven't used it since
there wasn't a nice article about it when I started using GAE and since the
whitelist doesn't allow some things to work, so I'm not sure if this works
or not. So basically I wrote my own parser to extract web browser based
uploads. I think this should work as long as you set the Size Threshold high
enough otherwise the document says it will try to write to disk. Maybe
someone else on this board has used this utility and can say whether or not
it works.

Well, I'm sure this is more info than you needed, but maybe it might help
someone else someday that is trying to figure this same stuff out.
Cheers,
Stephen
CortexConnect
cortexconnect.appspot.com


On Thu, Jul 28, 2011 at 6:55 AM, GeorgeS  wrote:

> Thanks for that link... I took a look but I don't think that model really
> applies to my case here. I'm wondering if just uploading the files and
> pushing them into the Datastore as a piece of text with the key being the
> user id and file type may be simpler?
>
> Anyone have any thoughts on the question about upload from VB.Net? Is this
> possible?
>
> TIA!
>
> --
> 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/-/Ib_tCtVAuLkJ.
>
> 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] Reading static XML file on App Engine

2011-07-19 Thread Stephen Johnson
You need to get the real file path. Use:

   getServletContext().getRealPath("/WEB-INF/")


Stephen

On Mon, Jul 18, 2011 at 12:37 PM, bb  wrote:

> Hello,
> I have a static XML file in my App Engine app that uploads just fine and I
> am trying to read it for some rules based execution logic, but the below
> error is thrown at me:
>
> Caused by: java.security.AccessControlException: access denied
> (java.io.FilePermission /war/WEB-INF/StaticContent.xml read)
> at
> java.security.AccessControlContext.checkPermission(AccessControlContext.java:393)
> at
> java.security.AccessController.checkPermission(AccessController.java:553)
> at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
> at
> com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:166)
> at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
> at java.io.FileInputStream.(FileInputStream.java:130)
> at java.io.FileInputStream.(FileInputStream.java:96)
>
> I tried placing the file both directly in the war and in the war/WEB-INF
> directories, the problem persists. The code on the server that attempts to
> read the file is as simple as this:
>
> final FileInputStream fis = new
> FileInputStream("/war/WEB-INF/StaticContent.xml");
>
> According to this article, I am doing everything correctly:
> http://code.google.com/appengine/kb/java.html#readfile
>
> Any help will be much appreciated.
>
> --
> 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/-/TnMsvbMeBmoJ.
> 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] Why use servlets?

2011-07-11 Thread Stephen Johnson
JSP's get converted to servlets before execution, so when your using JSP's
you're using servlets. Many people, myself included, use servlets for the
business logic and use JSP's for the presentation (generating the html). So,
in my servlets and filters I'll determine if the user is logged in, has
permissions to view whatever page they are attempting to view, query the
datastore or memcache for what the data they want to view, etc. Then, I'll
forward the data to the JSP page to generate the HTML view. There's nothing
that stops you from using JSPs for everything, but most programmers prefer
doing the heavy coding stuff in servlets and use the JSP for what they do
best which is generating HTML.

Stephen

On Mon, Jul 11, 2011 at 9:11 AM, David Chandler wrote:

> Hi Jack,
>
> You can use both servlets and JSPs with App Engine.
>
> To transfer an app id, just add the new owner as an "Owner" under
> Application Settings in the admin console, then remove the previous owner.
>
> /dmc
>
>
> On Sat, Jul 9, 2011 at 11:28 AM, Jack Borgin  wrote:
>
>> I'm brand new to GAE, but I'm impressed.  I think it can provide all my
>> needs, well done Google!  However, I'm fairly new to Java and i'm failing to
>> see why I should use servlets when I can achieve the same thing with JSPs.
>>  Am I missing something here?  What is the point in the servlets if JSPs can
>> do everything the servlets can?
>>
>> Also, does anyone know how to transfer an application ID from one Google
>> account to another?
>>
>> --
>> 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/-/NGW8j6CzYN4J.
>> 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.
>>
>
>
>
> --
> David Chandler
> Developer Programs Engineer, GWT+GAE
> w: http://code.google.com/
> b: http://turbomanage.wordpress.com/
> b: http://googlewebtoolkit.blogspot.com/
> t: @googledevtools
>
>  --
> 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.
>

-- 
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: Re : Re: Best practice for importing a lot of data in the datastore

2011-07-03 Thread Stephen Johnson
You'll need to provide more specifics. How many entities did you add?
How many indexes do you have on each entity. Remember, each indexed
property requires two indexes, an ascending and descending index. This
index creation could eat a lot of your CPU. Do you have composite
indexes? And if so, how many? How did you write the entities. Perhaps,
showing us your code. IMO, there seems to be a lot of very vague
questions being asked in this group and expecting useful answers.

On Sun, Jul 3, 2011 at 10:46 AM, Edwin van de Koppel
 wrote:
> It's really a better idea to follow Cyrille Vincey's advice. Using the
> bulk loader it is so much easier to upload data. Here is the blog post
> that Cyrille meant:
> http://ikaisays.com/2010/06/10/using-the-bulkloader-with-java-app-engine/
>
> If you are looking for something faster than JDO for querying, have a
> look at Slim3, a framework for the App Engine datastore. I found it to
> be much quicker than JDO:
> http://sites.google.com/site/slim3appengine/
>
> But still, it is a good idea to use Map Reduce.
>
> On 24 jun, 06:50, finder-auto_admin  wrote:
>> What I did is that I divided my csv file into 10 little files and I load
>> them one after the other.
>>
>> It took 10s to get to the 100%CPU quota... The size of the csv file is
>> 3,6Mo. Is that normal? Because of that I'm reconsidering the usage of GAE :/
>
> --
> 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.
>
>

-- 
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] Big Entities vs Small Entities

2011-06-28 Thread Stephen Johnson
Why not use a single int or long value (depending on the number of
String values) where each bit position determines if that value was
modified? Bit 0 for value1, bit 1 for value2, etc. Then if you want to
know if any of the values have been modified, for example, in a query
then just query to see if modified property not equal to 0.

Stephen

On Tue, Jun 28, 2011 at 7:23 AM, gadev  wrote:
> Hi there,
> Unfortunately, I have reached a dead-end, I have a number of entities, for
> example:
> @Entity
> class MyEntity {
>   @Id
>   String uid;
>   String value1;
>   String value2;
>   String value3;
>   ...
> }
> The entity is set by a back-end job with default data. The entity is used to
> populate a form in the UI, and all field are displayed with grey color font.
> The user is allowed to edit those details and that means that the UI should
> display the edited values with a different color-font.
> So how do I manage this? Should each entity have a flag for each attribute
> denoting if it changed or not?
> Should I split my entity to smaller entities, for instance,
> @Entity
> class Value1Entity {
>   @Id
>   String uid;
>   String value1;
>   boolean modified=false;
> }
>
> @Entity
> class Value2Entity {
>   @Id
>   String uid;
>   String value2;
>   boolean modified=false;
> }
>
> @Entity
> class Value3Entity {
>   @Id
>   String uid;
>   String value3;
>   boolean modified=false;
> }
> Taking into account latency and performance issues and of course managing
> code what is the best solution? Or what else would you suggest..
> Many thanks,
> G
>
> --
> 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/-/qw16neegNewJ.
> 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] Problem with using OpenSSL-generated RSA key on App Engine Java

2011-06-27 Thread Stephen Johnson
Glad you were able to solve it.

On Sun, Jun 26, 2011 at 2:16 PM, Dado Colussi  wrote:
> On 26 June 2011 11:36, Stephen Johnson  wrote:
>>
>> If private.der is in binary format then why are you reading it in as a
>> String using Scanner???
>
> Because I'm an idiot, but I managed to resolve the issue now. Thank you for
> pointing me to the right direction.
>
> --
> 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.
>

-- 
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] Problem with using OpenSSL-generated RSA key on App Engine Java

2011-06-26 Thread Stephen Johnson
If private.der is in binary format then why are you reading it in as a
String using Scanner???

On Sun, Jun 26, 2011 at 8:02 AM, Dado Colussi  wrote:
> On 25 June 2011 14:51, Stephen Johnson  wrote:
>>
>> I'm no expert on this sort of thing, but I think you need to base-64
>> decode your string.
>
>
> I don't think base64-decoding is necessary, because private.der is in binary
> DER format. The key I posted was base64-encoded PEM key, the format OpenSSL
> handles by default.
> The key works in SDK, but the production system rejects it. Why?
>
> --
> 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.
>

-- 
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] Problem with using OpenSSL-generated RSA key on App Engine Java

2011-06-25 Thread Stephen Johnson
I'm no expert on this sort of thing, but I think you need to base-64
decode your string.

Stephen

On Fri, Jun 24, 2011 at 5:27 PM, Dado Colussi  wrote:
> I have generated an RSA key pair with OpenSSL, and I am successfully using
> it in App Engine Java SDK 1.5 on Mac OS X 10.5.8 with Java 6. However, when
> I run the code on App Engine (real), generatePrivate() throws an exception:
> InputStream is = context.getResourceAsStream("/WEB-INF/private.der");
> String keyString = new Scanner(is).useDelimiter("\\A").next();
> PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyString.getBytes());
> PrivateKey privateKey =
> KeyFactory.getInstance("RSA").generatePrivate(keySpec);
>
> java.security.spec.InvalidKeySpecException:
> java.security.InvalidKeyException: IOException : short read of integer
> at
> sun.security.rsa.RSAKeyFactory.engineGeneratePrivate(RSAKeyFactory.java:217)
> at java.security.KeyFactory.generatePrivate(KeyFactory.java:359)
> I have also tried storing the key base64-encoded in the source code, and
> converting it to bytes when needed, but the same problem occurs.
> I produced the RSA key pair with the following commands:
> openssl genrsa -out private.pem 1024
> openssl pkcs8 -topk8 -nocrypt -in private.pem -inform PEM -outform DER -out
> private.der
> If I replace reading private.der with generating an entirely new key (as a
> test), I no longer get an exception:
> KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
> generator.initialize(1024);
> PKCS8EncodedKeySpec keySpec = new
> PKCS8EncodedKeySpec(generator.genKeyPair().getPrivate().getEncoded());
> PrivateKey privateKey =
> KeyFactory.getInstance("RSA").generatePrivate(keySpec);
> Why is my OpenSSL-generated RSA key failing on App Engine, and how should I
> solve this problem?
> Thank you for any help.
>
> P.S. This is my private.pem, if anyone is interested trying it out:
> -BEGIN RSA PRIVATE KEY-
> MIICXQIBAAKBgQC4v7PH3DxMxYiggaFbkI2n0jQKoMBHMKPi+oVF3UYytkq9GApl
> P1FMGFmDj5QHI02BQWTpnJ+t3rSlko3QKc7Y1W7enMNcY6tUtQDgchfAabSTXMmf
> 7STWsURMC0bCCYcDdIXmcduyAHDAgveUWrLACC2nambFV3tDDu8BxIYIRwIDAQAB
> AoGAFlrL7DEP8tIsGA/XcHbrTRU4StjsqzCNhBeALNX7eoNoQ7029M1WjvibTDoB
> VWPGKw+4oDPddnJuNWKoWjnU118YYfUVIaE1ZkCfc6vbrw5p5VDEw0777stYqxTH
> s7Ipr5S/sq1Lh76OQWIP8QeZylLXKJ68H1O2KMRZxsS5PSECQQDtHFrEmm6aR7jT
> 4L2eH8to/D7rbAjk6KEfHQZyYh6id4YSTPFist8OZN7vgvCMxzcILZzyGvCrphm/
> W3KU6k7fAkEAx3d6DDqINw09CGP7+3BGza7Y+SSkJaMA+UftjGgkR1CD034f9n0t
> ROIcD8PTZ0zFvDlDSl3XpYWaFt7vXyC7mQJAOSgaoUXw33Pmk/ya+OEFMZuMt0dl
> pXiGTm+6vBv28ocJZKPzlC02I8whCW9w+R6Un34PVTU1SstRbZVnu4n31QJBAK5q
> QKRUwisxPj8J/pqcUK0lyMACVC483GsdhBAUODTLqJnUXWqRhnYHKPZ4C3D2Zqjx
> gW+Toy8vJc/93F3YJ3ECQQCms3IxaFq7krk1NBz8BfHbuNbIVivzvAoAQqloTITX
> P4ZkuXb/cdqkoxHDTApTE3Ls3lp5vDkVJ4yDoQBUy1DF
> -END RSA PRIVATE KEY-
>
> --
> 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.
>

-- 
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] two accounts

2011-06-18 Thread Stephen Johnson
Cool. Your welcome.

On Sat, Jun 18, 2011 at 4:45 PM, Steve  wrote:
> Thank you.  I was able to remove the default site and add my app engine id
> to my new domain.
>
> --
> 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/-/NYMCCkw6yMkJ.
> 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] two accounts

2011-06-18 Thread Stephen Johnson
Log into your apps account:

www.google.com/a/YOURDOMAIN.com

On your dashboard remove Google Sites, then click Add More Services to
add your App Engine account


On Sat, Jun 18, 2011 at 2:30 PM, Steve  wrote:
> I like the idea of switching some settings so I can use my original account
> with my new domain.  It seems better than moving my code and data to the new
> account. It is a royal pain switching between two Google accounts and it
> would be nice to have just one.
>
> How do I remove Google Sites and add App Engine specifying my appengine id?
>
>
> --
> 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/-/DvYHK377SCUJ.
> 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] two accounts

2011-06-18 Thread Stephen Johnson
If you set up your domain through Google Apps then remove Google Sites
from the account where you set up your domain name and add App Engine
to that account specifying your appengine id. I think that if you used
Google Apps to add your domain then your DNS settings should be fine,
but I can't remember off the top of my head if anything has to be
changed there but I don't think so. It may take a while for the Google
Sites to stop serving traffic and for your appspot.com to start
serving that traffic. This is at least what I've done and it's worked
for me. I hope I haven't forgotten any steps.

Stephen

On Fri, Jun 17, 2011 at 4:10 PM, Steve  wrote:
> I created a Google App Engine application and deployed it at appspot.com.
> Then I decided to buy a domain name through Google Apps and use that with
> the site.  I cannot figure out how to use the new domain with the site.  I
> think my problem is that I now have two Google accounts, the original one
> with my appspot application and a new one with my new domain.  Any ideas on
> how to fix this?
>
> --
> 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/-/hwPF-2QsW9wJ.
> 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] can i load web form and then submit it, after showing only form's captcha on screen?

2011-06-18 Thread Stephen Johnson
You can do it several ways. The best way IMHO is  to show the form and
the captcha together and they fill in the form fields and the captcha
and submit both together. Or as your question implies, you want a
two-step process for some reason where they fill in the form and then
you show a different page with just the captcha. Not sure why you want
to do this, but in this scenario when they submit the form, you can
send the captcha page back to them with the form fields as hidden
fields. Then when captcha is submitted, then both form fields and
captcha info is submitted together. Another alternative is to store
the submitted form values into the session object on first submit,
then show captcha page and when they have submitted captcha
successfully, you can process the form data.

Stephen

On Wed, Jun 15, 2011 at 8:30 PM, Arvind Chari  wrote:
> Hello
>
> I want to automate the submission of repetitive data to multiple web
> forms... I already have with me details of all fields that have to be filled
> in on a web form. What I want to do is, initially ask the user for values of
> various fields, and at time of submission show only captcha of form on
> screen. Now, when end user fills in the captcha, then the form (along with
> other fields filled in by the application) is submitted successfully.
>
> Can i do this in Google App Engine (either Java or Python or any of the
> other supported languages)?
>
> Regards,
> Arvind.
>
> --
> 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/-/ftxQm2I3P5EJ.
> 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: open source pdf engine for GAE

2011-05-20 Thread Stephen Johnson
Sorry Vik, I'm out of ideas. If it were me I'd create a small local
test app that used your pdf code to generate and save the pdf file and
see if is is valid, then I'd upload it to GAE and see if I can send
it.

On Fri, May 20, 2011 at 10:42 AM, Vik  wrote:
> any further advise on this please?
> Thankx and Regards
>
> Vik
> Founder
> http://www.sakshum.org
> http://blog.sakshum.org
>
>
> On Wed, May 18, 2011 at 12:03 PM, Vik  wrote:
>>
>> Hie
>> Even below code fails for the same exception
>>      ByteArrayOutputStream out = new ByteArrayOutputStream();
>> PDF pdf;
>> try {
>> pdf = new PDF(out);
>> log.info("#1");
>>         pdf.setTitle("Using TextColumn and Paragraph classes");
>>         pdf.setSubject("Examples");
>>         pdf.setAuthor("Innovatics Inc.");
>>         log.info("#2");
>>
>>         Page page = new Page(pdf, Letter.PORTRAIT);
>>          pdf.flush();
>>           Multipart mp = new MimeMultipart();
>>             MimeBodyPart htmlPart = new MimeBodyPart();
>>             htmlPart.setFileName("whatever.pdf");
>>             log.info("#7");
>>             htmlPart.setContent(out.toByteArray(), "application/pdf");
>>             mp.addBodyPart(htmlPart);
>>             log.info("#8");
>>             Properties props = new Properties();
>>             Session session = Session.getDefaultInstance(props, null);
>>             Message msg = new MimeMessage(session);
>>             msg.setContent(mp);
>>             msg.setFrom(new InternetAddress("vik@gmail.com"));
>>             msg.addRecipient(Message.RecipientType.TO,
>>                         new InternetAddress("vik@gmail.com"));
>>
>>
>>             msg.setSubject("testing PDF system");
>>             Transport.send(msg);
>> Thankx and Regards
>>
>> Vik
>> Founder
>> http://www.sakshum.org
>> http://blog.sakshum.org
>>
>>
>> On Wed, May 18, 2011 at 10:25 AM, Stephen Johnson 
>> wrote:
>>>
>>> Try not adding the image or the font. Just try to get as simple a PDF
>>> working as possible.
>>>
>>> On Tue, May 17, 2011 at 9:47 PM, Vik  wrote:
>>> > Hie
>>> > I am doing exact same. Here is the code:
>>> > log.info("start of PDFTest:");
>>> >     //OutputStream out = resp.getOutputStream();
>>> >     ByteArrayOutputStream out = new ByteArrayOutputStream();
>>> > PDF pdf;
>>> > try {
>>> > pdf = new PDF(out);
>>> > log.info("#1");
>>> >         pdf.setTitle("Using TextColumn and Paragraph classes");
>>> >         pdf.setSubject("Examples");
>>> >         pdf.setAuthor("Innovatics Inc.");
>>> >         log.info("#2");
>>> >         String fileName = "images/share_facebook.png";
>>> >         Image image1 = new Image(pdf, new BufferedInputStream(
>>> >                 getClass().getResourceAsStream(fileName)),
>>> > ImageType.PNG);
>>> >         log.info("#3");
>>> >         Font f1 = new Font(pdf,
>>> >                 new BufferedInputStream(getClass().getResourceAsStream(
>>> >                         "fonts/DroidFonts/DroidSerif-Regular.otf")),
>>> >                 CodePage.UNICODE,
>>> >                 Embed.YES);
>>> >
>>> >         Page page = new Page(pdf, Letter.PORTRAIT);
>>> >         f1.setSize(10);
>>> >         image1.setPosition(90, 35);
>>> >         image1.scaleBy(0.75);
>>> >         image1.drawOn(page);
>>> >         TextColumn column = new TextColumn(f1);
>>> >         column.setLineBetweenParagraphs(false);
>>> >         Paragraph p1 = new Paragraph();
>>> >         p1.setAlignment(Align.CENTER);
>>> >         p1.add(new TextLine(f1, "Switzerland"));
>>> >         Paragraph p2 = new Paragraph();
>>> >         p2.add(new TextLine(f1, "Introduction"));
>>> >
>>> >         Paragraph p4 = new Paragraph();
>>> >         p4.add(new TextLine(f1, "Economy"));
>>> >         Paragraph p5 = new Paragraph();
>>> >         p5.setAlignment(Align.JUSTIFY);
>>> >         text = new TextLine(f1);
>>> >
>>> >

Re: [appengine-java] Re: open source pdf engine for GAE

2011-05-17 Thread Stephen Johnson
Try not adding the image or the font. Just try to get as simple a PDF
working as possible.

On Tue, May 17, 2011 at 9:47 PM, Vik  wrote:
> Hie
> I am doing exact same. Here is the code:
> log.info("start of PDFTest:");
>     //OutputStream out = resp.getOutputStream();
>     ByteArrayOutputStream out = new ByteArrayOutputStream();
> PDF pdf;
> try {
> pdf = new PDF(out);
> log.info("#1");
>         pdf.setTitle("Using TextColumn and Paragraph classes");
>         pdf.setSubject("Examples");
>         pdf.setAuthor("Innovatics Inc.");
>         log.info("#2");
>         String fileName = "images/share_facebook.png";
>         Image image1 = new Image(pdf, new BufferedInputStream(
>                 getClass().getResourceAsStream(fileName)), ImageType.PNG);
>         log.info("#3");
>         Font f1 = new Font(pdf,
>                 new BufferedInputStream(getClass().getResourceAsStream(
>                         "fonts/DroidFonts/DroidSerif-Regular.otf")),
>                 CodePage.UNICODE,
>                 Embed.YES);
>
>         Page page = new Page(pdf, Letter.PORTRAIT);
>         f1.setSize(10);
>         image1.setPosition(90, 35);
>         image1.scaleBy(0.75);
>         image1.drawOn(page);
>         TextColumn column = new TextColumn(f1);
>         column.setLineBetweenParagraphs(false);
>         Paragraph p1 = new Paragraph();
>         p1.setAlignment(Align.CENTER);
>         p1.add(new TextLine(f1, "Switzerland"));
>         Paragraph p2 = new Paragraph();
>         p2.add(new TextLine(f1, "Introduction"));
>
>         Paragraph p4 = new Paragraph();
>         p4.add(new TextLine(f1, "Economy"));
>         Paragraph p5 = new Paragraph();
>         p5.setAlignment(Align.JUSTIFY);
>         text = new TextLine(f1);
>
>         column.setSize(470, 100);
>         Point point1 = new Point(90, 300);  // TextColumn start point
>         Point point2 = column.sizeOn(page); // TextColumn end point
>         Line line = new Line(
>                 point1.getX(),
>                 point1.getY() + point2.getY(),
>                 point1.getX() + point2.getX(),
>                 point1.getY() + point2.getY());
>         line.drawOn(page);
>         column.drawOn(page);
>
>         pdf.flush();
>
>
>           Multipart mp = new MimeMultipart();
>             MimeBodyPart htmlPart = new MimeBodyPart();
>             htmlPart.setFileName("whatever.pdf");
>             log.info("#7");
>             htmlPart.setContent(out.toByteArray(), "application/pdf");
>             mp.addBodyPart(htmlPart);
>             log.info("#8");
>             Properties props = new Properties();
>             Session session = Session.getDefaultInstance(props, null);
>             Message msg = new MimeMessage(session);
>             msg.setContent(mp);
>             msg.setFrom(new InternetAddress("vik@gmail.com"));
>             msg.addRecipient(Message.RecipientType.TO,
>                         new InternetAddress("vik@gmail.com"));
>
>
>             msg.setSubject("testing PDF system");
>             Transport.send(msg);
>          System.out.println("Sucessfully Sent mail to All Users");
> Thankx and Regards
>
> Vik
> Founder
> http://www.sakshum.org
> http://blog.sakshum.org
>
>
> On Tue, May 17, 2011 at 9:30 PM, Stephen Johnson 
> wrote:
>>
>> Vik,
>> Post your code where you're creating the ByteArrayOutputStream and
>> creating the PDF with it. It'll be more helpful then what you've
>> posted. I'm a little concerned you still don't have this part correct
>> since you're still using "out" as a variable name. You're code should
>> be similar to:
>>
>> ByteArrayOutputStream baos = new ByteArrayOutputStream();
>>
>> /* this part is from your previous email. I don't use PDFJet so I
>> can't validate this code for you */
>> PDF pdf = new PDF(baos);
>> some actual writing.
>>  pdf.flush();
>>
>> /* taken from docs */
>>  Properties props = new Properties();
>>  Session session = Session.getDefaultInstance(props, null);
>>
>>  String msgBody = "...";
>>
>>  try {
>>             Message msg = new MimeMessage(session);
>>             msg.setFrom(new InternetAddress("ad...@example.com",
>> "Example.com Admin"));
>>             msg.addRecipient(Message.RecipientType.TO,
>>                              new

Re: [appengine-java] Simple Google App Engine Datastore operation taking too long: causing DeadlineExceededException/DatastoreTimeoutException

2011-05-17 Thread Stephen Johnson
I use JDO but I don't use the built in relationship handling. I manage
my own relationships and use JDO just for the property/entity mapping
part of it.  It seems to make life a lot simpler when trying to get
around these types of situations. If you can make the Orders not be
children of the Account class and manage your own relationships that
will make your life a lot easier in the long run even if it's more
work initially and your code much faster and efficient, IMHO. Also,
you might want to take a look Objectify. Others here seem to like it a
lot.

On Tue, May 17, 2011 at 1:38 AM, Ashley Schroder
 wrote:
> Quick update: The query interface works. I was able to run the query across
> all the entities and start iterating over them (so it must lazy load when
> iterating). However I could not do a size() on the collection returned, so
> there must be too many items in the collection now.
>
> I can work around the now redundant relationship of account.getOrders() by
> querying. Now to figure out the best way to add a child object without
> accessing the parent's collection of children.
>
> Maybe I should switch to JDO+MySQL before I get in too deep - is this a
> completely wrong application of GAE?
>
> --
> 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.
>

-- 
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: open source pdf engine for GAE

2011-05-17 Thread Stephen Johnson
Vik,
Post your code where you're creating the ByteArrayOutputStream and
creating the PDF with it. It'll be more helpful then what you've
posted. I'm a little concerned you still don't have this part correct
since you're still using "out" as a variable name. You're code should
be similar to:

ByteArrayOutputStream baos = new ByteArrayOutputStream();

/* this part is from your previous email. I don't use PDFJet so I
can't validate this code for you */
PDF pdf = new PDF(baos);
some actual writing.
 pdf.flush();

/* taken from docs */
 Properties props = new Properties();
 Session session = Session.getDefaultInstance(props, null);

 String msgBody = "...";

  try {
            Message msg = new MimeMessage(session);
            msg.setFrom(new InternetAddress("ad...@example.com",
"Example.com Admin"));
            msg.addRecipient(Message.RecipientType.TO,
                             new InternetAddress("u...@example.com",
"Mr. User"));
            msg.setSubject("Your Example.com account has been activated");
            msg.setText(msgBody);

       Multipart mp = new MimeMultipart();

  // Get the PDF data
  byte[] attachmentData = baos.toByteArray();

          MimeBodyPart attachment = new MimeBodyPart();
          attachment.setFileName("manual.pdf");
          attachment.setContent(attachmentData, "application/pdf");
          mp.addBodyPart(attachment);

          message.setContent(mp);
          Transport.send(msg);

   } catch (AddressException e) {
            // ..
   } catch (MessagingException e) {
            // ...
    }


On Tue, May 17, 2011 at 6:19 AM, Vik  wrote:
>
> I think the problem is not with pdfJet it about sending pdf as an attachment 
> via mail api on app engine
> Thankx and Regards
>
> Vik
> Founder
> http://www.sakshum.org
> http://blog.sakshum.org
>
>
> On Tue, May 17, 2011 at 6:45 PM, Nichole  wrote:
>>
>> You could try iText:
>>
>> http://groups.google.com/group/google-appengine-java/browse_thread/thread/7dfdf19cfdd410d6/ee7024dd040ba6eb?lnk=gst&q=pdf#ee7024dd040ba6eb
>>
>>
>> http://code.google.com/appengine/docs/java/mail/usingjavamail.html
>>
>>
>> On May 16, 7:11 pm, Vik  wrote:
>> >    Hie
>> >
>> > Trying to send a pdf created using pdfJet throws the exception
>> >
>> > class javax.mail.SendFailedException:Send failure
>> > (javax.mail.MessagingException: Converting attachment data failed)
>> >
>> > The code is like:
>> >
>> >          MimeBodyPart htmlPart = new MimeBodyPart();
>> >             htmlPart.setFileName("whatever.pdf");
>> >             htmlPart.setContent(out.toByteArray(), "application/pdf");
>> >             mp.addBodyPart(htmlPart);
>> >
>> > logged 
>> > issuehttp://code.google.com/p/googleappengine/issues/list?cursor=1764&upda...
>> > does not seems to help.
>> >
>> > Please advise.
>> >
>> > Thankx and Regards
>> >
>> > Vik
>> > Founderhttp://www.sakshum.orghttp://blog.sakshum.org
>> >
>> >
>> >
>> > On Sun, May 15, 2011 at 8:26 PM, Erick Fleming  wrote:
>> > > You can use ByteArrayOutputStream 
>> > > [1],
>> > > then attach that to your mail message.  If you are using low-level api, 
>> > > then
>> > > Attrachment 
>> > > [2]
>> > >  has
>> > > a constructor for this.
>> >
>> > > [1]
>> > >http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputS...
>> > > [2]
>> > >http://code.google.com/appengine/docs/java/javadoc/com/google/appengi...
>> >
>> > > On Sun, May 15, 2011 at 9:16 AM, Vik  wrote:
>> >
>> > >>  Hie
>> >
>> > >> Just a little question. I am using this pdfJet thing.
>> > >> The requirement for us is to create a pdf and then mail it to a user.
>> >
>> > >> So i am done with pdf creation part and at then end i have the code 
>> > >> like:
>> >
>> > >> OutputStream out = resp.getOutputStream();
>> > >> PDF pdf = new PDF(out);
>> >
>> > >> some actual writing.
>> >
>> > >>  pdf.flush();
>> > >>  out.close();
>> >
>> > >> Now the question i have is after this step how do i actually get handle 
>> > >> to
>> > >> the created pdf above and attach it to an email ?
>> >
>> > >> Thankx and Regards
>> >
>> > >> Vik
>> > >> Founder
>> > >>http://www.sakshum.org
>> > >>http://blog.sakshum.org
>> >
>> > >> On Tue, Apr 20, 2010 at 1:52 PM, Patou 
>> > >> wrote:
>> >
>> > >>> Hello
>> >
>> > >>> In App Engine, You can't write a file to the file system. Otherwise
>> > >>> the save method can't be used in GAE.
>> > >>> Use this code to send the pdf to the navigator :
>> >
>> > >>> pdf.wrap();
>> >
>> > >>> String fileName = "Example_03.pdf";
>> >
>> > >>> resp.setContentType("application/pdf");
>> > >>> resp.setHeader("Content-Disposition", "attachment; filename=\"" +
>> > >>> fileName + "\"");
>> > >>> ServletOutputStream outs = resp.getOutputStream();
>> > >>> pdf.getData().writeTo(outs);
>> >
>> > >>> Or to save to the datastore :
>> > >>> new Blob(pdf.getData().toB

Re: Vs: Re: Vs: Re: Vs: Re: [appengine-java] Should JDO use be synchronized in threadsafe=true application?

2011-05-16 Thread Stephen Johnson
Ah, I missed the point about it being tasks and didn't realize the
threadsafe only applied to user requests and not  tasks. If indeed that was
the case.

On Mon, May 16, 2011 at 10:44 PM, Juha K  wrote:

> The datanucleus issue has a comment "Then, when my tasks run in parallel,
> initialisation has already been done and the problem doesn't appear any
> more.", so before the threadsafe property, only tasks were run in parallel.
> Probably that's why I didn't see this error before, I didn't have tasks
> doing db access.
>
> --
> 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.
>

-- 
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] Simple Google App Engine Datastore operation taking too long: causing DeadlineExceededException/DatastoreTimeoutException

2011-05-16 Thread Stephen Johnson
Hi Ashley,
This isn't the way I would go about structuring this if I'm understanding
the way you've set up your classes. There are a few issues right away that I
see. For one, if you have a couple thousand Order children under the Account
parent and you call getOrders() in your addOrder() method then you're
pulling all that data from the datastore in to the application just to add a
new order to the Account. So this will keep getting slower and slower as you
add Orders to the Account and it looks like you've now reached the max, so
that might be why it's worked up until now. Also, you are reducing the
amount of concurrency that can take place on your Account class so if you
are trying to have multiple orders that could be added to an Account
simultaneously you're going to run in to contention issues.
Stephen

On Mon, May 16, 2011 at 10:30 PM, Ashley Schroder  wrote:

> I have a fairly simple App Engine Java app that has Accounts, Orders and
> OrderItems - nothing crazy.
>
> Just in the last 12 hours I have started getting exceptions thrown out of
> some fairly straight forward code that adds orders to accounts and then
> saves them.
>
> I created a trivial testing servlet to replicate the issue, it looks like
> this:
>
> public void doGet(HttpServletRequest req, HttpServletResponse resp)
> throws IOException {
>
> String key = req.getParameter("key");
>
> PersistenceManager pm = PMF.get().getPersistenceManager();
> Account account = pm.getObjectById(Account.class,
> KeyFactory.stringToKey(key));
>
> Order order = new Order();
> order.setExternalOrderID("ASHLEY-TESTING");
>
> Item item = new Item();
> item.setSku("ASHLEY-WIDGET-A");
> item.setQuantity(2);
> Item item2 = new Item();
> item2.setSku("ASHLEY-WIDGET-B");
> item2.setQuantity(2);
>
> order.addItem(item);
> order.addItem(item2);
>
> account.addOrder(order);
> order.setAccount(account);
> pm.makePersistent(order);
> pm.close();
> }
>
> addOrder is implemented as a pretty standard lazy init:
>
> public void addOrder(Order order) {
> if (getOrders() == null) {
> setOrders(new ArrayList());
> }
> getOrders().add(order);
> }
>
> The relevant parts of the entities:
>
> @PersistenceCapable
>
> public class Account {
>
> //...
>
> @Persistent(mappedBy="account")
> @javax.jdo.annotations.Order(extensions =
> @Extension(vendorName="datanucleus", key="list-ordering", value="startDate
> desc"))
> private List stats;
>
> //...
>
> }
>
> and the Order has an account field:
>
> @Persistent
> private Account account;
>
>
> This code is failing on the `account.addOrder()` line. If it is run
> directly in the browser it fails with DeadlineExceededException (after 30s)
> and if I enqueue it to run via a task queue it fails with
> DatastoreTimeoutException after a minute or two. It uses a truck load of CPU
> time in the process.
>
> I would estimate that the Account would have fewer than 2000 Orders
> children under it, each Order with 1-3 OrderItem children.
>
> My question is, why would this all of a sudden start failing it has worked
> to add the 1000's of orders already in there. And have I missed something
> vital? do I need to add indexes? could the data store really be this slow?
> Am I abusing it, should I not have children relationships with this many
> children - perhaps a set of keys would be a better approach?
>
>  --
> 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.
>

-- 
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: Vs: Re: Vs: Re: [appengine-java] Should JDO use be synchronized in threadsafe=true application?

2011-05-16 Thread Stephen Johnson
Thinking out loud...What's strange about that issue (not this current one
but the one from the past) and the supposed solution is that until just
recently with the introduction of the threadsafe property supposedly only
one request could executing at a time and you can't create your own
additional threads, so how could there have been a race condition before??

On Mon, May 16, 2011 at 10:16 PM, Juha K  wrote:

> Based on your experience it seems to be that the problem is in the access
> to PersistenceManagerFactory.getPersistenceManager()? If your PMF-class
> fixes the problem, then it seems that call to getPersistenceManager() should
> be synchronized in multithreaded apps.
> Can anyone confirm this?
>
> I found this issue:
> http://code.google.com/p/datanucleus-appengine/issues/detail?id=203(Unexpected
>  UnsupportedOperationException when calling getObjectById()) and
> used the workaround proposed there (doing a query in the start up). So far
> it seems to be working ok.
>
>
>
>
> lauantaina 14. toukokuuta 2011 8.26.02 UTC+3 Aaron Shepherd kirjoitti:
>>
>> I'm using this modified PMF class now and it seems to fix this
>> problem, with the caveat that I haven't done any heavy load testing
>> yet.
>>
>> public final class PMF
>> {
>> private static final PersistenceManagerFactory pmfInstance =
>> JDOHelper.getPersistenceManagerFactory("transactions-
>> optional");
>>
>> private PMF()
>> {
>> }
>>
>> public synchronized static PersistenceManagerFactory get()
>> {
>> return pmfInstance;
>> }
>>
>> public synchronized static PersistenceManager
>> getPersistenceManagerInstance()
>> {
>> return pmfInstance.getPersistenceManager();
>> }
>> }
>>
>> Aaron Shepherd
>> OnFast.com
>>
>>  --
> 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.
>

-- 
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] Map Reduce

2011-05-16 Thread Stephen Johnson
I have two questions on the Java version of mapreduce since the docs seem
pretty sparse.
1.) Is it possible to use mapreduce over a namespace and if so, how do you
configure it?
2.) Is only inputing entity keys and not the entire values supported on the
Java version and if so, how do I configure that as well?
Thanks,
Stephen

-- 
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: open source pdf engine for GAE

2011-05-15 Thread Stephen Johnson
Great! Glad to hear you got it working.

On Sun, May 15, 2011 at 7:18 PM, Vik  wrote:

> Thanks a lot Stephen ! I could complete the code and testing now. Your
> great support will really help our cause to serve the needy.
>
>
>
> Thankx and Regards
>
> Vik
> Founder
> http://www.sakshum.org
> http://blog.sakshum.org
>
>
> On Sun, May 15, 2011 at 11:15 PM, Stephen Johnson 
> wrote:
>
>> The code snippet is from the link I provided. Replace the attachmentData
>> in the code snippet with the byte[] array returned from toByteArray(). You
>> do not convert the ServletResponseOutputStream to a ByteArrayOutputStream.
>> Create your own ByteArrayOuputStream. You want to send the PDF as an
>> attachment to an email not as the response to your web request which is what
>> you are doing when you use ServletResponseOutputStream.
>>
>> On Sun, May 15, 2011 at 10:23 AM, Vik  wrote:
>>
>>> Thanks 2 futher things
>>>
>>> 1. What is the link between toByteArray() and attachment part of the
>>> code? I mean i do not see the byteArray being used anywhere in the code you
>>> provided.
>>>
>>> 2. Servlet response is giving ServletResponseOutputStream and on googling
>>> i did not find a way to convert it to ByteArrayOutStream, Any idea on this
>>> part?
>>>
>>> Please advise
>>>
>>>
>>> Thankx and Regards
>>>
>>> Vik
>>> Founder
>>> http://www.sakshum.org
>>> http://blog.sakshum.org
>>>
>>>
>>> On Sun, May 15, 2011 at 10:16 PM, Stephen Johnson <
>>> onepagewo...@gmail.com> wrote:
>>>
>>>> Hi Vik,
>>>> Call toByteArray() method on ByteArrayOutputStream when finished with
>>>> creating PDF and then
>>>>
>>>> MimeBodyPart attachment = new MimeBodyPart();
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> attachment.setFileName("whatever.pdf");
>>>> attachment.setContent(attachmentData, "application/pdf");
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> mp.addBodyPart(attachment);
>>>>
>>>> See http://code.google.com/appengine/docs/java/mail/usingjavamail.html
>>>>
>>>> Stephen
>>>>
>>>> On Sun, May 15, 2011 at 9:34 AM, Vik  wrote:
>>>>
>>>>> Hie Stephon
>>>>>
>>>>> Still I am not sure on the part that ultimately how will i use this
>>>>> stream to attach the generated pdf as an attachment in the email. Please
>>>>> advise
>>>>>
>>>>> Thankx and Regards
>>>>>
>>>>> Vik
>>>>> Founder
>>>>> http://www.sakshum.org
>>>>> http://blog.sakshum.org
>>>>>
>>>>>
>>>>> On Sun, May 15, 2011 at 9:56 PM, Stephen Johnson <
>>>>> onepagewo...@gmail.com> wrote:
>>>>>
>>>>>> You're writing the PDF as your web page output. Use a
>>>>>> ByteArrayOutputStream instead.
>>>>>>
>>>>>> On Sun, May 15, 2011 at 7:16 AM, Vik  wrote:
>>>>>>
>>>>>>> Hie
>>>>>>>
>>>>>>> Just a little question. I am using this pdfJet thing.
>>>>>>> The requirement for us is to create a pdf and then mail it to a user.
>>>>>>>
>>>>>>> So i am done with pdf creation part and at then end i have the code
>>>>>>> like:
>>>>>>>
>>>>>>> OutputStream out = resp.getOutputStream();
>>>>>>> PDF pdf = new PDF(out);
>>>>>>>
>>>>>>> some actual writing.
>>>>>>>
>>>>>>>  pdf.flush();
>>>>>>>  out.close();
>>>>>>>
>>>>>>> Now the question i have is after this step how do i actually get
>>>>>>> handle to the created pdf above and attach it to an email ?
>>>>>>>
>>>>>>>
>>>>>>> Thankx and Regards
>>>>>>>
>>>>>>> Vik
>>>>>>> Founder
>>>>>>> http://www.sakshum.org
>>>>>>> http://blog.sakshum.org
>>>>>>>
>>>>>>

Re: [appengine-java] Re: open source pdf engine for GAE

2011-05-15 Thread Stephen Johnson
The code snippet is from the link I provided. Replace the attachmentData in
the code snippet with the byte[] array returned from toByteArray(). You do
not convert the ServletResponseOutputStream to a ByteArrayOutputStream.
Create your own ByteArrayOuputStream. You want to send the PDF as an
attachment to an email not as the response to your web request which is what
you are doing when you use ServletResponseOutputStream.

On Sun, May 15, 2011 at 10:23 AM, Vik  wrote:

> Thanks 2 futher things
>
> 1. What is the link between toByteArray() and attachment part of the code?
> I mean i do not see the byteArray being used anywhere in the code you
> provided.
>
> 2. Servlet response is giving ServletResponseOutputStream and on googling i
> did not find a way to convert it to ByteArrayOutStream, Any idea on this
> part?
>
> Please advise
>
>
> Thankx and Regards
>
> Vik
> Founder
> http://www.sakshum.org
> http://blog.sakshum.org
>
>
> On Sun, May 15, 2011 at 10:16 PM, Stephen Johnson 
> wrote:
>
>> Hi Vik,
>> Call toByteArray() method on ByteArrayOutputStream when finished with
>> creating PDF and then
>>
>> MimeBodyPart attachment = new MimeBodyPart();
>>
>>
>>
>> attachment.setFileName("whatever.pdf");
>> attachment.setContent(attachmentData, "application/pdf");
>>
>>
>>
>> mp.addBodyPart(attachment);
>>
>> See http://code.google.com/appengine/docs/java/mail/usingjavamail.html
>>
>> Stephen
>>
>> On Sun, May 15, 2011 at 9:34 AM, Vik  wrote:
>>
>>> Hie Stephon
>>>
>>> Still I am not sure on the part that ultimately how will i use this
>>> stream to attach the generated pdf as an attachment in the email. Please
>>> advise
>>>
>>> Thankx and Regards
>>>
>>> Vik
>>> Founder
>>> http://www.sakshum.org
>>> http://blog.sakshum.org
>>>
>>>
>>> On Sun, May 15, 2011 at 9:56 PM, Stephen Johnson >> > wrote:
>>>
>>>> You're writing the PDF as your web page output. Use a
>>>> ByteArrayOutputStream instead.
>>>>
>>>> On Sun, May 15, 2011 at 7:16 AM, Vik  wrote:
>>>>
>>>>> Hie
>>>>>
>>>>> Just a little question. I am using this pdfJet thing.
>>>>> The requirement for us is to create a pdf and then mail it to a user.
>>>>>
>>>>> So i am done with pdf creation part and at then end i have the code
>>>>> like:
>>>>>
>>>>> OutputStream out = resp.getOutputStream();
>>>>> PDF pdf = new PDF(out);
>>>>>
>>>>> some actual writing.
>>>>>
>>>>>  pdf.flush();
>>>>>  out.close();
>>>>>
>>>>> Now the question i have is after this step how do i actually get handle
>>>>> to the created pdf above and attach it to an email ?
>>>>>
>>>>>
>>>>> Thankx and Regards
>>>>>
>>>>> Vik
>>>>> Founder
>>>>> http://www.sakshum.org
>>>>> http://blog.sakshum.org
>>>>>
>>>>>
>>>>> On Tue, Apr 20, 2010 at 1:52 PM, Patou <
>>>>> patou.de.saint.ste...@gmail.com> wrote:
>>>>>
>>>>>> Hello
>>>>>>
>>>>>> In App Engine, You can't write a file to the file system. Otherwise
>>>>>> the save method can't be used in GAE.
>>>>>> Use this code to send the pdf to the navigator :
>>>>>>
>>>>>> pdf.wrap();
>>>>>>
>>>>>> String fileName = "Example_03.pdf";
>>>>>>
>>>>>> resp.setContentType("application/pdf");
>>>>>> resp.setHeader("Content-Disposition", "attachment; filename=\"" +
>>>>>> fileName + "\"");
>>>>>> ServletOutputStream outs = resp.getOutputStream();
>>>>>> pdf.getData().writeTo(outs);
>>>>>>
>>>>>> Or to save to the datastore :
>>>>>> new Blob(pdf.getData().toByteArray());
>>>>>>
>>>>>> Bests Regards
>>>>>>
>>>>>> Patrice
>>>>>>
>>>>>> On Apr 20, 4:18 am, jeno  wrote:
>>>>>> > Hi François ,
>>>>>> >
>&

Re: [appengine-java] Re: open source pdf engine for GAE

2011-05-15 Thread Stephen Johnson
Hi Vik,
Call toByteArray() method on ByteArrayOutputStream when finished with
creating PDF and then

MimeBodyPart attachment = new MimeBodyPart();
attachment.setFileName("whatever.pdf");
attachment.setContent(attachmentData, "application/pdf");
mp.addBodyPart(attachment);

See http://code.google.com/appengine/docs/java/mail/usingjavamail.html

Stephen

On Sun, May 15, 2011 at 9:34 AM, Vik  wrote:

> Hie Stephon
>
> Still I am not sure on the part that ultimately how will i use this stream
> to attach the generated pdf as an attachment in the email. Please advise
>
> Thankx and Regards
>
> Vik
> Founder
> http://www.sakshum.org
> http://blog.sakshum.org
>
>
> On Sun, May 15, 2011 at 9:56 PM, Stephen Johnson 
> wrote:
>
>> You're writing the PDF as your web page output. Use a
>> ByteArrayOutputStream instead.
>>
>> On Sun, May 15, 2011 at 7:16 AM, Vik  wrote:
>>
>>> Hie
>>>
>>> Just a little question. I am using this pdfJet thing.
>>> The requirement for us is to create a pdf and then mail it to a user.
>>>
>>> So i am done with pdf creation part and at then end i have the code
>>> like:
>>>
>>> OutputStream out = resp.getOutputStream();
>>> PDF pdf = new PDF(out);
>>>
>>> some actual writing.
>>>
>>>  pdf.flush();
>>>  out.close();
>>>
>>> Now the question i have is after this step how do i actually get handle
>>> to the created pdf above and attach it to an email ?
>>>
>>>
>>> Thankx and Regards
>>>
>>> Vik
>>> Founder
>>> http://www.sakshum.org
>>> http://blog.sakshum.org
>>>
>>>
>>> On Tue, Apr 20, 2010 at 1:52 PM, Patou 
>>> wrote:
>>>
>>>> Hello
>>>>
>>>> In App Engine, You can't write a file to the file system. Otherwise
>>>> the save method can't be used in GAE.
>>>> Use this code to send the pdf to the navigator :
>>>>
>>>> pdf.wrap();
>>>>
>>>> String fileName = "Example_03.pdf";
>>>>
>>>> resp.setContentType("application/pdf");
>>>> resp.setHeader("Content-Disposition", "attachment; filename=\"" +
>>>> fileName + "\"");
>>>> ServletOutputStream outs = resp.getOutputStream();
>>>> pdf.getData().writeTo(outs);
>>>>
>>>> Or to save to the datastore :
>>>> new Blob(pdf.getData().toByteArray());
>>>>
>>>> Bests Regards
>>>>
>>>> Patrice
>>>>
>>>> On Apr 20, 4:18 am, jeno  wrote:
>>>> > Hi François ,
>>>> >
>>>> > Thanks for your help. I have used PDFjet (PDFJet.jar  version 2.72)
>>>> > PDF class missing save method
>>>> > So i cant call pdf.save("d.pdf") method.
>>>> >
>>>> > Cheers
>>>> > jeno
>>>> >
>>>> > On Apr 19, 6:48 pm, François Masurel  wrote:
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > > Hi Jeno,
>>>> >
>>>> > > You can try the PDFjet Open Source Edition :
>>>> http://pdfjet.com/os/edition.html
>>>> >
>>>> > > François
>>>> >
>>>> > > On 19 avr, 01:55, jeno  wrote:
>>>> >
>>>> > > > Hi Guys,
>>>> >
>>>> > > > Anyone know open source java  pdf engine for GAE.
>>>> >
>>>> > > > Thanks
>>>> > > > Jeno
>>>> >
>>>> > > > --
>>>> > > > 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" gro

Re: [appengine-java] Re: how to transfer request to a different servlet ?

2011-05-15 Thread Stephen Johnson
You should be able to use the RequestDispatcher object to do what you want
but you'll have to have mappings in web.xml for each of the servlets your
forwarding to for instance MyGalleryApp would have mappings that all start
with /MyGalleryApp/ (or something similar) so GalleryServlet would map to
something like /MyGalleryApp/GalleryServlet (or something similar)

On Sun, May 15, 2011 at 7:51 AM, Prashant  wrote:web

> thanks a lot Ravi. i will read your article and give it a try 
>
>
> On Sun, May 15, 2011 at 8:20 PM, Ravi Sharma  wrote:
>
>> Using Spring MVC you could use it to solve the problem.
>> Basically you want different Controller for http://www.mainsite.com and
>> http://test.mainsite.com
>>
>> I have used it in one of my application. I write all the steps in a blog
>> here. I hope it will helpfull
>>
>>
>> http://techsravi.blogspot.com/2011/05/managing-multiple-domain-and-sub-domain.html
>>
>> thanks,
>> Ravi.
>>
>>
>>
>>
>>
>>
>> On Sun, May 15, 2011 at 2:43 PM, Brandon Donnelson <
>> branflake2...@gmail.com> wrote:
>>
>>> Do you mean: response.sendRedirect(url);
>>>
>>> Brandon Donnelson
>>> http://gwt-examples.googlecode.com
>>>
>>>  --
>>> 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.
>>>
>>
>>  --
>> 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.
>>
>
>  --
> 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.
>

-- 
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: open source pdf engine for GAE

2011-05-15 Thread Stephen Johnson
You're writing the PDF as your web page output. Use a ByteArrayOutputStream
instead.

On Sun, May 15, 2011 at 7:16 AM, Vik  wrote:

> Hie
>
> Just a little question. I am using this pdfJet thing.
> The requirement for us is to create a pdf and then mail it to a user.
>
> So i am done with pdf creation part and at then end i have the code like:
>
> OutputStream out = resp.getOutputStream();
> PDF pdf = new PDF(out);
>
> some actual writing.
>
>  pdf.flush();
>  out.close();
>
> Now the question i have is after this step how do i actually get handle to
> the created pdf above and attach it to an email ?
>
>
> Thankx and Regards
>
> Vik
> Founder
> http://www.sakshum.org
> http://blog.sakshum.org
>
>
> On Tue, Apr 20, 2010 at 1:52 PM, Patou wrote:
>
>> Hello
>>
>> In App Engine, You can't write a file to the file system. Otherwise
>> the save method can't be used in GAE.
>> Use this code to send the pdf to the navigator :
>>
>> pdf.wrap();
>>
>> String fileName = "Example_03.pdf";
>>
>> resp.setContentType("application/pdf");
>> resp.setHeader("Content-Disposition", "attachment; filename=\"" +
>> fileName + "\"");
>> ServletOutputStream outs = resp.getOutputStream();
>> pdf.getData().writeTo(outs);
>>
>> Or to save to the datastore :
>> new Blob(pdf.getData().toByteArray());
>>
>> Bests Regards
>>
>> Patrice
>>
>> On Apr 20, 4:18 am, jeno  wrote:
>> > Hi François ,
>> >
>> > Thanks for your help. I have used PDFjet (PDFJet.jar  version 2.72)
>> > PDF class missing save method
>> > So i cant call pdf.save("d.pdf") method.
>> >
>> > Cheers
>> > jeno
>> >
>> > On Apr 19, 6:48 pm, François Masurel  wrote:
>> >
>> >
>> >
>> >
>> >
>> > > Hi Jeno,
>> >
>> > > You can try the PDFjet Open Source Edition :
>> http://pdfjet.com/os/edition.html
>> >
>> > > François
>> >
>> > > On 19 avr, 01:55, jeno  wrote:
>> >
>> > > > Hi Guys,
>> >
>> > > > Anyone know open source java  pdf engine for GAE.
>> >
>> > > > Thanks
>> > > > Jeno
>> >
>> > > > --
>> > > > 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-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-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-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.
>

-- 
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] Object visibility between threads (running requests)

2011-05-13 Thread Stephen Johnson
There's no guarantee that both those threads are running on the same
instance. They can be on two different machines in two different data
centers.

On Fri, May 13, 2011 at 5:22 AM, Samuel Erdtman  wrote:

> Hi
> I have created an application that works fin in the eclipse app engine
> development environment but when I deploy it live I get some problems.
>
> My application depends on two request coming in simultaneously from two
> different browsers, both requests (threads) gets a map from servlet context
> then both gets an object from the map with the same key, i.e. the same
> object super.toString says so and .hashCode says so.
> The first thread updates the object and then waits for the other thread to
> signal that it has read the change and done some operations. But the second
> thread never sees the change made by the first thread, the result of this is
> thet the first thread hanging for 30 seconds and the throws an exception.
>
> If I let the first thread return the second thread sees the change, but
> then it is too late.
>
> The project is up and running but not working at
> http://sendnow4.appspot.com and the code (not the latest but a working
> version) can be found at http://code.google.com/p/sendnow/
>
> Best regards
> //Samuel
>
> --
> 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.
>

-- 
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] Vs: This application does not exist (app_id=u'application-id').

2011-05-13 Thread Stephen Johnson
Uh...check your spelling. You've got vph-epr and vph-erp

On Fri, May 13, 2011 at 1:55 AM, Juha K  wrote:

>
>
>
>  java.io.IOException: Error posting to URL:
>> https://appengine.google.com/api/appversion/create?app_id=vph-epr
>> &version=6&
>>
>> *But*, it's exist now. http://vph-erp.appspot.com
>>
>>
>>
>>  --
> 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.
>

-- 
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] This application does not exist (app_id=u'application-id').

2011-05-13 Thread Stephen Johnson
Uh...check your spelling. You've got vph-epr and vph-erp

On Fri, May 13, 2011 at 1:23 AM, horid121  wrote:

> Hello~
>
> When I deploy to Google App Engine, I received a error message.
>
> Error message:
>
> java.io.IOException: Error posting to URL:
> https://appengine.google.com/api/appversion/create?app_id=
> vph-epr&version=6&
>
> 404 Not Found
>
> This application does not exist (app_id=u'vph-epr').
>
>
> *But*, it's exist now. http://vph-erp.appspot.com
>
>
> SDK Version: GAE/J 1.4.3
>
>
> help 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.
>

-- 
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] Use Array as a query filter - possible?

2011-05-08 Thread Stephen Johnson
BTW, I'm assuming by Int Array you actually meant ArrayList or multi-valued
equivalent. Perhaps more info is needed for your particular situation and
why it seems you think it can't be done.

On Sun, May 8, 2011 at 5:41 PM, Stephen Johnson wrote:

> Yes it's possible. Make sure the property is indexed. From the data viewer
> you can perform the following query for example:
>
> select * from KIND where PROPERTY = NUMBER
>
> How you do it in code depends on if you're using JDO, Objectify, JPA,
> low-level API, etc.
>
>
> On Sun, May 8, 2011 at 5:14 PM, mscwd01  wrote:
>
>> Hey
>>
>> I have an entity with an Int Array and I would like to perform a query
>> on the contents of the Array. For example, I would like to return
>> entities which have a certain number within the array, I.e.
>>
>> Select * From MyObject Where numberArray contains 2
>>
>> Is this possible in any way, shape or form?
>>
>> 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.
>>
>>
>

-- 
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] Use Array as a query filter - possible?

2011-05-08 Thread Stephen Johnson
Yes it's possible. Make sure the property is indexed. From the data viewer
you can perform the following query for example:

select * from KIND where PROPERTY = NUMBER

How you do it in code depends on if you're using JDO, Objectify, JPA,
low-level API, etc.

On Sun, May 8, 2011 at 5:14 PM, mscwd01  wrote:

> Hey
>
> I have an entity with an Int Array and I would like to perform a query
> on the contents of the Array. For example, I would like to return
> entities which have a certain number within the array, I.e.
>
> Select * From MyObject Where numberArray contains 2
>
> Is this possible in any way, shape or form?
>
> 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.
>
>

-- 
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] xml parsing on GAE servers acts weird

2011-05-06 Thread Stephen Johnson
 You don't show what stream you're passing in so I can't comment on if that
might be an issue but you should try setting namespaceAware to true like
this to see if it will cause the DeferredDocumentImpl to not be used. I use
code like this and works fine for me.

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder docBuilder = dbf.newDocumentBuilder();
Document document = docBuilder.parse(inputStream);

Stephen


On Thu, May 5, 2011 at 9:16 AM, Richie  wrote:

> Hey guys,
>
> I created an app where a user can upload an xml, I display the nodes
> in a GWT table then the user selects the nodes he/she wants to
> download. Sounds easy, works perfectly in hosted mode.
>
> I use only the base xml parsing, no 3rd party jars in the project
> (aside from commons-fileupload-1.2.1.jar, commons-io-1.3.2.jar,
> gxt-2.2.3-gwt22.jar).
>
>
> Here's the code I use for parsing the XML:
>
> import org.w3c.dom.Document;
> import org.w3c.dom.Element;
> import org.w3c.dom.NodeList;
>
> ...
>
>public static Document getXml(InputStream stream) throws
> ParserConfigurationException, SAXException, IOException {
>
>DocumentBuilder parser =
> DocumentBuilderFactory.newInstance().newDocumentBuilder();
>// Parse xml data
>Document xml = parser.parse(stream);
>
>return xml;
>
>}
>
> It's working perfectly in hosted mode, but when I upload it to the
> appengine servers I get the following exception:
>
> javax.servlet.ServletException: java.lang.RuntimeException:
> java.lang.ClassNotFoundException:
> com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl
>at
>
> com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:
> 240)
>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
>
> com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:
> 76)
>at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>at
>
> com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:
> 135)
>at
> com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:
> 260)
>at com.google.apphosting.base.RuntimePb$EvaluationRuntime
> $2.handleRequest(RuntimePb.java:9669)
>at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:
> 439)
>at com.google.net.rpc.impl.Server$RpcTask.runInContext(Server.java:
> 573)
>at com.google.tracing.TraceContext$TraceContextRunnable
> $1.run(TraceContext.java:448)
>at com.google.tracing.TraceContext.runInContext(TraceContext.java:
> 688)
>at com.google.tracing.TraceContext
>
> $AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:
> 326)
>at com.google.tracing.TraceContext
> $AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:
> 318)
>at com.google.tracing.TraceContext
> $TraceContextRunnable.run(TraceContext.java:446)
>at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
> 1110)
>at java.util.concurrent.ThreadPoolExecutor
> $Worker.run(ThreadPoolExecutor.java:603)
>at java.lang.Thread.run(Thread.java:636)
> Caused by: java.lang.RuntimeException:
> java.lang.ClassNotFoundException:
> com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl
>at
>
> com.google.apphosting.runtime.jetty.SessionManager.deserialize(SessionManager.java:
> 421)
>at
>
> com.google.apphosting.runtime.jetty.SessionManager.createSessionFromEntity(SessionManager.java:
> 382)
>at
>
> com.google.apphosting.runtime.jetty.SessionManager.loadSession(SessionManager.java:
> 320)
>at
>
> com.google.apphosting.runtime.jetty.SessionManager.getSession(SessionManager.java:
> 288)
>at
>
> org.mortbay.jetty.servlet.AbstractSessionManager.getHttpSession(AbstractSessionManager.java:
> 237)
>at
>
> org.mortbay.jetty.servlet.SessionHandler.setRequestedId(SessionHandler.java:
> 246)
>at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> 136)
>at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
> 765)
>at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> 418)
>at
>
> com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:
> 238)
>... 19 more
> Caused by: java.lang.ClassNotFoundException:
> com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl
>at
>
> com.google.apphosting.runtime.security.UserClassLoader.loadClass(UserClassLoader.java:
> 445)
>

Re: [appengine-java] Re: pdfJet issue

2011-04-29 Thread Stephen Johnson
Maybe he used a ByteArrayOutputStream instead of FileOutputStream. The
getInstance method doesn't required a FileOutputStream just an OutputStream.


On Thu, Apr 28, 2011 at 11:05 PM, omer yaari  wrote:

> It does not work, GAE does not allow file stream to include the
> project
> this is a known issue, it cant be that you simply made itext work with
> gae without any adjustments
>
> On 29 אפריל, 05:57, nacho  wrote:
> > I'm using iText-5.0.6
> >
> > And the code hasn't any magic. Try with something like this:
> >
> > PdfWriter.getInstance(document, stream);
> >
> > PdfPTable tableHeader = new PdfPTable(2);
> > tableHeader.setWidthPercentage(80);
> >
> > try {
> > tableHeader.setWidths(new int[] { 1, 2 });
> > } catch (DocumentException e) {
> > e.printStackTrace();
> > }
> >
> > tableHeader.setSpacingAfter(10);
> > tableHeader.getDefaultCell().setPadding(4);
> >
> > tableHeader.getDefaultCell().setVerticalAlignment(Element.ALIGN_CENTER);
> >
> > PdfPCell cell;
> > BaseColor baseColor = new BaseColor(230, 230, 230);
> >
> > cell = new PdfPCell(new Phrase("Hello World!"));
> > cell.setColspan(2);
> > cell.setPadding(4);
> > cell.setBackgroundColor(baseColor);
> > cell.setHorizontalAlignment(Element.ALIGN_CENTER);
> > tableHeader.addCell(cell);
> >
> > document.open();
> > document.add(tableHeader);
> > document.close();
>
> --
> 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.
>
>

-- 
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: Datastore Stats for High Replication

2011-04-13 Thread Stephen Johnson
Hi Simon, Thanks for checking. I think they've been stuck for a while now. I
don't know if you've noticed this either (and I'm curious to see if anyone
else has or if it's just me) but I think this illustrates the difference
with how Master/Slave works and HR because on never saw it on Master/Slave
and others may want to check this out for illustrative purposes, but if you
have an entity kind with say a few entities, I can go and delete them
all using the datastore viewer and some of the time the page will return
with a few of them still showing up. If I just refresh the page a few times
they usually eventually disappear. So either I'm seeing things or this is
because of the way HR works which I think it is or something else is going
on. Have you seen this behavior? Thanks.
On Wed, Apr 13, 2011 at 8:44 AM, Simon Knott  wrote:

> Hi Stephen,
>
> Now that you mention it, my data also seems to be stuck - my entity count
> and storage used hasn't changed, despite the stats supposedly being updated
> twice today...
>
> Cheers,
> Simon
>
> --
> 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.
>

-- 
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: Datastore Stats for High Replication

2011-04-13 Thread Stephen Johnson
Hi Simon,
Do your "All Entities" statistics actually resemble what's in your
datastore. For example, about 6 days ago I deleted all entities from
my HR datastore (everything). After 24 hours the datastore usage went
to zero as it should since there's a typical lag of about 24 hours
from what I've seen but the datastore statistics for "All Entities"
still show 3,246 entities and 38 MBytes. I then added last night about
50 small entities to see if not having anything in datastore was
somehow causing it to not update but it still shows 3,246 entities and
38 MBytes even though it says it was last updated 3 hours ago.
Thanks,
Stephen

On Apr 13, 2:16 am, Simon Knott  wrote:
> I get datastore stats on my HR apps.  They are updated every 5 or 6 hours -
> is your app new?

-- 
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: Sort function now throws an exception

2011-03-28 Thread Stephen Johnson
Awesome! Glad it worked!

On Mon, Mar 28, 2011 at 3:14 AM, ZeroCool  wrote:

> Hi Stephen,
>
> Thank you very much.
> I modified the code according to your suggestion and it worked.
>
>
> On Mar 28, 8:13 am, Stephen Johnson  wrote:
> > Hi ZeroCool,
> > I'm not sure if this will help, and I don't know how the TimSort works
> but
> > looking at your compare method I'm curious about this particular
> situation.
> > If you have two users UserA and UserB and
> >UserA has  groupRank of 5 and Rep of 3
> > and
> >UserB has groupRank of 5 and Rep of 3
> > Then, if you call compare(UserA, UserB) you get a return value of 1
> > indicating that UserA > UserB
> > But, if you call compare(UserB, UserA) you get a return value of 1
> > indicating that UserB > UserA
> > So, this situation seems wrong. Now, if I'm interpreting your compare
> method
> > correctly, then my guess would be that either new data was added to your
> > dataset that hit this particular case or the old mergeSort used by
> > Collections.sort only called compare with the objects in one particular
> > order if it used them multiple times and the new TimSort can call the
> > compare in either order multiple times and it is seeing this discrepancy.
> >
> > I think you should try re-coding your compare so that if groupRank and
> Rep
> > are the same for both objects then you return 0 not a 1.
> >
> > I hope this helps,
> > Stephen
> >
> >
> >
> >
> >
> >
> >
> > On Sun, Mar 27, 2011 at 1:19 AM, ZeroCool  wrote:
> > > Hi App Engine Team,
> >
> > > I see 100% error rate for a servlet in my application.
> > > The function had been working well for months.
> > > The lines of code that generate errors are as following:
> >
> > > List> memKeys = userDao.getUserKeys();
> > > Map, User> mem = userDao.get(memKeys);
> > > List memList = new ArrayList(mem.values());
> > > Collections.sort(memList, comp);
> >
> > > Comparator comp = new Comparator()
> > > {
> > >@Override
> > >public int compare(User user1, User user2)
> > >{
> >
> > >int ret = user2.getGroupRank() - user1.getGroupRank();
> > >if (ret == 0)
> > >{
> > >ret = ((user2.getRep() - user1.getRep()) >= 0 ?
> 1 :
> > > -1);
> > >}
> > >return ret;
> > >}
> > > };
> >
> > > The error is:
> >
> > > [27/Mar/2011:00:45:28 -0700] "POST /GM HTTP/1.1" 500 0 - "a.
> > > 2.3.0,gzip(gfe)" "pe-server2.appspot.com" ms=76 cpu_ms=140
> > > api_cpu_ms=0 cpm_usd=0.003913
> > > W 2011-03-27 00:45:28.770
> > > /GM
> > > java.lang.IllegalArgumentException: Comparison method violates its
> > > general contract!
> > >at java.util.TimSort.mergeLo(TimSort.java:747)
> > >at java.util.TimSort.mergeAt(TimSort.java:483)
> > >at java.util.TimSort.mergeCollapse(TimSort.java:408)
> > >at java.util.TimSort.sort(TimSort.java:214)
> > >at java.util.TimSort.sort(TimSort.java:173)
> > >at java.util.Arrays.sort(Arrays.java:1347)
> > >at java.util.Collections.sort(Collections.java:217)
> > >at com.miracle.server.pe.GroupMember.doPost(GroupMember.java:46)
> > >at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> > >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.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlo
> bUploadFilter.java:
> > > 97)
> > >at org.mortbay.jetty.servlet.ServletHandler
> > > $CachedChain.doFilter(ServletHandler.java:1157)
> > >at
> >
> > >
> com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionF
> ilter.java:
> > > 35)
> > >at org.mortbay.jetty.servlet.ServletHandler
> > > $CachedChain.doFilter(ServletHandler.java:1157)
> > >at
> >
> > >
> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doF

Re: [appengine-java] Sort function now throws an exception

2011-03-27 Thread Stephen Johnson
Hi ZeroCool,
I'm not sure if this will help, and I don't know how the TimSort works but
looking at your compare method I'm curious about this particular situation.
If you have two users UserA and UserB and
   UserA has  groupRank of 5 and Rep of 3
and
   UserB has groupRank of 5 and Rep of 3
Then, if you call compare(UserA, UserB) you get a return value of 1
indicating that UserA > UserB
But, if you call compare(UserB, UserA) you get a return value of 1
indicating that UserB > UserA
So, this situation seems wrong. Now, if I'm interpreting your compare method
correctly, then my guess would be that either new data was added to your
dataset that hit this particular case or the old mergeSort used by
Collections.sort only called compare with the objects in one particular
order if it used them multiple times and the new TimSort can call the
compare in either order multiple times and it is seeing this discrepancy.

I think you should try re-coding your compare so that if groupRank and Rep
are the same for both objects then you return 0 not a 1.

I hope this helps,
Stephen

On Sun, Mar 27, 2011 at 1:19 AM, ZeroCool  wrote:

> Hi App Engine Team,
>
> I see 100% error rate for a servlet in my application.
> The function had been working well for months.
> The lines of code that generate errors are as following:
>
> List> memKeys = userDao.getUserKeys();
> Map, User> mem = userDao.get(memKeys);
> List memList = new ArrayList(mem.values());
> Collections.sort(memList, comp);
>
> Comparator comp = new Comparator()
> {
>@Override
>public int compare(User user1, User user2)
>{
>
>int ret = user2.getGroupRank() - user1.getGroupRank();
>if (ret == 0)
>{
>ret = ((user2.getRep() - user1.getRep()) >= 0 ? 1 :
> -1);
>}
>return ret;
>}
> };
>
> The error is:
>
>
> [27/Mar/2011:00:45:28 -0700] "POST /GM HTTP/1.1" 500 0 - "a.
> 2.3.0,gzip(gfe)" "pe-server2.appspot.com" ms=76 cpu_ms=140
> api_cpu_ms=0 cpm_usd=0.003913
> W 2011-03-27 00:45:28.770
> /GM
> java.lang.IllegalArgumentException: Comparison method violates its
> general contract!
>at java.util.TimSort.mergeLo(TimSort.java:747)
>at java.util.TimSort.mergeAt(TimSort.java:483)
>at java.util.TimSort.mergeCollapse(TimSort.java:408)
>at java.util.TimSort.sort(TimSort.java:214)
>at java.util.TimSort.sort(TimSort.java:173)
>at java.util.Arrays.sort(Arrays.java:1347)
>at java.util.Collections.sort(Collections.java:217)
>at com.miracle.server.pe.GroupMember.doPost(GroupMember.java:46)
>at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>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.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:
> 97)
>at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>at
>
> com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:
> 35)
>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
> 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.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:
> 238)
>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
>
> com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:
> 76)
>at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>at
>
> com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:
> 135)
>at
> com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:
> 261)
>at com.google.apphos

Re: [appengine-java] Sort function now throws an exception

2011-03-27 Thread Stephen Johnson
There have been some people that have been reporting code that was working
for weeks, etc. not working in the last week or so. I'm beginning to wonder
if maybe behind the scenes a switch to Java 7 or some other Java switch is
occurring. In relation to your error, it looks like what I've found so far
that Java 7 (not sure) is switching to using TimSort for ArrayList sorting.
This TimSort is also used on Android from what I'm reading. If you look at
the source code to TimSort you will see the exception you are seeing being
thrown. It seems to me and further reading needs to be done that this type
of error shouldn't occur for a Comparator used outside of a Set or Map as
you suggest but should only occur when used in conjunction with a Set or
Map. I'm including a couple of links to help you and other readers out as
I'm sure your not the only one doing sorts this way (I know I am).

http://news.ycombinator.com/item?id=752677

http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/TimSort.java?view=co

On Sun, Mar 27, 2011 at 1:19 AM, ZeroCool  wrote:

> Hi App Engine Team,
>
> I see 100% error rate for a servlet in my application.
> The function had been working well for months.
> The lines of code that generate errors are as following:
>
> List> memKeys = userDao.getUserKeys();
> Map, User> mem = userDao.get(memKeys);
> List memList = new ArrayList(mem.values());
> Collections.sort(memList, comp);
>
> Comparator comp = new Comparator()
> {
>@Override
>public int compare(User user1, User user2)
>{
>
>int ret = user2.getGroupRank() - user1.getGroupRank();
>if (ret == 0)
>{
>ret = ((user2.getRep() - user1.getRep()) >= 0 ? 1 :
> -1);
>}
>return ret;
>}
> };
>
> The error is:
>
>
> [27/Mar/2011:00:45:28 -0700] "POST /GM HTTP/1.1" 500 0 - "a.
> 2.3.0,gzip(gfe)" "pe-server2.appspot.com" ms=76 cpu_ms=140
> api_cpu_ms=0 cpm_usd=0.003913
> W 2011-03-27 00:45:28.770
> /GM
> java.lang.IllegalArgumentException: Comparison method violates its
> general contract!
>at java.util.TimSort.mergeLo(TimSort.java:747)
>at java.util.TimSort.mergeAt(TimSort.java:483)
>at java.util.TimSort.mergeCollapse(TimSort.java:408)
>at java.util.TimSort.sort(TimSort.java:214)
>at java.util.TimSort.sort(TimSort.java:173)
>at java.util.Arrays.sort(Arrays.java:1347)
>at java.util.Collections.sort(Collections.java:217)
>at com.miracle.server.pe.GroupMember.doPost(GroupMember.java:46)
>at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>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.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:
> 97)
>at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>at
>
> com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:
> 35)
>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
> 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.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:
> 238)
>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
>
> com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:
> 76)
>at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>at
>
> com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:
> 135)
>at
> com.google.apphosting.runtime.JavaRuntime.handleRequest(JavaRuntime.java:
> 261)
>at com.google.apphosting.base.RuntimePb$EvaluationRuntime
> $2.handleReques

Re: [appengine-java] Re: uploading 100k lines into the datastore is enough to max out the CPU time?

2011-03-08 Thread Stephen Johnson
Hi Claudio,
You have 12 total fields all of which you have indexed which is the default.
You have 1 key field and 11 non-key fields. This will result in 23 index
entries being written for each entity. You get 1 ascending index on the key
field and by default you get both an ascending and descending index on the
other 11 non-key fields. This will take A LOT of CPU for each entity. Do you
need them all indexed? If not, I would set them to unindexed. That should
help a lot.
Stephen

2011/3/7 Cláudio Coelho 

> Since the bottleneck occurs when making objects of Location
> persistent, I assume that is the only relevant class. If anything else
> is relevant, tell me and I'll disclose.
>
> @PersistenceCapable(identityType =
> IdentityType.APPLICATION,detachable="true")
> public class Location{
>@PrimaryKey
>@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>Long locationId;
>@Persistent
>long countryId;
>@Persistent
>String name;
>@Persistent
>String country=null;
>@Persistent
>double latitude,longitude;
>@Persistent
>int population;
>@Persistent
>long geoBoxL1,geoBoxL2,geoBoxL3,geoBoxL4,geoBoxL5;
>public Location()
>{
>
>}
>public Location(String name, long countryId,String country, double
> latitude, double longitude)
>{
>this.name=name;
>this.countryId=countryId;
>this.latitude=latitude;
>this.longitude=longitude;
>this.country=country;
>}
>public Location(LocationDTO dto) {
>this();
>updateFromDTO(dto);
>}
>
>public void updateFromDTO(LocationDTO dto) {
>setLocationId(dto.getLocationId());
>setCountryId(dto.getCountryId());
>setCountry(dto.getCountry());
>setName(dto.getName());
>setPopulation(dto.getPopulation());
>setLatitude(dto.getLatitude());
>setLongitude(dto.getLongitude());
>setGeoBoxL1(dto.getGeoBoxL1());
>setGeoBoxL2(dto.getGeoBoxL2());
>setGeoBoxL3(dto.getGeoBoxL3());
>setGeoBoxL4(dto.getGeoBoxL4());
>setGeoBoxL5(dto.getGeoBoxL5());
>
>
>}
>public LocationDTO getDTO()
>{
>LocationDTO dto = new LocationDTO();
>dto.setLocationId(getLocationId());
>dto.setCountryId(getCountryId());
>dto.setCountry(getCountry());
>dto.setName(getName());
>dto.setPopulation(getPopulation());
>dto.setLatitude(getLatitude());
>dto.setLongitude(getLongitude());
>dto.setGeoBoxL1(getGeoBoxL1());
>dto.setGeoBoxL2(getGeoBoxL2());
>dto.setGeoBoxL3(getGeoBoxL3());
>dto.setGeoBoxL4(getGeoBoxL4());
>dto.setGeoBoxL5(getGeoBoxL5());
>
>return dto;
>}
>
>public long getLocationId() {
>return locationId;
>}
>public void setLocationId(long locationId) {
>this.locationId = locationId;
>}
>public String getCountry() {
>return country;
>}
>
>public int getPopulation() {
>return population;
>}
>public void setPopulation(int population) {
>this.population = population;
>}
>public void setCountry(String country) {
>this.country = country;
>}
>
>public long getCountryId() {
>return countryId;
>}
>public void setCountryId(long countryId) {
>this.countryId = countryId;
>}
>public String getName() {
>return name;
>}
>public void setName(String name) {
>this.name = name;
>}
>public double getLatitude() {
>return latitude;
>}
>public void setLatitude(double latitude) {
>this.latitude = latitude;
>}
>public double getLongitude() {
>return longitude;
>}
>public void setLongitude(double longitude) {
>this.longitude = longitude;
>}
>
>public long getGeoBoxL1() {
>return geoBoxL1;
>}
>public void setGeoBoxL1(long geoBoxL1) {
>this.geoBoxL1 = geoBoxL1;
>}
>public long getGeoBoxL2() {
>return geoBoxL2;
>}
>public void setGeoBoxL2(long geoBoxL2) {
>this.geoBoxL2 = geoBoxL2;
>}
>public long getGeoBoxL3() {
>return geoBoxL3;
>}
>public void setGeoBoxL3(long geoBoxL3) {
>this.geoBoxL3 = geoBox

Re: [appengine-java] Is descending index still necessary with mapreduce.

2011-02-11 Thread Stephen Johnson

Great news! Thx!

Sent from my iPhone

On Feb 11, 2011, at 5:28 PM, "Ikai Lan (Google)" > wrote:



Hi Stephen,

Good observation! You're right. We don't need this property anymore.  
We'll update the docs.



--
Ikai Lan
Developer Programs Engineer, Google App Engine
Blogger: http://googleappengine.blogspot.com
Reddit: http://www.reddit.com/r/appengine
Twitter: http://twitter.com/app_engine



On Fri, Feb 11, 2011 at 9:12 AM, Stephen Johnson > wrote:

Hi all,
I'm wondering if the descending indexes on keys for Java is still  
required since the introduction of the __scatter__ property. The  
documentation still has:
The entity to be mapped must have a descending index on key. There  
is support for guessing the key range in the Python implementation,  
and we plan to add that same strategy to the Java implementation.
Sharding is currently done by splitting the space of keys  
lexicographically. For instance, suppose you have the keys 'a',  
'ab', 'ac', and 'e' and you request two splits. The framework will  
find that the first key is 'a' and the last key is 'e'. 'a' is the  
first letter and 'e' is the fifth, so the middle is 'c'. Therefore,  
the two splits are ['a'...'c') and ['c'...), with the first split  
containing 'a', 'ab', and 'ac', and the last split only containing  
'e'.
But I'm hoping someone knows if this has been removed since  
__scatter__ property seems to be the new splitting/sharding method.


Thanks,
Stephen

--
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 
.


--
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 
.


--
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] Is descending index still necessary with mapreduce.

2011-02-11 Thread Stephen Johnson
Hi all,
I'm wondering if the descending indexes on keys for Java is still required
since the introduction of the __scatter__ property. The documentation still
has:

   - The entity to be mapped must have a descending index on key. There is
   support for guessing the key range in the Python implementation, and we plan
   to add that same strategy to the Java implementation.
   - Sharding is currently done by splitting the space of keys
   lexicographically. For instance, suppose you have the keys 'a', 'ab', 'ac',
   and 'e' and you request two splits. The framework will find that the first
   key is 'a' and the last key is 'e'. 'a' is the first letter and 'e' is the
   fifth, so the middle is 'c'. Therefore, the two splits are ['a'...'c') and
   ['c'...), with the first split containing 'a', 'ab', and 'ac', and the last
   split only containing 'e'.

But I'm hoping someone knows if this has been removed since __scatter__
property seems to be the new splitting/sharding method.

Thanks,
Stephen

-- 
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] Using 2 datastores in same App?

2011-02-11 Thread Stephen Johnson
You can't use two different datastores, but you can use multitenancy:
http://code.google.com/appengine/docs/java/multitenancy/overview.html

On Fri, Feb 11, 2011 at 9:02 AM, dudu  wrote:

> Is it possible? If i configure two persistence providers in
> persistence.xml?
> I need to separte my data per software component.
>
> --
> 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.
>

-- 
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] when to use memcache vs static variable

2011-02-10 Thread Stephen Johnson
No, that isn't how it works. Your app executes on a number of server
instances. There could be 1 instance or a 1000 instances of your application
serving your users. That's why you use memcache to share that type of
information.

On Thu, Feb 10, 2011 at 11:35 AM, repairman  wrote:

> in my servlet, i have a static Hashtable which I use to "cache"
> information.  it works fine w/ 1 server node.
>
> in normal NON-GAE setup where you have multiple servers, this approach is
> not good since each server/node does not see what the other cache(static
> hashtable) contains.   so i understand you then use memcache to share
> information.
>
> BUT in GAE environment, it's like a virtual super big server, so
> technically my app runs on this ONE big virtual server.   So technically I
> can use the static variable to cache.   So the question is in GAE
> environment, why would I ever use memcache?   Can't I just keep static
> variable?
>
>
>  --
> 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.
>

-- 
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] embedded unindexed fields

2011-02-08 Thread Stephen Johnson
Yes, it seems this is a bug. I'm sure (ok 95% sure) it was working at one
point because I did this exact thing in one of my kinds and I'm sure I
tested to make sure the fields weren't indexed because it has a lot of
properties and I don't want them indexed. I just looked and yes the fields
are being indexed. Not good.

On Tue, Feb 8, 2011 at 3:14 AM, Nikolay Ivanov  wrote:

> I am trying to define embedded unindexed field without successes. I have
> following classes and the embedded fields are indexed regardless of the
> "unindexed" definition. I'm tryingto store BaseSensorValue class. Is that a
> bug or I miss something?
>
> @PersistenceCapable
> @EmbeddedOnly
> public class QuantityValue {
>
> @Persistent
> @Extension(vendorName="datanucleus", key="gae.unindexed",
> value="true")
> private Double value;
>
> public QuantityValue() {
> }
>
> public Double setValue(Double value) {
> this.value = value;
> }
>
> public Double getValue() {
> return value;
> }
> }
>
> @PersistenceCapable
> public class BaseSensorValue extends BasePersistentObject {
>
> @Persistent
> @Embedded(members = {
> @Persistent(name="value", columns=@Column(name="v"),
> extensions=@Extension(vendorName="datanucleus", key="gae.unindexed",
> value="true"))
> })
> private QuantityValue value;
>
> @Persistent
> @Embedded(members = {
> @Persistent(name="value", columns=@Column(name="cv"),
> extensions=@Extension(vendorName="datanucleus", key="gae.unindexed",
> value="true"))
> })
> private QuantityValue calcValue;
>
>
>
> public BaseSensorValue() {}
>
>
>
> public QuantityValue getCalculatedValue() {
> return calcValue;
> }
>
> public QuantityValue getValue() {
> return value;
> }
> }
>
> --
> 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.
>

-- 
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] NPE at jsp:useBean with scope session

2011-02-08 Thread Stephen Johnson
Glad to help!

On Tue, Feb 8, 2011 at 3:16 AM, Louis H.  wrote:

> Indeed, I had sessions disabled. (I missed they are disabled by default).
> Thanks for reply.
> Problem solved.
>
> --
> 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.
>

-- 
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] NPE at jsp:useBean with scope session

2011-02-07 Thread Stephen Johnson
Also, beans should implement the java.io.Serializable interface if you are
going to store them in the Session object.

On Mon, Feb 7, 2011 at 10:12 PM, Stephen Johnson wrote:

> Do you have sessions enabled for your application?
>
>
> On Mon, Feb 7, 2011 at 5:39 AM, Louis H.  wrote:
>
>> Hi,
>> I am trying jsp form handling via bean and I am wondering why this jsp
>> page gives me an NPE after submitting. This happening with scope "session"
>> (when I change scope to "page" it's working correctly):
>>
>> *<%@ page contentType="text/html;charset=UTF-8" language="java" %>*
>> *
>> *//Works
>> ok with scope="page"
>> * *//NPE
>> thrown here
>> *http://www.w3.org/1999/xhtml";> *
>> *   *
>> *TestFormPage *
>> *   *
>> *  *
>> **
>> * *
>> * *
>> **
>> *  *
>> **
>>
>> Source of bean for handling data (nothing interesting here):
>> *package formBeans;*
>> *public class Test1 {*
>> * private String testPole="";*
>> *
>> *
>> * public String getTestPole() {*
>> * return testPole;*
>> * }*
>> * public void setTestPole(String testPole) {*
>> * this.testPole = testPole;*
>> * }*
>> *}*
>>
>> If I get it right, the "> scope="session"/>" should create and initialize a bean in session (if it
>> is not present already) but it seems the bean is not created.
>> Any suggestion appreciated.
>>
>> --
>> 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.
>>
>
>

-- 
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] NPE at jsp:useBean with scope session

2011-02-07 Thread Stephen Johnson
Do you have sessions enabled for your application?

On Mon, Feb 7, 2011 at 5:39 AM, Louis H.  wrote:

> Hi,
> I am trying jsp form handling via bean and I am wondering why this jsp page
> gives me an NPE after submitting. This happening with scope "session" (when
> I change scope to "page" it's working correctly):
>
> *<%@ page contentType="text/html;charset=UTF-8" language="java" %>*
> *
> *//Works
> ok with scope="page"
> * *//NPE
> thrown here
> *http://www.w3.org/1999/xhtml";> *
> *   *
> *TestFormPage *
> *   *
> *  *
> **
> * *
> * *
> **
> *  *
> **
>
> Source of bean for handling data (nothing interesting here):
> *package formBeans;*
> *public class Test1 {*
> * private String testPole="";*
> *
> *
> * public String getTestPole() {*
> * return testPole;*
> * }*
> * public void setTestPole(String testPole) {*
> * this.testPole = testPole;*
> * }*
> *}*
>
> If I get it right, the " scope="session"/>" should create and initialize a bean in session (if it
> is not present already) but it seems the bean is not created.
> Any suggestion appreciated.
>
> --
> 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.
>

-- 
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: Just getting started with Datastore

2011-02-02 Thread Stephen Johnson
http://online.wsj.com/article/SB10001424052748704124504576118510340787364.html

On Wed, Feb 2, 2011 at 10:34 PM, WillSpecht  wrote:

> Can you elaborate on pulling a Bing.
>
> On Feb 2, 4:01 pm, "Ikai Lan (Google)" 
> 
> >
> wrote:
> > Yep, entities are schemaless. This is both powerful and a bit of a
> mismatch
> > to Java's type system. We've all become very used to thinking in terms of
> > types. A little too much sometimes, in my opinion.
> >
> > Objectify's documentation is really amazing. I've been considering
> pulling a
> > Bing and copy-pasting his intro into our official docs.
> >
> > --
> > 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 Wed, Feb 2, 2011 at 9:59 AM, David Sowerby  >wrote:
> >
> > > Matt
> >
> > > No problem - I think most of us have been there!
> >
> > > On Feb 2, 3:17 am, Matt Reeves  wrote:
> > > > Thanks David (and thanks all), that is a good intro.  I think the
> light
> > > bulb
> > > > just went off in my head that there is no requirement that you define
> how
> > > an
> > > > Entity and its properties should look.  Two entities can be of the
> same
> > > kind
> > > > but look completely different (which would likely be pointless to
> have
> > > any
> > > > useful queries).  I was just having a hard time unlocking my brain
> from
> > > the
> > > > relational db world... all the explanation was spelled out right in
> front
> > > of
> > > > me, just took a few nights to sink in.
> >
> > > > Thanks again.
> >
> > > --
> > > 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.
>
> --
> 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.
>
>

-- 
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: Semaphores/ LinkedBlockingQueue on GAE for java

2011-01-30 Thread Stephen Johnson
If where you have specified log.info("do your stuff here") you intend to
send data back to the client and then loop again and wait for more data I
think you are going to be disappointed. I don't believe any data will be
sent back to the client until your servlet completes. So you'll have to
re-establish a connection every time data gets sent back down.

On Sun, Jan 30, 2011 at 11:20 AM, Artur Downar
wrote:

> Yes, you are right.
> It takes 400-600ms so it costs about an hour of the cpu time per 24hours.
> It is acceptable.
>
>
>  I DO it following way:
>
> Map entity;
>
>
> try {
> for (int i=0; i<100; i++) {
> entity =  ofy.get(ToModemInfoEntity.class);
> if (entity != null && !entity.isEmpty()) {
>
> log.info("got data from db, do my stuff here...");
> } else {
> Thread.sleep(100);
> }
> }
> }
>
> Can I improove anything else, please ?
>
>
>
>
>
>
>
>
> On Sun, Jan 30, 2011 at 1:36 PM, Didier Durand wrote:
>
>> PS: you should also combine memcache + ds datastore to reduce cpu.
>>
>> regards
>>
>> didier
>>
>> On Jan 30, 1:10 pm, Artur Downar  wrote:
>> > So, you mean polling on the database.
>> >
>> > I wrote:
>> >
>> > try {
>> > for (int i=0; i<100; i++) {
>> > entity = ofy.find(ToModemInfoEntity.class, "whatever");
>> > if (entity != null) {
>> > log.info("got data from db, do my stuff here...");
>> > } else {
>> > Thread.sleep(100);
>> > }
>> > }
>> > }catch (Throwable th) {
>> > th.printStackTrace();
>> > }
>> >
>> > It is cpu-time consuming.
>> > It polls for about 11seconds and it takes about 1500ms of the cpu time.
>> > It makes more than 2hours of the CPU time per natural day.
>> >
>> > I can extend the Time.sleep(period) but it still seems unacceptable due
>> to
>> > CPU costs.
>> >
>> > On Sun, Jan 30, 2011 at 8:21 AM, Didier Durand > >wrote:
>>  >
>> > > Sorry,
>> >
>> > > hit "send" too quicly
>> >
>> > > b) why don't you do something like this
>> >
>> > > Side reading data:
>> > > ==
>> >
>> > > do {
>> > >read new data from ds;
>> > > if (new data) {
>> > > mark data as read in ds
>> > >do what you need
>> > >return;
>> > >} else {
>> > >  Thread.sleep(100)
>> > >}
>> > > } until (running time near 30s)
>> > > if (no new data) {
>> > >give error message to waiting user
>> > > }
>> >
>> > > Side writing data
>> > > ==
>> >
>> > > write new data to datastore (with corresponding status showing that
>> > > it's new and not read yet)
>> >
>> > > N.B: the 30s is a hard limit imposed by gae. You've to check for it
>> > > and end gracefully else your servlet will be killed by GAE.
>> >
>> > > regards
>> >
>> > > didier
>> >
>> > > On Jan 30, 8:15 am, Didier Durand  wrote:
>> > > > Hi,
>> >
>> > > > To answer your questions:
>> >
>> > > > a) yes, you can say how long you waits Thread.sleep(millis) where
>> > > > millis says how many milliseconds you want to wait
>> >
>> > > > b) why don't you do something like this
>> >
>> > > > do {
>> > > > read new data from ds;
>> >
>> > > > }
>> >
>> > > > On Jan 29, 10:38 pm, Stephen Johnson 
>> wrote:
>> >
>> > > > > At the moment the Channel API is javascript only. There are a lot
>> of
>> > > people
>> > > > > that would like it to be open to other languages for things just
>> like
>> > > you
>> > > > > want to do. You might be able to use something like Rhino to run
>> the
>> > > > > javascript in Java but not sure if that will work. You should take
>> a
>> > > look at
&

Re: [appengine-java] Re: Semaphores/ LinkedBlockingQueue on GAE for java

2011-01-29 Thread Stephen Johnson
At the moment the Channel API is javascript only. There are a lot of people
that would like it to be open to other languages for things just like you
want to do. You might be able to use something like Rhino to run the
javascript in Java but not sure if that will work. You should take a look at
XMPP, it's very simple to have the server send instant messages. I did a
quick search for XMPP libraries in Java and here is one I found. I'm sure
there are many others. Check out
http://twit88.com/blog/2009/02/17/java-xmpp-client-library/
On Sat, Jan 29, 2011 at 2:07 PM, Artur Downar
wrote:

> Thank you.
>
> I took a brief look on channel API and it seems I it is the thing I need.
>
> I have a small question.
>
> The modem device is a java embedded device and it has no public IP. There
> is no javascript on it. Only java.
>
> Is it enough for GAE channel API to communicate with it ?
>
>
>
>
>
>
>
>   On Sat, Jan 29, 2011 at 9:49 PM, Stephen Johnson  > wrote:
>
>> Sounds like you need more of a Push style. Checkout the Channel API or the
>> XMPP api.
>>
>>
>
>
>>On Sat, Jan 29, 2011 at 1:47 PM, Artur Downar <
>> artur.dow...@googlemail.com> wrote:
>>
>>>  The external device polls for data from GAE.
>>> It is not specified when the data arrives. To describe it more clearly.
>>> The device is a GSM modem device that sends an SMS on the user request.
>>>
>>> The user launches a web browser and writes a mobile phone number. The
>>> browser sends data to the GAE and the sms should be send immediately
>>>
>>> So I cannot specify how long I can wait in Thread.sleep().
>>>
>>>
>>>
>>> You mention about Objectify. I use that library but I'm quite new to it.
>>>
>>>  Does it have the mechanism that works like:
>>>
>>>  process A waits for data until data into database arrives or timeout
>>> expires
>>>  process B puts the data into database
>>>  process a continues processing the data inserted by process B
>>>
>>> ?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Sat, Jan 29, 2011 at 3:59 PM, Didier Durand 
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> Forgot: you can use Thread.sleep() to wait (java.lang.Thread is also
>>>> part of the JRE)
>>>>
>>>> regards
>>>>
>>>> didier
>>>>
>>>> On Jan 29, 3:35 pm, Didier Durand  wrote:
>>>> > Hi,
>>>> >
>>>> > LinkedBlokingQueue is part of JRE WhiteList:
>>>> http://code.google.com/appengine/docs/java/jrewhitelist.html. So, you
>>>> > can use it.
>>>> >
>>>> > But, I dont see the need. Why don't you just from on the datastore on
>>>> > 1 side and read from it on the other. It would be very simple and rely
>>>> > on the most basic (i.e solid) mechanism of gae. (I would recommend
>>>> > Objectify for ds read/ write)
>>>> >
>>>> > As you have network round-trips, the read / write time will be
>>>> > negligible even it can seem high compared to an in-memory mechanism
>>>> > like a Queue.
>>>> >
>>>> > regards
>>>> >
>>>> > didier
>>>> >
>>>> > On Jan 29, 1:51 pm, arturad  wrote:
>>>> >
>>>> > > In my application an embedded device (no public IP) should connect
>>>> to
>>>> > > the GAE in order to obtain some data from it. The data are provided
>>>> by
>>>> > > the web browser.
>>>> >
>>>> > > The whole data-passing process looks like:
>>>> >
>>>> > >   web browser -> GAE ->
>>>> > > embedded standalone device
>>>> >
>>>> > > I developed a servlet the device connects to. It issues the HTTP
>>>> GET.
>>>> > > On the other side the web browser sends data using standard GWT
>>>> > > RemoteServiceServlet.
>>>> >
>>>> > > In case there is no data for the device the doGet method in the
>>>> > > servlet should stop for some seconds until user enters data or time
>>>> > > out expires.
>>>> >
>>>> > > I'm trying to use LinkedBlockingQueue  to pass data between two
>>>> > > serv

Re: [appengine-java] Re: Semaphores/ LinkedBlockingQueue on GAE for java

2011-01-29 Thread Stephen Johnson
Sounds like you need more of a Push style. Checkout the Channel API or the
XMPP api.

On Sat, Jan 29, 2011 at 1:47 PM, Artur Downar
wrote:

> The external device polls for data from GAE.
> It is not specified when the data arrives. To describe it more clearly. The
> device is a GSM modem device that sends an SMS on the user request.
>
> The user launches a web browser and writes a mobile phone number. The
> browser sends data to the GAE and the sms should be send immediately
>
> So I cannot specify how long I can wait in Thread.sleep().
>
>
>
> You mention about Objectify. I use that library but I'm quite new to it.
>
>  Does it have the mechanism that works like:
>
>  process A waits for data until data into database arrives or timeout
> expires
>  process B puts the data into database
>  process a continues processing the data inserted by process B
>
> ?
>
>
>
>
>
>
>
> On Sat, Jan 29, 2011 at 3:59 PM, Didier Durand wrote:
>
>> Hi,
>>
>> Forgot: you can use Thread.sleep() to wait (java.lang.Thread is also
>> part of the JRE)
>>
>> regards
>>
>> didier
>>
>> On Jan 29, 3:35 pm, Didier Durand  wrote:
>> > Hi,
>> >
>> > LinkedBlokingQueue is part of JRE WhiteList:
>> http://code.google.com/appengine/docs/java/jrewhitelist.html. So, you
>> > can use it.
>> >
>> > But, I dont see the need. Why don't you just from on the datastore on
>> > 1 side and read from it on the other. It would be very simple and rely
>> > on the most basic (i.e solid) mechanism of gae. (I would recommend
>> > Objectify for ds read/ write)
>> >
>> > As you have network round-trips, the read / write time will be
>> > negligible even it can seem high compared to an in-memory mechanism
>> > like a Queue.
>> >
>> > regards
>> >
>> > didier
>> >
>> > On Jan 29, 1:51 pm, arturad  wrote:
>> >
>> > > In my application an embedded device (no public IP) should connect to
>> > > the GAE in order to obtain some data from it. The data are provided by
>> > > the web browser.
>> >
>> > > The whole data-passing process looks like:
>> >
>> > >   web browser -> GAE ->
>> > > embedded standalone device
>> >
>> > > I developed a servlet the device connects to. It issues the HTTP GET.
>> > > On the other side the web browser sends data using standard GWT
>> > > RemoteServiceServlet.
>> >
>> > > In case there is no data for the device the doGet method in the
>> > > servlet should stop for some seconds until user enters data or time
>> > > out expires.
>> >
>> > > I'm trying to use LinkedBlockingQueue  to pass data between two
>> > > servlets. It does not work unfortunately. Seems like the GAE launches
>> > > new JVM for concurrent requests... I pushed the LinkedBlockingQueue
>> > > into memcache and get it by name from concurrent requests. Still does
>> > > not work. Memcache returns NOTnull. But there are no data in the
>> > > queue.
>> >
>> > > In order to investigate my issue I've made some tests with the
>> > > semaphore. Pushed the semaphore to the memcache and made some
>> > > concurrent operations ... -> does not work -> one process does not
>> > > release the other...
>> >
>> > > The problem occurs on GAE only. The whole mechanism works on the
>> > > development server.
>> >
>> > > Is there any way to stop/freeze one process (in the doGet method in
>> > > servlet) and unblock it by another one ?
>> >
>> > > Or... Is there any other way to solve my problem ?
>> > > Thank you for any suggestions.
>> > > Artur
>> >
>> >
>>
>> --
>> 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.
>>
>>
>  --
> 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.
>

-- 
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] Just getting started with Datastore

2011-01-28 Thread Stephen Johnson
Hi Matt,
There are several different ways to save/query objects from the datastore
not just JDO or JPA. They are:
1. Low level api - work directly with the datastore's native (for lack of a
better term) representation of an object.
2. JDO or JPA - work with these standards to abstract away the low-level api
and deal with the datastore in a more SQL like (loosely used here) way
3. Use a third party framework like Objectify.

Everyone has there comfort level that they want to work with. You can also
use more than one of these approaches in an application. I personally use
both JDO and the low-level api. I used JDO becuase when I started it was the
first thing I came across. Many have moved to 3rd party frameworks like
Objectify because unlike JDO which comes from the SQL world, Objectify is
geared  toward the datastore and how it works and is a lighter framework. I
also use the low-level api mostly in my map reduce classes since that is how
you get the entities handed to you in the map function.

The big point is not to get confused and using a mix of two of them and
thinking your doing the same one. I think from your number #1 and #2 that
you might be saving your entities using JDO and then trying to query with
the low-level api. Which is completely OK, but you have to understand how
the query mechanism and keys are represented in both formats. From a
learning perspective and really understand the datastore I would play around
with the low-level API before moving to one of the higher-level APIs
especially relationships between entities.. You probably will want to use a
higher level API in your actual production code, but understanding how keys,
queries, transactions, entity groups, relationships, indexes etc. work at
the low-level will make your life a lot easier in the long run. I wish I
would've started learning the low-level API first.

Hope some of this helps,
Steve

On Fri, Jan 28, 2011 at 10:06 AM, Matt Reeves  wrote:

> I'm a total n00b here and just getting started trying to figure out how the
> datastore works, mostly by reading the documentation.  Here are the
> assumptions I am making, please tell me if I'm saying anything incorrect:
>
> 1) To define persistent entities, one must either create persistent JDO
> classes as mentioned here (http://goo.gl/w9fno) or use JPA
> 2) Once data is loaded to the entities, the queries explained here (
> http://goo.gl/lHO3S) are the best approach to take for querying the
> datastore as they will query any entity regardless of how it was defined.
> 3) The bulkloader tool can be used to upload data to an entity
>
> So far, I have defined some entities using JDO classes, and then I used the
> bulkloader to upload data for the entities from a csv file.  The data shows
> up when viewed from the admin console, but when I run the simple flavor of
> queries as mentioned in #2 above, I am getting no results.  Any help or
> introductory advice would be much appreciated.  Thanks.
>
>
> Here is an example of a class I have defined:
>
> @PersistenceCapable(identityType = IdentityType.APPLICATION)
> public class Rec {
>
> @PrimaryKey
> @Persistent
> private String code;
> @Persistent
> private String name;
> @Persistent
> private Double value;
>
> public String getCode() {
> return this.code;
> }
> public String getName() {
> return this.name;
> }
> public Double getValue() {
> return this.value;
> }
> }
>
> And here is an example of the query I am trying, just trying to grab the
> stored data and populate new object for runtime:
>
> Vector Rec2V = new Vector();
> DatastoreService datastore =
> DatastoreServiceFactory.getDatastoreService();
> Query q = new Query(Rec.class.getName());
> q.addSort("value", Query.SortDirection.DESCENDING);
> PreparedQuery pq = datastore.prepare(q);
> for (Entity result : pq.asIterable()) {
> Rec2V.add(new Rec2(
> (String) result.getProperty("code"),
> (String) result.getProperty("name"),
> (Double) result.getProperty("value")
> ));
> }
>
> --
> 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.
>

-- 
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] Unindexed properties with JDO ?

2011-01-27 Thread Stephen Johnson
Add this annotation to properties you want unindexed.

@Extension(vendorName = "datanucleus", key = "gae.unindexed",
value="true")


On Thu, Jan 27, 2011 at 4:00 AM, Fabrizio Accatino  wrote:

> Using the datastore low-level API I can set a property to "no indexed".
>  Entity.setUnindexedProperty();
> http://code.google.com/appengine/docs/java/datastore/queries.html
>
> Is there a way to get the same behaviour using JDO?
> I'd like to reduce the space used by indexes automatically created on the
> properties.
>
> Fabrizio
>
>  --
> 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.
>

-- 
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: Can't fetch a dataset using primary key

2011-01-26 Thread Stephen Johnson
Yes, to use JDO your going to have to annotate the class and have the
DataNucleus enhancer run over the classes. If you use the low-level API then
you can just query for the Entity object itself.

On Wed, Jan 26, 2011 at 3:09 PM, Marc Herber wrote:

> Thanks for your hint. Meanwhile I debugged the code and found the reason of
> the NullPointerException.
>
> The method getObjectById is implemented by the class
> DatastoreJDOPersistenceManager. Within this method there is 
> *EntityUtils.idToInternalKey(getObjectManager(),
> cls, key, false);*. This methods ends (obviously) in the class
> EntityUtils. Within this class and method you call *determineKind(cmd,
> om);*. But the parameter cmd is alrady null. A few methods later there is
> the follwoing line: *if (acmd.getTable() != null) {...}* et voila ->
> NullPointerException.
>
> The reason why acmd is null is because of this line within the EntityUtils
> class (method idToInternalKey):
> *AbstractClassMetaData cmd =
> om.getMetaDataManager().getMetaDataForClass(cls,
> om.getClassLoaderResolver());*
> Within the method getMetaDataForClass there is the following check:
> *if (isClassWithoutPersistenceInfo(c.getName())){ return null;}*
>
> So, does anybody know what this means?
> Yes - my entity class does not have any annotation but I thought this isn't
> necessary at all?! Should I have to include such kind of informations to my
> class?
>
> --
>  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.
>

-- 
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: Can't fetch a dataset using primary key

2011-01-26 Thread Stephen Johnson
Did quick check, Yes, KEY(' ') can be used if what's inside is an encoded
key, but I assumed that by a plain 1 it was an unencoded ID value.

On Wed, Jan 26, 2011 at 12:00 PM, Stephen Johnson wrote:

> Minor minor point :) I believe Ikai if you look at your posted code you
> forgot the entity kind in your call to KEY, you used KEY('1') without any
> entity kind stated. I also was assuming he was using datastore viewer which
> I think he was. Or is this KEY('1') allowed without entity kind allowed??
>
>
> On Wed, Jan 26, 2011 at 11:48 AM, Ikai Lan (Google) <
> ikai.l+gro...@google.com > wrote:
>
>> Minor point: I posted Python code because you used the term "GQL". I
>> assumed you were working with the datastore viewer - the code sample I
>> posted should be valid there.
>>
>> Java code in JDO uses JDOQL.
>>
>>
>> --
>> 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 Wed, Jan 26, 2011 at 10:07 AM, Stephen Johnson > > wrote:
>>
>>> Also, check that the PMF.getPersistenceManager() returns a non-null
>>> value. Perhaps with the changes you've been trying you don't have the
>>> "transactions-optional" name in the config file matching the code.
>>>
>>>
>>> On Wed, Jan 26, 2011 at 11:00 AM, Stephen Johnson <
>>> onepagewo...@gmail.com> wrote:
>>>
>>>> Well, you shouldn't be getting a NullPointerException if the entity is
>>>> not found so something else is wrong. The correct exception would be
>>>> JDOObjectNotFoundException. Are you sure the PageParameters parameters is
>>>> not null or something else isn't null?? You don't use the 'a' variable in
>>>> anyway in the try/catch that would cause the NullPointerException from what
>>>> I see, so it has to be something else.
>>>>
>>>>
>>>> On Wed, Jan 26, 2011 at 12:46 AM, hrbaer wrote:
>>>>
>>>>> Ok guys, even if the gql query is running I'm still not able to port
>>>>> this logic into my java class.
>>>>> Maybe someone could have a look at my code and correct/refer to my
>>>>> mistake(s):
>>>>>
>>>>> public GuestbookDetails( final PageParameters parameters ) throws
>>>>> StringValueConversionException {
>>>>>
>>>>>PersistenceManager pm = PMF.getPersistenceManager();
>>>>>try {
>>>>>Antwort a = pm.getObjectById( Antwort.class,
>>>>> parameters.getAsLong( Constants.ID ) );
>>>>>}
>>>>>catch (NullPointerException e) {
>>>>>System.out.println( "No entity found." );
>>>>>}
>>>>>
>>>>>try {
>>>>>Antwort a = pm.getObjectById( Antwort.class,
>>>>> parameters.getLong( Constants.ID ) );
>>>>>}
>>>>>catch (NullPointerException e) {
>>>>>System.out.println( "No entity found." );
>>>>>}
>>>>>
>>>>>try {
>>>>>Antwort a = pm.getObjectById( Antwort.class,
>>>>> parameters.getString( Constants.ID ) );
>>>>>}
>>>>>catch (NullPointerException e) {
>>>>>System.out.println( "No entity found." );
>>>>>}
>>>>>
>>>>>try {
>>>>>Antwort a = pm.getObjectById( Antwort.class,
>>>>> parameters.getKey( Constants.ID ) );
>>>>>}
>>>>>catch (NullPointerException e) {
>>>>>System.out.println( "No entity found." );
>>>>>}
>>>>>
>>>>>Key k = KeyFactory.createKey( Antwort.class.getSimpleName(),
>>>>> parameters.getLong( Constants.ID ) );
>>>>>try {
>>>>>Antwort a = pm.getObjectById( Antwort.class, k
>>>>> );
>>>>>}
>>>>>catch (NullPointerException e) {
>&g

Re: [appengine-java] Re: Can't fetch a dataset using primary key

2011-01-26 Thread Stephen Johnson
Minor minor point :) I believe Ikai if you look at your posted code you
forgot the entity kind in your call to KEY, you used KEY('1') without any
entity kind stated. I also was assuming he was using datastore viewer which
I think he was. Or is this KEY('1') allowed without entity kind allowed??

On Wed, Jan 26, 2011 at 11:48 AM, Ikai Lan (Google) <
ikai.l+gro...@google.com > wrote:

> Minor point: I posted Python code because you used the term "GQL". I
> assumed you were working with the datastore viewer - the code sample I
> posted should be valid there.
>
> Java code in JDO uses JDOQL.
>
>
> --
> 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 Wed, Jan 26, 2011 at 10:07 AM, Stephen Johnson 
> wrote:
>
>> Also, check that the PMF.getPersistenceManager() returns a non-null value.
>> Perhaps with the changes you've been trying you don't have the
>> "transactions-optional" name in the config file matching the code.
>>
>>
>> On Wed, Jan 26, 2011 at 11:00 AM, Stephen Johnson > > wrote:
>>
>>> Well, you shouldn't be getting a NullPointerException if the entity is
>>> not found so something else is wrong. The correct exception would be
>>> JDOObjectNotFoundException. Are you sure the PageParameters parameters is
>>> not null or something else isn't null?? You don't use the 'a' variable in
>>> anyway in the try/catch that would cause the NullPointerException from what
>>> I see, so it has to be something else.
>>>
>>>
>>> On Wed, Jan 26, 2011 at 12:46 AM, hrbaer wrote:
>>>
>>>> Ok guys, even if the gql query is running I'm still not able to port
>>>> this logic into my java class.
>>>> Maybe someone could have a look at my code and correct/refer to my
>>>> mistake(s):
>>>>
>>>> public GuestbookDetails( final PageParameters parameters ) throws
>>>> StringValueConversionException {
>>>>
>>>>PersistenceManager pm = PMF.getPersistenceManager();
>>>>try {
>>>>Antwort a = pm.getObjectById( Antwort.class,
>>>> parameters.getAsLong( Constants.ID ) );
>>>>}
>>>>catch (NullPointerException e) {
>>>>System.out.println( "No entity found." );
>>>>}
>>>>
>>>>try {
>>>>Antwort a = pm.getObjectById( Antwort.class,
>>>> parameters.getLong( Constants.ID ) );
>>>>}
>>>>catch (NullPointerException e) {
>>>>System.out.println( "No entity found." );
>>>>}
>>>>
>>>>try {
>>>>Antwort a = pm.getObjectById( Antwort.class,
>>>> parameters.getString( Constants.ID ) );
>>>>}
>>>>catch (NullPointerException e) {
>>>>System.out.println( "No entity found." );
>>>>}
>>>>
>>>>try {
>>>>Antwort a = pm.getObjectById( Antwort.class,
>>>> parameters.getKey( Constants.ID ) );
>>>>}
>>>>catch (NullPointerException e) {
>>>>System.out.println( "No entity found." );
>>>>}
>>>>
>>>>Key k = KeyFactory.createKey( Antwort.class.getSimpleName(),
>>>> parameters.getLong( Constants.ID ) );
>>>>try {
>>>>Antwort a = pm.getObjectById( Antwort.class, k );
>>>>}
>>>>catch (NullPointerException e) {
>>>>System.out.println( "No entity found." );
>>>>}
>>>> }
>>>>
>>>> As you can imagine all querys result in the NullPointerException.
>>>> Parameters.getLong always returns me the value of "ID/Name" (e.g.
>>>> 1,2,3...).
>>>>
>>>> Apart from that I tried to fetch get my entities using the datastore
>>>> object. Yet without success:
>>>>
>>>> DatastoreService datastore =
>>>> DatastoreServiceFactory.getDatastoreService();
>>>> Enti

Re: [appengine-java] Re: Can't fetch a dataset using primary key

2011-01-26 Thread Stephen Johnson
Also, check that the PMF.getPersistenceManager() returns a non-null value.
Perhaps with the changes you've been trying you don't have the
"transactions-optional" name in the config file matching the code.

On Wed, Jan 26, 2011 at 11:00 AM, Stephen Johnson wrote:

> Well, you shouldn't be getting a NullPointerException if the entity is not
> found so something else is wrong. The correct exception would be
> JDOObjectNotFoundException. Are you sure the PageParameters parameters is
> not null or something else isn't null?? You don't use the 'a' variable in
> anyway in the try/catch that would cause the NullPointerException from what
> I see, so it has to be something else.
>
>
> On Wed, Jan 26, 2011 at 12:46 AM, hrbaer wrote:
>
>> Ok guys, even if the gql query is running I'm still not able to port
>> this logic into my java class.
>> Maybe someone could have a look at my code and correct/refer to my
>> mistake(s):
>>
>> public GuestbookDetails( final PageParameters parameters ) throws
>> StringValueConversionException {
>>
>>PersistenceManager pm = PMF.getPersistenceManager();
>>try {
>>Antwort a = pm.getObjectById( Antwort.class,
>> parameters.getAsLong( Constants.ID ) );
>>}
>>catch (NullPointerException e) {
>>System.out.println( "No entity found." );
>>}
>>
>>try {
>>Antwort a = pm.getObjectById( Antwort.class,
>> parameters.getLong( Constants.ID ) );
>>}
>>catch (NullPointerException e) {
>>System.out.println( "No entity found." );
>>}
>>
>>try {
>>Antwort a = pm.getObjectById( Antwort.class,
>> parameters.getString( Constants.ID ) );
>>}
>>catch (NullPointerException e) {
>>System.out.println( "No entity found." );
>>}
>>
>>try {
>>Antwort a = pm.getObjectById( Antwort.class,
>> parameters.getKey( Constants.ID ) );
>>}
>>catch (NullPointerException e) {
>>System.out.println( "No entity found." );
>>}
>>
>>Key k = KeyFactory.createKey( Antwort.class.getSimpleName(),
>> parameters.getLong( Constants.ID ) );
>>try {
>>Antwort a = pm.getObjectById( Antwort.class, k );
>>}
>>catch (NullPointerException e) {
>>System.out.println( "No entity found." );
>>}
>> }
>>
>> As you can imagine all querys result in the NullPointerException.
>> Parameters.getLong always returns me the value of "ID/Name" (e.g.
>> 1,2,3...).
>>
>> Apart from that I tried to fetch get my entities using the datastore
>> object. Yet without success:
>>
>> DatastoreService datastore =
>> DatastoreServiceFactory.getDatastoreService();
>> Entity entity = null;
>>
>> try {
>> entity = datastore.get( k );
>> }
>> catch (EntityNotFoundException e) {
>>System.out.println( "No entity found." );
>> }
>>
>> And last but not least with a simple query:
>>
>> Query q = new Query( Constants.ANTWORT );
>> q.addFilter( Constants.ID, FilterOperator.EQUAL,
>> parameters.getLong( Constants.ID ) );
>> PreparedQuery pq = datastore.prepare(q);
>> Entity entity = pq.asIterator().next();
>> ()
>>
>> I think you already know the answer...
>>
>> Maybe someone is able to help me out.
>> Thanks in advance,
>>
>> --
>> 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.
>>
>>
>

-- 
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: Can't fetch a dataset using primary key

2011-01-26 Thread Stephen Johnson
Well, you shouldn't be getting a NullPointerException if the entity is not
found so something else is wrong. The correct exception would be
JDOObjectNotFoundException. Are you sure the PageParameters parameters is
not null or something else isn't null?? You don't use the 'a' variable in
anyway in the try/catch that would cause the NullPointerException from what
I see, so it has to be something else.

On Wed, Jan 26, 2011 at 12:46 AM, hrbaer  wrote:

> Ok guys, even if the gql query is running I'm still not able to port
> this logic into my java class.
> Maybe someone could have a look at my code and correct/refer to my
> mistake(s):
>
> public GuestbookDetails( final PageParameters parameters ) throws
> StringValueConversionException {
>
>PersistenceManager pm = PMF.getPersistenceManager();
>try {
>Antwort a = pm.getObjectById( Antwort.class,
> parameters.getAsLong( Constants.ID ) );
>}
>catch (NullPointerException e) {
>System.out.println( "No entity found." );
>}
>
>try {
>Antwort a = pm.getObjectById( Antwort.class,
> parameters.getLong( Constants.ID ) );
>}
>catch (NullPointerException e) {
>System.out.println( "No entity found." );
>}
>
>try {
>Antwort a = pm.getObjectById( Antwort.class,
> parameters.getString( Constants.ID ) );
>}
>catch (NullPointerException e) {
>System.out.println( "No entity found." );
>}
>
>try {
>Antwort a = pm.getObjectById( Antwort.class,
> parameters.getKey( Constants.ID ) );
>}
>catch (NullPointerException e) {
>System.out.println( "No entity found." );
>}
>
>Key k = KeyFactory.createKey( Antwort.class.getSimpleName(),
> parameters.getLong( Constants.ID ) );
>try {
>Antwort a = pm.getObjectById( Antwort.class, k );
>}
>catch (NullPointerException e) {
>System.out.println( "No entity found." );
>}
> }
>
> As you can imagine all querys result in the NullPointerException.
> Parameters.getLong always returns me the value of "ID/Name" (e.g.
> 1,2,3...).
>
> Apart from that I tried to fetch get my entities using the datastore
> object. Yet without success:
>
> DatastoreService datastore =
> DatastoreServiceFactory.getDatastoreService();
> Entity entity = null;
>
> try {
> entity = datastore.get( k );
> }
> catch (EntityNotFoundException e) {
>System.out.println( "No entity found." );
> }
>
> And last but not least with a simple query:
>
> Query q = new Query( Constants.ANTWORT );
> q.addFilter( Constants.ID, FilterOperator.EQUAL,
> parameters.getLong( Constants.ID ) );
> PreparedQuery pq = datastore.prepare(q);
> Entity entity = pq.asIterator().next();
> ()
>
> I think you already know the answer...
>
> Maybe someone is able to help me out.
> Thanks in advance,
>
> --
> 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.
>
>

-- 
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: Can't fetch a dataset using primary key

2011-01-25 Thread Stephen Johnson
Good to hear!

On Tue, Jan 25, 2011 at 5:24 AM, hrbaer  wrote:

> Both the database query and the PMF singleton are 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.
>
>

-- 
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] Can't fetch a dataset using primary key

2011-01-24 Thread Stephen Johnson
Hi Marc,
As the error message says, you should use a singleton to share your
persistence manager. Your code must be allocating it more than once. Here ya
go:

import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManagerFactory;
import javax.jdo.PersistenceManager;

final public class PMF {
private final static PersistenceManagerFactory pmf =
JDOHelper.getPersistenceManagerFactory("transactions-optional");

private PMF() {}

static public PersistenceManager getPersistenceManager() {
return pmf.getPersistenceManager();
}
}

Then to use it, just:

 PersistenceManager pm = PMF.getPersistenceManager();

Stephen

On Mon, Jan 24, 2011 at 3:19 PM, Marc Herber wrote:

> Meanwhile I tried this *java* code:
> PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory(
> "transactions-optional" );
> PersistenceManager pm = pmf.getPersistenceManager();
> Antwort objectById = pm.getObjectById( Antwort.class, parameters.getLong(
> Constants.ID ) );
>
> And this is my *jdocnfig.xml*:
> 
> http://java.sun.com/xml/ns/jdo/jdoconfig";
>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig
> ">
>
>
>
> value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"/>
>
> value="true"/>
> value="true"/>
>
> value="true"/>
>
>
>
> 
>
>
> But I get the subsequent exception:
> javax.jdo.JDOFatalUserException: Application code attempted to create a
> PersistenceManagerFactory named transactions-optional, but one with this
> name already exists!  Instances of PersistenceManagerFactory are extremely
> slow to create and it is usually not necessary to create one with a given
> name more than once.  Instead, create a singleton and share it throughout
> your code.  If you really do need to create a duplicate
> PersistenceManagerFactory (such as for a unittest suite), set the
> appengine.orm.disable.duplicate.pmf.exception system property to avoid this
> error.
>
> Can anybody help me out?!
>
>  --
> 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.
>

-- 
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] Can't fetch a dataset using primary key

2011-01-24 Thread Stephen Johnson
Try changing Ikai's code to include the entity name like:

SELECT * from DB WHERE __key__ = KEY('DB','1')

if your key is a number then

SELECT * from DB WHERE __key__ = KEY('DB',1)

Documentation:

an entity key literal, with either a string-encoded
keyor
a complete
path of kinds and key
names/IDs:


   - KEY('*encoded key*')
   - KEY('*kind*', *'name'/ID* [, '*kind*', *'name'/ID*...])



On Mon, Jan 24, 2011 at 3:14 PM, Marc Herber wrote:

> Thanks for your help. Unfortunatelly this syntax isn't working at all :(
>
> I tried to run this statement within the datastore viewer but I get an
> error "GQL Query".
> Apart from that the link you posted is for python, but I would need it for
> java. Can you/anybody help me with that too?
>
>
> Thanks in advance.
>
> --
> 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.
>

-- 
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] Key only query

2011-01-20 Thread Stephen Johnson
Yes, it works. I use key only queries a lot.  I could help more if you
posted the code with the query.

On Wed, Jan 19, 2011 at 6:52 AM, Kenny  wrote:

> According to:
>
> http://code.google.com/appengine/docs/java/datastore/jdo/queries.html#Queries_on_Keys
>
> We are suppose to be able to get Key only query.  But according to
> this:
>
> http://groups.google.com/group/google-appengine/browse_thread/thread/c9ef645f0f77a53e
>
> Key only result doesn't work.  Has any one tried this and got it
> working?  I gave it a try and I got the result like the second case.
> I got the error:
>
> javax.jdo.JDOUserException: Illegal result clause : PrimaryExpression
> should be a VariableExpression with name id
>
> Now... my attempt have an additional filter on the query.  Does that
> matter?
>
> --
> 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.
>
>

-- 
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] Mutation pool bug?

2011-01-18 Thread Stephen Johnson
Cool! Glad it solved your issue. I'm not sure if it's really documented any
where or just implied someplace. I ran in to the same issue a year ago when
I started mapreduce and I can't remember how I figured out to do that.

On Tue, Jan 18, 2011 at 5:00 AM, Arun Ramanujapuram
wrote:

> Thank you, Stephen. This works. I could not locate this earlier in the
> mapreduce documentation.
>
> Regards,
> Arun
>
> ----------
> *From:* Stephen Johnson 
> *To:* google-appengine-java@googlegroups.com
> *Sent:* Sun, 16 January, 2011 1:33:31 AM
> *Subject:* Re: [appengine-java] Mutation pool bug?
>
> Do you have this defined in your mapper class?
>
> @Override
>
> public void taskCleanup(Context context) {
>
> try {
>
> // make sure to call super classes taskCleanup so that the
> DatastoreMutationPool
>
> // gets flushed properly otherwise puts/deletes can be lost;
>
> super.taskCleanup(context);
>
> } catch (Exception ex) {
>
> log.severe(ex.toString());
>
> }
>
> }
>
>
> On Fri, Jan 14, 2011 at 11:34 PM, armanuj  wrote:
>
>> Hi,
>>
>> I had earlier posted an issue such as "out of mapper quota" earlier
>> (link below). I had about 260 entities being mapped (for a start), and
>> not entities were getting updated. I was using the mutation pool for
>> updates in the map routine. On further investigations, it appears that
>> the mutation pool flushes after every 100 entities in it, and does not
>> do so for the last batch of entities. Out of the 260 entities,
>> everytime 60 entities would NOT be updated, but 200 would be. This
>> appeared to be true even if your entity count was a multiple of 100 -
>> the last 100 were not getting updated. However, this issue does not
>> exist if I get rid of mutation pool, and put entities directly to the
>> datastore - all entities are updated always.
>>
>> Is this is a bug, or is there something I am not doing correctly with
>> mutation pools? The mutation pool code is fairly simple
>> (mutationPool.put(entity)) - just as in Ikai's mapper blog post.
>>
>> Appreciate your help with this.
>>
>> Regards,
>> Arun
>>
>> Earlier post:
>>
>> http://groups.google.com/group/google-appengine-java/browse_thread/thread/fe7fd75e2fa19a7e/a94b0efc6e50c361?hl=en&lnk=gst&q=out+of+mapper+quota#a94b0efc6e50c361
>>
>> --
>> 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.
>>
>>
>  --
> 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.
>
>  --
> 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.
>

-- 
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] can't retreive one-to-may objetcs, JPA

2011-01-18 Thread Stephen Johnson
What I mean is that before you close the entity manager you would need to
loop through your list and call the getSubjects() accessor method to cause
the entity manager to load the subjects. I am not a JPA developer but I did
a quick google search on JPA and it seems that indeed the default fetch
option is lazy (any JPA people please chime in if I'm wrong or is different
on GAE). It seems that the other option (which I'm not sure is supported on
GAE with JPA) is to change the default loading by using FetchType.EAGER in
your @OneToMany annotation.

I hope this helps,
Stephen

On Tue, Jan 18, 2011 at 4:46 AM, Cesar Ruiz  wrote:

> What do you mean by "need to access to the subjects field before closing
> the em?". Do you mean, with the em,  retreive the list of subjects and the
> add them to the list of books?. (That's a workaround, but it is not
> efficient), It's supposed to retreive the books completly with their
> subjetcs also, I might be doing something wrong in the Entities.
>
> Please soome help.
>
>
> On 18 January 2011 00:30, Stephen Johnson  wrote:
>
>> I don't do JPA, but If it's like JDO and you have lazy loading then don't
>> you need to access the subjects field before you close your entity manager
>> to get the subjects loaded? Just a thought.
>>
>>
>> On Mon, Jan 17, 2011 at 3:51 PM, kidowell  wrote:
>>
>>> I cannot retreive the List from book. The save and update of a
>>> book when a subject changes its fine, the problem is when retreiving books,
>>> It doeesnt retreive their subjects. I need help. Here;s the code.
>>>
>>> @Entity
>>> @Table(name = "book")
>>> public class Book implements Serializable, IsSerializable {
>>>
>>> @Id
>>> @GeneratedValue(strategy = GenerationType.IDENTITY)
>>> private Key id;
>>> private String bookName;
>>> private String comment;
>>> @OneToMany(mappedBy="book",cascade = CascadeType.ALL)
>>> private List subjects;
>>>
>>> //setters and getters
>>>
>>> --
>>>
>>> @Entity
>>> @Table(name = "subject")
>>> public class Subject implements Serializable, IsSerializable {
>>>
>>> @Id
>>> @GeneratedValue(strategy = GenerationType.IDENTITY)
>>> private Key id;
>>> private String name;
>>> private int visible;
>>> @Basic
>>> private Text content;
>>> @Basic
>>> @ManyToOne
>>> private Book book;
>>> // setters and getters
>>>
>>>
>>> 
>>>
>>>  public List getBooks() throws GeneralException,
>>> BookNotFoundException, NullParameterException {
>>> entityManager = EMF.get().createEntityManager();
>>> List list;
>>>  try {
>>> String sql = "SELECT b FROM Book b";
>>> list =
>>> entityManager.createQuery(sql).getResultList();  //this list is
>>> retreived with the books but without their subjects
>>> } catch (Exception e) {
>>> throw new GeneralException("Exception in method getBookes: "
>>> + e.getMessage());
>>> } finally {
>>> if (entityManager.isOpen()) {
>>> entityManager.close();
>>> }
>>> }
>>> if (list == null || list.isEmpty()) {
>>>
>>> throw new BookNotFoundException("Book not found in method
>>> getBookes");
>>> }
>>> return list;
>>> }
>>>
>>>
>>> Please, I need some help.
>>>
>>> Cheers.
>>>
>>> --
>>> Kido.
>>>
>>> --
>>> 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.
>>>
>>
>>  --
>> You received this message because you are subscribed

Re: [appengine-java] can't retreive one-to-may objetcs, JPA

2011-01-17 Thread Stephen Johnson
I don't do JPA, but If it's like JDO and you have lazy loading then don't
you need to access the subjects field before you close your entity manager
to get the subjects loaded? Just a thought.

On Mon, Jan 17, 2011 at 3:51 PM, kidowell  wrote:

> I cannot retreive the List from book. The save and update of a
> book when a subject changes its fine, the problem is when retreiving books,
> It doeesnt retreive their subjects. I need help. Here;s the code.
>
> @Entity
> @Table(name = "book")
> public class Book implements Serializable, IsSerializable {
>
> @Id
> @GeneratedValue(strategy = GenerationType.IDENTITY)
> private Key id;
> private String bookName;
> private String comment;
> @OneToMany(mappedBy="book",cascade = CascadeType.ALL)
> private List subjects;
>
> //setters and getters
>
> --
>
> @Entity
> @Table(name = "subject")
> public class Subject implements Serializable, IsSerializable {
>
> @Id
> @GeneratedValue(strategy = GenerationType.IDENTITY)
> private Key id;
> private String name;
> private int visible;
> @Basic
> private Text content;
> @Basic
> @ManyToOne
> private Book book;
> // setters and getters
>
>
> 
>
>  public List getBooks() throws GeneralException,
> BookNotFoundException, NullParameterException {
> entityManager = EMF.get().createEntityManager();
> List list;
>  try {
> String sql = "SELECT b FROM Book b";
> list =
> entityManager.createQuery(sql).getResultList();  //this list is
> retreived with the books but without their subjects
> } catch (Exception e) {
> throw new GeneralException("Exception in method getBookes: " +
> e.getMessage());
> } finally {
> if (entityManager.isOpen()) {
> entityManager.close();
> }
> }
> if (list == null || list.isEmpty()) {
>
> throw new BookNotFoundException("Book not found in method
> getBookes");
> }
> return list;
> }
>
>
> Please, I need some help.
>
> Cheers.
>
> --
> Kido.
>
> --
> 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.
>

-- 
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] Mutation pool bug?

2011-01-15 Thread Stephen Johnson
Do you have this defined in your mapper class?

@Override

public void taskCleanup(Context context) {

try {

// make sure to call super classes taskCleanup so that the
DatastoreMutationPool

// gets flushed properly otherwise puts/deletes can be lost;

super.taskCleanup(context);

} catch (Exception ex) {

log.severe(ex.toString());

}

}


On Fri, Jan 14, 2011 at 11:34 PM, armanuj  wrote:

> Hi,
>
> I had earlier posted an issue such as "out of mapper quota" earlier
> (link below). I had about 260 entities being mapped (for a start), and
> not entities were getting updated. I was using the mutation pool for
> updates in the map routine. On further investigations, it appears that
> the mutation pool flushes after every 100 entities in it, and does not
> do so for the last batch of entities. Out of the 260 entities,
> everytime 60 entities would NOT be updated, but 200 would be. This
> appeared to be true even if your entity count was a multiple of 100 -
> the last 100 were not getting updated. However, this issue does not
> exist if I get rid of mutation pool, and put entities directly to the
> datastore - all entities are updated always.
>
> Is this is a bug, or is there something I am not doing correctly with
> mutation pools? The mutation pool code is fairly simple
> (mutationPool.put(entity)) - just as in Ikai's mapper blog post.
>
> Appreciate your help with this.
>
> Regards,
> Arun
>
> Earlier post:
>
> http://groups.google.com/group/google-appengine-java/browse_thread/thread/fe7fd75e2fa19a7e/a94b0efc6e50c361?hl=en&lnk=gst&q=out+of+mapper+quota#a94b0efc6e50c361
>
> --
> 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.
>
>

-- 
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] Filtering more than 3 parameters in JDOQL

2011-01-15 Thread Stephen Johnson
There's another function executeWithArray on the query object that you  
can use.


Sent from my iPhone

On Jan 15, 2011, at 5:08 AM, Vik  wrote:


Hie

I am not able to pass more than 3 parameters using below code. So,  
how to pass more than 3 parameters?


Query query = pm.newQuery(BloodDonor.class);
			query.setFilter(" state == :stateName && district == :distName  
&&" +

" city == :cityName && bloodGroup == 
:blood");
@SuppressWarnings("unchecked")
			List donors = (List) query.execute 
(state.toLowerCase(), district.toLowerCase(),

city.toLowerCase(), 
bloodGroup.toLowerCase());


Thankx and Regards

Vik
Founder
www.sakshum.com
www.sakshum.blogspot.com
--
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 
.


--
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: JDO - Set property question

2011-01-11 Thread Stephen Johnson
I never stated whether it was valid per JDO spec. I just stated that Matthew
was incorrect and his explanation of why the syntax was incorrect was also
incorrect. This is an app engine forum so it was implied that the
incorrectness pertained to app engine. If you wish to point out differences
between the JDO spec and app engine please send that to Google. I didn't
write app engine.

On Sat, Jan 8, 2011 at 4:31 AM, datanucleus wrote:

> > That is incorrect. You can specify a filter using the == with a single
> value
> > and a list or set such as
>
> You mean AppEngine allows you to; this doesn't mean it is correct to
> do that. JDOQL prohibits it (see the spec). JDOQL follows Java, and
> the syntax Matthew gave is the valid one, not this. If you want your
> query to work reliably with any future version you ought to use
> Collection.contains() syntax.
>
> --
> 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: JDO - Set property question

2011-01-07 Thread Stephen Johnson
That is incorrect. You can specify a filter using the == with a single value
and a list or set such as

query.setFilter("keywords == keywordParam");
query.declareParameters("String keywordParam");

This works just fine in JDO on AppEngine.



On Fri, Jan 7, 2011 at 8:06 AM, Matthew Adams wrote:

> Your query as written is testing for whether oneLocation is equal to
> locations and oneCategory is equal to categories.  That will never be
> true (I hope), because a Set will never equal a Key.  What you
> mean is are they **contained by** their respective collections:
>
> select AdPost where locations.contains(oneLocation) &&
> categories.contains(oneCategory)
>
> See section 14.6.2 (p.167) of the JDO 3.0 specification, covering
> JDOQL filter expressions.  Page 170 contains a table of the methods
> allowed in JDOQL.  The JDO 3.0 specification can be downloaded from
> http://jcp.org/aboutJava/communityprocess/mrel/jsr243/index3.html
>
> -matthew
>
> On Jan 7, 5:24 am, Ravi Sharma  wrote:
> > Hi,
> > I have a entity like this
> > Class AdPost{
> > ...few property
> > Set locations;
> > Set categories;
> >
> > }
> >
> > when i am running a query like
> > select AdPost where locations = oneLocation && categories == oneCategory
> > (pseudo code)
> > where oneLocation is one valid key of a location and oneCategory is a
> valid
> > key of one category.
> >
> > After running this i expect to get list of AdPost but  it returns me null
> > and no error.
> > Is it allowed to run euqality on two collection property in same query?
> >
> > Thanks,
> > Ravi
>
> --
> 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: JDO - I can't update an object with One-to-One Relationships

2011-01-04 Thread Stephen Johnson
I just took a quick glance at your original post. The only thing I can think
of is that in the original code you don't call getLastLocation so if you
have lazy loading on then that object wouldn't get loaded and perhaps then
the JDO mechanism doesn't realize to get the old object and delete it and
re-assign the new object. In your original code I'd try doing a
getLastLocation call to force the load. I use JDO but I don't use it's
automatic relationship management. I manage all my relationships myself so I
have complete control and don't need to then worry about these issues so in
essence JDO for me is just a simple mapper between Java and the Datastore
and it works very well for me.

On Tue, Jan 4, 2011 at 10:56 AM, yoyo  wrote:

> I don't really have to do like that. Your solution is more clean and I will
> use it. Thanks.
> But for learning purpose, I've used some others methods.
> I don't know why i can't update a children reference per another.
> In fact, the new object is in the datastore. When I manually delete the
> first reference, the parent now refer his new children. Weird.
>
> 2011/1/4 Stephen Johnson 
>
>  Why do you have to delete the location entity? Why not just update the
>> current location entity with the new coordinates? That would be much
>> more efficient.
>>
>>
>> On Tue, Jan 4, 2011 at 10:20 AM, yoyo  wrote:
>>
>>> The update still don't works. I give up.
>>>
>>> I use the "@Persistent(dependent = "true")" and add the delete
>>> instruction when I update the user location, in a transaction.
>>> Now it works, but I think it's not very clean/efficient.
>>>
>>> Have a nice day.
>>>
>>>  public void updateUserLocation(String username, Location newLocation) {
>>>  PersistenceManager pm = PMF.getPersistenceManager();
>>> Transaction tx = pm.currentTransaction();
>>> try {
>>>
>>>// Get the user and update the location
>>>
>>>tx.begin();
>>> POJOUser user = pm.getObjectById(POJOUser.class, username);
>>>pm.deletePersistent(user.getLastLocation());
>>>user.setLastLocation(new POJOLocation(newLocation));
>>>tx.commit();
>>>
>>> } catch (JDOObjectNotFoundException ex) {
>>>
>>> } finally {
>>>
>>>if (tx.isActive()) {
>>> tx.rollback();
>>>}
>>>pm.close();
>>> }
>>> }
>>>
>>>  @PersistenceCapable
>>> public class POJOUser {
>>>
>>> /** Primary key */
>>> @PrimaryKey
>>> @Persistent
>>> private String key = null;
>>>
>>> /** Username */
>>> @Persistent
>>> private String username = null;
>>>
>>> /** Password */
>>> @Persistent
>>> private String password = null;
>>>
>>> /** The last location of the user */
>>> @Persistent(dependent = "true")
>>> private POJOLocation lastLocation = null;
>>>  ...
>>> }
>>>
>>>  @PersistenceCapable
>>> public class POJOLocation implements Location {
>>>
>>> /** Primary key */
>>> @PrimaryKey
>>> @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>>> private Key key = null;
>>>
>>> /** X */
>>> @Persistent
>>> private Double x = null;
>>>
>>> /** Y */
>>> @Persistent
>>> private Double y = null;
>>> 
>>> }
>>>
>>>
>>>   --
>>> 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.
>>
>
>   --
> 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: JDO - I can't update an object with One-to-One Relationships

2011-01-04 Thread Stephen Johnson
Why do you have to delete the location entity? Why not just update the
current location entity with the new coordinates? That would be much
more efficient.


On Tue, Jan 4, 2011 at 10:20 AM, yoyo  wrote:

> The update still don't works. I give up.
>
> I use the "@Persistent(dependent = "true")" and add the delete instruction
> when I update the user location, in a transaction.
> Now it works, but I think it's not very clean/efficient.
>
> Have a nice day.
>
>  public void updateUserLocation(String username, Location newLocation) {
>  PersistenceManager pm = PMF.getPersistenceManager();
> Transaction tx = pm.currentTransaction();
> try {
>
>// Get the user and update the location
>
>tx.begin();
> POJOUser user = pm.getObjectById(POJOUser.class, username);
>pm.deletePersistent(user.getLastLocation());
>user.setLastLocation(new POJOLocation(newLocation));
>tx.commit();
>
> } catch (JDOObjectNotFoundException ex) {
>
> } finally {
>
>if (tx.isActive()) {
> tx.rollback();
>}
>pm.close();
> }
> }
>
>  @PersistenceCapable
> public class POJOUser {
>
> /** Primary key */
> @PrimaryKey
> @Persistent
> private String key = null;
>
> /** Username */
> @Persistent
> private String username = null;
>
> /** Password */
> @Persistent
> private String password = null;
>
> /** The last location of the user */
> @Persistent(dependent = "true")
> private POJOLocation lastLocation = null;
>  ...
> }
>
>  @PersistenceCapable
> public class POJOLocation implements Location {
>
> /** Primary key */
> @PrimaryKey
> @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> private Key key = null;
>
> /** X */
> @Persistent
> private Double x = null;
>
> /** Y */
> @Persistent
> private Double y = null;
> 
> }
>
>
>   --
> 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] passing multiple parameters to JDOQL

2010-12-29 Thread Stephen Johnson
You need to do it like this:

  query.declareParameters("Long bind_pocId, Date bind_startDate, Date
bind_endDate");

However, unless you've normalized your dates on midnight or something I
don't think this will work they way you want since date objects have
millisecond precision.

On Wed, Dec 29, 2010 at 7:46 AM, Vik  wrote:

> Hie
>
> I am trying to pass multiple parameters as follows
>
>   Query query = pm.newQuery(PocVacationSchedule.class);
>  query.setFilter("pocId == bind_pocId && startDate ==
> bind_startDate && endDate == bind_endDate");
>  query.declareParameters("Long bind_pocId");
>  query.declareParameters("Date bind_startDate");
>  query.declareParameters("Date bind_endDate");
>  List rulesList =
> (List)query.execute(pocId, startFrom, endFrom);
>
> And it throws exception passed 3 parameters where query is expecting 1.
>
> So, what I am doing wrong here?
>
>
>
> Thankx and Regards
>
> Vik
> Founder
> www.sakshum.com
> www.sakshum.blogspot.com
>
> --
> 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] low-lewel put method outside of a transaction

2010-12-22 Thread Stephen Johnson
You might want to take a look at CommittedButStillApplyingException

On Tue, Dec 21, 2010 at 1:08 PM, ss.require  wrote:

> Please, help!
> According to this:
> http://code.google.com/intl/uk-UA/appengine/articles/life_of_write.html.
>
> Let's suppose that I call the low-level put method outside of a
> transaction and an exception throws. If exception occures at the
> commit phase entity won't be saved otherwise if exception occures at
> the applyed phase entity will be saved.
>
> Is there a way to find out entity is really saved or not in the
> datastore after exception?
>
> If I execute the same operation inside a transaction, for exampe:
> Transaction tx = datastore.beginTransaction();
> try {
>   put entity code ...
>  tx.commit();
> } finally {
>  if (tx.isActive()) {
>tx.rollback();
> }
> Suppose exception occures in the apply phase, then  tx.rollback() will
> be fired? Can it make sure that enitty really won't be saved in the
> datastore?
>
> --
> 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: Customizing warmup with a Servlet mapped to _ah_warmup

2010-12-21 Thread Stephen Johnson
My bad, it should be:


 _ah_warmup
 com.your.servlet.Here




On Tue, Dec 21, 2010 at 1:21 PM, Stephen Johnson wrote:

> I should add that there is no need to invoke GAE's default warming. I'm
> sure it's basically a no-op and just gets the basic servlet classes loaded
> that your own servlet will do by being invoked.
>
>
> On Tue, Dec 21, 2010 at 1:10 PM, Stephen Johnson 
> wrote:
>
>> Just map a servlet to 
>> /_ah/warmup<https://appengine.google.com/logs?version_id=4.347075438648158995&app_id=my-lms-test&filter_type=labels&filter=path%3A%22%2F_ah%2Fwarmup%22&severity_level_override=1&view=Search>in
>>  your web.xml. This will override the default one provided by app engine.
>>
>>
>> On Tue, Dec 21, 2010 at 11:51 AM, John  wrote:
>>
>>> Trying ServletContext#getServletRegistration was disappointing, since
>>> ServletContext#getServletRegistrations and
>>> ServletContext#getServletRegistration are not implemented on
>>> com.google.apphosting.utils.jetty.AppEngineWebAppContext$AppEngineServletContext
>>> while ServletContext#getServlet returns null and
>>> ServletContext#getServlets returns an empty Enumeration (as documented).
>>>
>>> I'm now thinking I should install a filter that will do the
>>> initialization after calling FilterChain#doFilter. I'll see if I can a
>>> filter to run if mapped by the url-pattern '/_ah/warmup'.
>>>
>>>
>>> Please let me know if there's a more straightforward way to invoke GAE's
>>> default warming.
>>>
>>> Thanks!
>>> John
>>>
>>>
>>>  --
>>> 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: Customizing warmup with a Servlet mapped to _ah_warmup

2010-12-21 Thread Stephen Johnson
I should add that there is no need to invoke GAE's default warming. I'm sure
it's basically a no-op and just gets the basic servlet classes loaded that
your own servlet will do by being invoked.

On Tue, Dec 21, 2010 at 1:10 PM, Stephen Johnson wrote:

> Just map a servlet to 
> /_ah/warmup<https://appengine.google.com/logs?version_id=4.347075438648158995&app_id=my-lms-test&filter_type=labels&filter=path%3A%22%2F_ah%2Fwarmup%22&severity_level_override=1&view=Search>in
>  your web.xml. This will override the default one provided by app engine.
>
>
> On Tue, Dec 21, 2010 at 11:51 AM, John  wrote:
>
>> Trying ServletContext#getServletRegistration was disappointing, since
>> ServletContext#getServletRegistrations and
>> ServletContext#getServletRegistration are not implemented on
>> com.google.apphosting.utils.jetty.AppEngineWebAppContext$AppEngineServletContext
>> while ServletContext#getServlet returns null and
>> ServletContext#getServlets returns an empty Enumeration (as documented).
>>
>> I'm now thinking I should install a filter that will do the initialization
>> after calling FilterChain#doFilter. I'll see if I can a filter to run if
>> mapped by the url-pattern '/_ah/warmup'.
>>
>>
>> Please let me know if there's a more straightforward way to invoke GAE's
>> default warming.
>>
>> Thanks!
>> John
>>
>>
>>  --
>> 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: Customizing warmup with a Servlet mapped to _ah_warmup

2010-12-21 Thread Stephen Johnson
Just map a servlet to
/_ah/warmupin
your web.xml. This will override the default one provided by app
engine.

On Tue, Dec 21, 2010 at 11:51 AM, John  wrote:

> Trying ServletContext#getServletRegistration was disappointing, since
> ServletContext#getServletRegistrations and
> ServletContext#getServletRegistration are not implemented on
> com.google.apphosting.utils.jetty.AppEngineWebAppContext$AppEngineServletContext
> while ServletContext#getServlet returns null and
> ServletContext#getServlets returns an empty Enumeration (as documented).
>
> I'm now thinking I should install a filter that will do the initialization
> after calling FilterChain#doFilter. I'll see if I can a filter to run if
> mapped by the url-pattern '/_ah/warmup'.
>
>
> Please let me know if there's a more straightforward way to invoke GAE's
> default warming.
>
> Thanks!
> John
>
>
>  --
> 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] CPU time obtained via QuotaService much lower than CPU time reported in request logs

2010-12-14 Thread Stephen Johnson
You need to add the CPU and API times together from the QuotaService to get
the CPU time in the log. The QuotaService keeps them separate while the log
adds them together. So in the log the API time reported is the API time but
the CPU time in the log is actually CPU + API time which is inconsistent
with the QuotaService. Also, it will never match perfectly since there is
still going to be some overhead from the time you call the QuotaService and
the actual end of your request by AppEngine but it should be closer.

On Tue, Dec 14, 2010 at 6:14 PM, Huy  wrote:

> My app is giving me warnings about my CPU usage, and I tried using the
> QuotaService functions to profile the code, but the numbers I get back are
> about a magnitude lower than the number that shows up in the request log.
>
> I called QuotaService.getCpuTimeInMegacycles() at the beginning and end of
> doPost() and I'll get like 146ms vs 1058cpu_ms in the request logs.
>
> What's going on here?
>
> 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.
>

-- 
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: Massive delete (mapreduce based) > Datastore viewer & Datastore statistics unavailable

2010-12-13 Thread Stephen Johnson
Thanks for the update. I'm glad it fixed itself. It's another little thing
to remember about GAE and how it works.

On Mon, Dec 13, 2010 at 6:51 AM, crllvnc  wrote:

> Hi Stephen,
>
> You were right! After a while (maybe 20/30 hours), the datastore
> viewer became available again.
>
> Best regards,
> cyrille
>
> On 10 déc, 16:15, Stephen Johnson  wrote:
> > Are you still having this issue? I'm curious to learn if this has cleared
> up
> > because here's a random guess. When entities are deleted they are just
> > marked as deleted and then later garbage collected, so perhaps the
> datastore
> > viewer has a very low timeout set and it is starting with the beginning
> of
> > the key index and having to scan millions of those deleted entities and
> is
> > timing out before it finds enough results. Your own queries might be
> working
> > because they are using a different index than the key index and have the
> > full default timeout period and are finding the entities to satisfy your
> > queries. Has this magically cleared up for you. If so, it might be
> because
> > the garbage collection mechanism has removed those deleted entities.
> Anyway
> > it is just a guess and I'm curious if this is the case because it might
> be
> > that people may want to run slower delete jobs so as not to impact their
> > performance.
> >
> >
> >
> > On Thu, Dec 9, 2010 at 2:07 AM, Cyrille Vincey 
> wrote:
> > > My problem:
> > > 1. I execute a massive delete over a large number of entities (30
> million),
> > > using a mapreduce-based job similar to Ikai's one (*)
> > > 2. Then both the datastore viewer and the datastore statistics in the
> > > dashboard become unavailable: I get this famous "the server encountered
> an
> > > error (blahblah)" page.
> >
> > > Yet, servlet-based queries against the datastore are ok, and the
> datastore
> > > indexes viewer do not show any error.
> > > Any clue ?
> >
> > > (*)
> > >http://ikaisays.com/2010/07/09/using-the-java-mapper-framework-for-ap.
> ..
>
> --
> 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] Can you add Handlers to the root logger?

2010-12-12 Thread Stephen Johnson
Hi Andrew,
Perhaps my write up on my XMPP Log Hander might help. It adds a log handler
to GAE which sends log messages via XMPP. You can check it out at
http://www.professionalintellectualdevelopment.com
Hope it helps,
Stephen


On Sun, Dec 12, 2010 at 6:05 PM, Andrew  wrote:

> Hello,
>
> We're trying to add a handler to the root logger, which seems to work
> in dev, but, doesn't work in live. Our specific use case is that we
> are trying to add a Handler to facilitate sending log messages of a
> particular level to a remote log aggregation service.
>
> Has anyone had success in adding a handler to the root logger? If so,
> could you please detail your experience.
>
> We have tried things like:
> * Adding directly to the root logger through static initialization in
> Guice. This works in dev but gets a security exception
> (LoggingPermission) in live.
> * Various combinations of AOP.
> * Using logging.properties to explicitly define the logger. This was
> the most promising lead and actually seemed to be working, but,
> ultimately suffered the same problematic fate.
>
> We're currently exploring mitigation options like a logging facade
> (SLF4J or possibly just subclassing Logger), but, this has a host of
> obvious problems (no support for 3rd party libraries etc). Another
> option is to potentially try and use the admin logging console.
>
> If pertinent our app stack is GWT on Guice.
>
> Also, if we're lucky enough to have someone from the Google GAE team
> look at this it would be terrific to understand a little bit about the
> technical detail of logging for java in GAE. There is a reasonable
> amount of conflicting information around the web which has resulted in
> a lot of burnt time. An authoritative view would be very helpful and
> of obvious benefit when trying to design these types of solutions.
>
> Regards,
>
> - Andrew.
>
> --
> 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] Massive delete (mapreduce based) > Datastore viewer & Datastore statistics unavailable

2010-12-10 Thread Stephen Johnson
Are you still having this issue? I'm curious to learn if this has cleared up
because here's a random guess. When entities are deleted they are just
marked as deleted and then later garbage collected, so perhaps the datastore
viewer has a very low timeout set and it is starting with the beginning of
the key index and having to scan millions of those deleted entities and is
timing out before it finds enough results. Your own queries might be working
because they are using a different index than the key index and have the
full default timeout period and are finding the entities to satisfy your
queries. Has this magically cleared up for you. If so, it might be because
the garbage collection mechanism has removed those deleted entities. Anyway
it is just a guess and I'm curious if this is the case because it might be
that people may want to run slower delete jobs so as not to impact their
performance.

On Thu, Dec 9, 2010 at 2:07 AM, Cyrille Vincey  wrote:

> My problem:
> 1. I execute a massive delete over a large number of entities (30 million),
> using a mapreduce-based job similar to Ikai's one (*)
> 2. Then both the datastore viewer and the datastore statistics in the
> dashboard become unavailable: I get this famous "the server encountered an
> error (blahblah)" page.
>
> Yet, servlet-based queries against the datastore are ok, and the datastore
> indexes viewer do not show any error.
> Any clue ?
>
> (*)
> http://ikaisays.com/2010/07/09/using-the-java-mapper-framework-for-app-engine
> /
>
>  --
> 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] JSF: sudden ViewExpiredException on GAE

2010-12-07 Thread Stephen Johnson
Well, I'll take a wild stab at it since I don't know Java Server Faces, but
since you say it was working and now has stopped. Do you have
true in your appengine-web.xml? If not,
add it. As of 1.4 this is now being adhered to whereas prior to this
sessions were enabled regardless. So perhaps even with sessions not enabled
you are able to get a session object from the servlet context for that
initial request but the appengine isn't saving state to the datastore so the
next request gets told that the requested session identifer is not
valid/expired.

On Tue, Dec 7, 2010 at 12:50 PM, Nick Belaevski  wrote:

> Hello all,
>
> I've suddenly stuck with JavaServer Faces application stopped working at
> GAE. Investigation shows that view state is not being stored in session
> correctly.
> What I also found out is that when the first request is being done (i.e.
> with clean session), ajax requests are working; but when another view is
> requested, ajax is not working there anymore. I assumed this is because
> updated view state is not being stored, and tried to make a slight change:
>
> a)  as is:
>
> Map statesMap = session.get("state");
> if (statesMap == null) {
> statesMap = new HashMap();
> session.put("state", statesMap);
> }
>
> statesMap.put("...", state);
> //force update in cluster
> session.put("state", statesMap);
>
> b) with the slight change:
> Map statesMap = session.get("state");
> if (statesMap == null) {
> statesMap = new HashMap();
> session.put("state", statesMap);
> }
>
> statesMap.put("...", state);
> //force update in cluster
> session.remove("state");
> session.put("state", statesMap);
>
> However the solution is not very good, so can please someone help with the
> problem?
>
> P.S. Runnable demo example is available here:
> http://java.net/jira/browse/JAVASERVERFACES-1886
>
> --
> 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] jsessionid not present anymore

2010-12-03 Thread Stephen Johnson
Well, they just pushed version 1.4 and it may be that the sessions-enabled
flag wasn't enforced and now with version 1.4 perhaps it is. Sounds like you
may have to set the cookie yourself if you don't want to enable sessions for
some reason.

On Fri, Dec 3, 2010 at 12:13 AM, Ioan  wrote:

> I still have false in my
> appengine-web.xml. I have this value to false from beginning since I store
> them on the server in my way. In the development environment cookies are
> working as exepcted but on the live environment, jsessionid is not set.
>
>
>
> --
> 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] jsessionid not present anymore

2010-12-02 Thread Stephen Johnson
My session cookies are working. Have you verified you still have:
true
in your appengine-web.xml file.
Steve

On Thu, Dec 2, 2010 at 3:00 PM, Ioan  wrote:

> Hello to all,
> I develop my application since about 5 months and everything looked ok till
> two days ago. I've noticed that suddenly I do not have jsessionid cookie
> anymore in the responses from the server. This is strange since in the last
> days i did not uploaded any version of my application and in the last 5
> months I had no issue with jsessionid.
> I can see the other cookies are set correctly(i.e the one for the language)
> so it's not the browser that does not accept cookies.
> I'm running out of ideas and I'm a bit frustrated since my app works in a
> bad way. Did any of you experienced similar (maybe in the last days?)?
> Cheers
> Ioan
>
> --
> 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: data in xml format from data store

2010-12-01 Thread Stephen Johnson
I believe Ikai's statement "The 30 second limit is imposed on the time it
takes the servlet to finish." is confirming what I said.

On Wed, Dec 1, 2010 at 5:52 PM, pac  wrote:

> Hi Ikai,
>
> If you could confirm this - from earlier Stephen's post:
>
> "then I think you
> will be safe even though it might take another minute or two for
> Google's
> infrastructure to stream it to the client. I have not tested this
> though.
> Can anyone confirm or deny this assumption on my part."
>
> is download outside 30 sec limit i.e. after servlet finished in 30
> seconds?
>
> Thanks.
>
> On Dec 1, 12:00 am, "Ikai Lan (Google)" 
> 
> >
> wrote:
> > The 30 second limit is imposed on the time it takes the servlet to
> finish.
> >
> > --
> > 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 Mon, Nov 29, 2010 at 10:13 AM, Stephen Johnson <
> onepagewo...@gmail.com>wrote:
> >
> >
> >
> > > I believe the 30 second limit is imposed on the time it takes for your
> > > servlet to finish. Thus, if your servlet finished generating and
> returning
> > > the file to the AppEngine infrastructure in 29 seconds, then I think
> you
> > > will be safe even though it might take another minute or two for
> Google's
> > > infrastructure to stream it to the client. I have not tested this
> though.
> > > Can anyone confirm or deny this assumption on my part.
> >
> > > On Mon, Nov 29, 2010 at 10:57 AM, pac 
> wrote:
> >
> > >> Sorry, did not see your post earlier Stephen.
> >
> > >> I was not aware of this 10 minute feature to create a file, I will
> > >> look into.
> >
> > >> File size will be greater then 10MB, it is an existing website which I
> > >> am thinking to port to gae, file size already gets around 12MB or so.
> >
> > >> So I guess more than 10MB download will be an issue and I guess
> > >> download should also complete in 30 second, is that so?
> >
> > >> On Nov 29, 5:37 pm, pac  wrote:
> > >> > A client will download a xml file instead of uploading.
> > >> > Records will be created (or updated, deleted) in a table/kind over
> > >> > time and all records from a kind need to be downloaded in form of a
> > >> > xml file, I hope I am explaining the issue bit more clearly.
> >
> > >> > I am not sure if I could make use of blobstore in this case as it
> will
> > >> > require update of blobstore object (in background may be using task)
> > >> > every time a record gets added/updated/deleted i.e. if I create xml
> > >> > file programmaticaly and store as blobstore object.
> >
> > >> > On Nov 29, 5:14 pm, Didier Durand  wrote:
> >
> > >> > > Hi,
> >
> > >> > > To emulate files, you have to use the Blob object in the datastore
> to
> > >> > > store such xml content: see
> com.google.appengine.api.datastore.Blob
> > >> inhttp://
> code.google.com/appengine/docs/java/datastore/dataclasses.html.
> > >> ..
> >
> > >> > > Blob has a limited max size: 1 Mbyte. So, you can use a collection
> > >> > > (Vector, List, etc..)  of Blobs if you need more than 1 Mbytes.
> >
> > >> > > If your files get uploaded by a client, you can use the Blobstore
> > >> > > where the max size is much bigger(2 Gbytes): seehttp://
> > >> code.google.com/appengine/docs/java/blobstore/overview.html
> >
> > >> > > You have to associate the blob with some other fields (name, size,
> > >> > > last_updated) in you pojo to reproduce what you expect from a
> file.
> >
> > >> > > N.B. if you need to emulate a directory tree, you also have to
> write
> > >> > > it by yourself.
> >
> > >> > > Finally, I would recommend alternative Objectify rather than
> standard
> > >> > > JDO for such services.
> >
> > >> > > Hope this helps
> >
> > >> > > regards
> > >> > > didier
> >
> > >> > > On Nov 29, 5:53 pm, pac  wrote:
> >
> > >> > > > In a website I need to provide a feature to get data in xml
> format
> > >> > > 

[appengine-java] Real-Time Log Delivery Via XMPP

2010-12-01 Thread Stephen Johnson
I'm not sure if anyone is interested in this type of capability but I had a
use for it for my own debugging and monitoring purposes so I thought I'd
share what I came up with especially since people seem to be losing their
logs or at least they aren't showing up for a while. You can read my post at
www.professionalintellectualdevelopment.com.
Stephen

-- 
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.



  1   2   >