[appengine-java] Reading Blobstore data

2011-07-07 Thread Luca Matteis
Hello,

I'm trying to simply read blobstore data without using the .serve()
method. It seems like I can use the .fetchData() method, but the
parameters needed are unclear to me and how I would generate them.

I just need to read all the bytes. For example if I store a plain/text
file in the blobstore, I want to read it as a String so that I can
parse it and do something else with it.

Any ideas?
Thanks,
Luca

-- 
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] .getKey().getId()

2011-05-07 Thread Luca Matteis
.getKey().getId() returns an incremental number (starts from 1) on the
development server. However on the live server (when I deploy it to
Google) this number is quite large, for example 22007.

How come? Can I get incremental numbers starting from 1 on the live
server as it is on the development server?

Thanks.

Luca

-- 
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] Some details on how GAE actually works

2011-04-30 Thread Luca Matteis
App Engine has been abstracting all their implementation details away
from the developer, which is great. I'm however a little curious in
knowing how their infrastructure works... not only how it works but
also how it scales geographically. Living in Europe this has a strong
impact on my decision to use App Engine or not.

Has any detail been delivered by Google on this?

-- 
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] Are urls with /ah/* automatically protected?

2011-04-22 Thread Luca Matteis
These pages are only available on the development server, not when
your site goes live. So it should be safe enough :)

On Fri, Apr 22, 2011 at 11:18 AM, Marcel Overdijk
marceloverd...@gmail.com wrote:
 I'm wonderinf if urls starting with /ah/* (like /_ah/queue/
 __deferred__) are automatically protected or that I should configure a
 security constraint.

 --
 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: Data being stored in a weird way

2011-04-20 Thread Luca Matteis
Didier, I don't think that has anything to do with the java source file.

On Wed, Apr 20, 2011 at 10:53 AM, Amit Pandey amit.s...@gmail.com wrote:
 Hi Didier,

 I have almost same problem. I'm not able to store þ (thorn) char in
 datastore. I'm using String as a data type.

 Thanks,
  Amit

 On Wed, Apr 20, 2011 at 10:08 AM, Didier Durand durand.did...@gmail.com
 wrote:

 Hi,

 Are you using eclipse ?  if yes check under File  Properties  Text
 File encoding that your file is UTF-8 encoding.

 I would guess not.

 So, change it to UTF-8 and your issue should get fixed.

 regards

 didier

 On Apr 19, 6:32 pm, Luca Matteis lmatt...@gmail.com wrote:
  I posted a question on StackOverflow about my data being stored with
  weird chars, and it only happens live, which is very strange.
 
  Here's the
  question:http://stackoverflow.com/questions/5707266/google-app-engine-data-bei...
 
  Am I missing something?

 --
 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] Data being stored in a weird way

2011-04-19 Thread Luca Matteis
I posted a question on StackOverflow about my data being stored with
weird chars, and it only happens live, which is very strange.

Here's the question:
http://stackoverflow.com/questions/5707266/google-app-engine-data-being-stored-in-a-weird-way

Am I missing something?

-- 
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] What are you opinions about yesterdays announced opensource Cloudcoundry PaaS

2011-04-13 Thread Luca Matteis
I think it's still a mystery so far. They seem to want to follow App
Engine's philosophy and free the developer from all the sys-admin
work, yet they provide implementation details (MySQL, Redis, and
MongoDB are listed on their site). This means that the developer will
still need to do some sys-admin work based on the implementation of
data-storage they choose, unless they provide APIs that work for all
those different implementations - I doubt it since data is stored very
differently in MySQL compared to MongoDB.

So I think it's just another cloud-hosting provider (think of
RackSpace), and I have no idea how they're going to scale MySQL :).

On Wed, Apr 13, 2011 at 12:40 PM, Marcel Overdijk
marceloverd...@gmail.com wrote:
 What are you opinions about yesterdays announced opensource
 Cloudcoundry PaaS compared to Google 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-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] Owned relationship. Lost reference

2011-04-10 Thread Luca Matteis
I have a Recipe entity that contains two images:

@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable=true)
public class Recipe {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private MyImage myImage; // full-size image
@Persistent
private MyImage thumb; // 224x230 thumbnail version of the above

When I persist this to the datastore, the images are stored correctly.
However the issue comes when I try referencing the images using
`.getMyImage()` and `.getThumb()`.
They both point to the same object even though I can see in the
datastore viewer that they are two images of different size. If they
are stored in the datastore corretly this means that there's an issue
with how I reference the object I suppose. Why is this?

This is the object I persist, and as you can see the `myImage` and
`thumb` objects are different (not showing the code for them, but
trust me they are).

Recipe recipe = new Recipe(user.getKey(), title, new Text(content),
myImage, thumb, tagsAsStrings);

Any ideas why I keep on referencing the same object?

-- 
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 - Updating a One-to-one child

2011-04-08 Thread Luca Matteis
Here's the entire piece of code that handles the update. I changed it
to setAvatar() (line 42) and it's on a `MyUser` object instead of a
Recipe, but it's the same thing:

http://codepad.org/qPo2ZyBX

I also update the 'name' of the user, and the update works fine...
just as I said, the object still points to the first image instead of
the one added.

On Fri, Apr 8, 2011 at 10:11 AM, Ian Marshall ianmarshall...@gmail.com wrote:
 Hi Luca,

 What's your code for

  r.setImage(newImage)

 and anything else that might be relevant?

 Ian



 On Apr 7, 4:25 pm, Luca Matteis lmatt...@gmail.com wrote:
 Hello Ian, I tried using your exact piece of code. Still same results.
 The recipe still points to the first image instead of the most
 recently added one.

 On Thu, Apr 7, 2011 at 5:20 PM, Ian Marshall ianmarshall...@gmail.com 
 wrote:
  Do you use transactions?

  Instead of your

   PersistenceManager pm = PMF.get().getPersistenceManager();
   Recipe r = pm.getObjectById(Recipe.class, recKey);
   try
   {
     r.setImage(newImage);
   }
   finally
   {
     pm.close();
   }

  have you tried

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

       Recipe r = pm.getObjectById(Recipe.class, recKey);
       r.setImage(newImage);

       tx.commit();
     }
     finally
     {
       try
       {
         if (tx.isActive())    // Because of an exception, say
           tx.rollback();
       }
       finally
       {
         pm.close();
       }
     }

  On Apr 7, 3:03 pm, Luca Matteis lmatt...@gmail.com wrote:
  This is really weird. I cannot find anything on the internet that
  could help me. It seems such a simple thing to be editing child
  objects and I find it ridiculous that I can't find a solution.

  please help

  On Thu, Apr 7, 2011 at 11:53 AM, Luca Matteis lmatt...@gmail.com wrote:
   Well, I would think the Key has relationship information. The thing is
   that I'm able to fetch the image for the recipe, so the relationship
   is there somehow. It seems as if setImage() isn't enough for the
   linkage to update to the latest image.

   On Thu, Apr 7, 2011 at 11:29 AM, Simon Knott knott.si...@gmail.com 
   wrote:
   Yes, that's what I would have expected - how else would a recipe ever 
   retain
   which image it is related to?  Is the relationship purely stored 
   within the
   key of the Image?

   I must admit that without any knowledge of JDO and its relationship
   management, I'm just making wild guesses!

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



Re: [appengine-java] Re: JDO - Updating a One-to-one child

2011-04-08 Thread Luca Matteis
The MyUser entity:

http://codepad.org/C2qRTTRt

and the MyImage entity:

http://codepad.org/xR6hhuU8

On Fri, Apr 8, 2011 at 11:00 AM, Simon Knott knott.si...@gmail.com wrote:
 Can you post the code for your MyUser and the MyImage classes as well?

 --
 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 - Updating a One-to-one child

2011-04-08 Thread Luca Matteis
Argh! Nothing! I just tried making all changes... nothing.. same results :(
It's incredible I can't find any example online that involves editing
a child owned entity.

On Fri, Apr 8, 2011 at 11:41 AM, Simon Knott knott.si...@gmail.com wrote:
 I've no idea whether it makes any difference, but try changing the
 following:

 @Persistent
 private MyImage avatar;

 to

 @Persistent(defaultFetchGroup = true)
 private MyImage avatar;


 --
 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 - Updating a One-to-one child

2011-04-08 Thread Luca Matteis
Oh! Oh!!! Great idea I will just edit it instead of creating a new
one! DUH! thanks so much

On Fri, Apr 8, 2011 at 11:53 AM, Simon Knott knott.si...@gmail.com wrote:
 Is there any reason you make a new MyImage object?  Why can't you just
 change the MyImage object which already exists in the MyUser object?

 --
 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] Object Manager has been closed - solution other than detaching

2011-04-08 Thread Luca Matteis
Whenever I query something like

public static MyUser getUserInfo(Key userKey) {
PersistenceManager pm = PMF.get().getPersistenceManager();
MyUser myUser, detached = null;
try {
myUser = pm.getObjectById(MyUser.class, userKey);
pm.detachCopy(myUser.getAvatar()); // little worried about
this, but fixes the error
detached = pm.detachCopy(myUser);
} finally {
pm.close();
}
return detached;
}

before closing the PM I detach the object so that I can use the result
of the query after closing the PM. This works fine, however it becomes
a little crazy when my Objects contain child objects that need to be
detached as well.

Is there a better way of getting information from a query without
having to go through the entire result and detach all the objects?

-- 
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] JDO - Updating a One-to-one child

2011-04-07 Thread Luca Matteis
I have a Recipe. Each Recipe has an image. So my entity looks something like

@PersistenceCapable
public class Recipe {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private MyImage myImage;

When I create the Recipe the first time, it works great, the image is
added as well and I can view it. However when I go and update it such
as

PersistenceManager pm = PMF.get().getPersistenceManager();
Recipe r = pm.getObjectById(Recipe.class, recKey);
try {
r.setImage(newImage);
} finally {
pm.close();
}

the new image is added to the data-store, but when I try and fetch it
from within the recipe, the recipe still points to the old image in my
data-store. Is this normal? How can I fix this?

-- 
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 - Updating a One-to-one child

2011-04-07 Thread Luca Matteis
Hello Simon,
even if I persist it doing

   try {
   r.setImage(newImage);
   pm.makePersistent(newImage);
   } finally {
   pm.close();
   }

I still get the same results. The interesting thing is that if I
delete the image entity from the datastore, the recipe points to the
next one. Maybe there's some reference issue happening that I need to
fix. Don't know.

On Thu, Apr 7, 2011 at 10:39 AM, Simon Knott knott.si...@gmail.com wrote:
 Hi,

 I don't personally use JDO, but don't you have to re-put your object?

 I don't know how JDO does its dirty checking - I doubt very much that it
 will persist modified entities just because you're closing the Persistence
 Manager.

 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.



Re: [appengine-java] Re: JDO - Updating a One-to-one child

2011-04-07 Thread Luca Matteis
It's the same when deployed to GAE. From the live datastore viewer I
don't see the children when viewing the Recipe entity itself. The
images get stored in another table called Image. Was I suppose to see
a reference to the image object directly in the Recipe entity?

On Thu, Apr 7, 2011 at 11:08 AM, Simon Knott knott.si...@gmail.com wrote:
 Have you tried deploying to GAE?  You can only see child fields in the
 datastore viewer in Production.

 --
 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 - Updating a One-to-one child

2011-04-07 Thread Luca Matteis
I don't see the actual Recipe being update with anything. I just see
the Image being added in the Image 'table'. But from the datastore
viewer there's no attribute in the Recipe 'table'. Hope that's clear.

On Thu, Apr 7, 2011 at 10:58 AM, Simon Knott knott.si...@gmail.com wrote:
 If you look in the datastore admin tool, can you see whether the Recipe is
 being updated with the new image reference?  Are you seeing this problem on
 Dev or Prod?

 --
 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 - Updating a One-to-one child

2011-04-07 Thread Luca Matteis
Well, I would think the Key has relationship information. The thing is
that I'm able to fetch the image for the recipe, so the relationship
is there somehow. It seems as if setImage() isn't enough for the
linkage to update to the latest image.

On Thu, Apr 7, 2011 at 11:29 AM, Simon Knott knott.si...@gmail.com wrote:
 Yes, that's what I would have expected - how else would a recipe ever retain
 which image it is related to?  Is the relationship purely stored within the
 key of the Image?

 I must admit that without any knowledge of JDO and its relationship
 management, I'm just making wild guesses!

 --
 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 - Updating a One-to-one child

2011-04-07 Thread Luca Matteis
This is really weird. I cannot find anything on the internet that
could help me. It seems such a simple thing to be editing child
objects and I find it ridiculous that I can't find a solution.

please help

On Thu, Apr 7, 2011 at 11:53 AM, Luca Matteis lmatt...@gmail.com wrote:
 Well, I would think the Key has relationship information. The thing is
 that I'm able to fetch the image for the recipe, so the relationship
 is there somehow. It seems as if setImage() isn't enough for the
 linkage to update to the latest image.

 On Thu, Apr 7, 2011 at 11:29 AM, Simon Knott knott.si...@gmail.com wrote:
 Yes, that's what I would have expected - how else would a recipe ever retain
 which image it is related to?  Is the relationship purely stored within the
 key of the Image?

 I must admit that without any knowledge of JDO and its relationship
 management, I'm just making wild guesses!

 --
 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 - Updating a One-to-one child

2011-04-07 Thread Luca Matteis
Hello Ian, I tried using your exact piece of code. Still same results.
The recipe still points to the first image instead of the most
recently added one.

On Thu, Apr 7, 2011 at 5:20 PM, Ian Marshall ianmarshall...@gmail.com wrote:
 Do you use transactions?

 Instead of your

  PersistenceManager pm = PMF.get().getPersistenceManager();
  Recipe r = pm.getObjectById(Recipe.class, recKey);
  try
  {
    r.setImage(newImage);
  }
  finally
  {
    pm.close();
  }

 have you tried

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

      Recipe r = pm.getObjectById(Recipe.class, recKey);
      r.setImage(newImage);

      tx.commit();
    }
    finally
    {
      try
      {
        if (tx.isActive())    // Because of an exception, say
          tx.rollback();
      }
      finally
      {
        pm.close();
      }
    }


 On Apr 7, 3:03 pm, Luca Matteis lmatt...@gmail.com wrote:
 This is really weird. I cannot find anything on the internet that
 could help me. It seems such a simple thing to be editing child
 objects and I find it ridiculous that I can't find a solution.

 please help

 On Thu, Apr 7, 2011 at 11:53 AM, Luca Matteis lmatt...@gmail.com wrote:
  Well, I would think the Key has relationship information. The thing is
  that I'm able to fetch the image for the recipe, so the relationship
  is there somehow. It seems as if setImage() isn't enough for the
  linkage to update to the latest image.

  On Thu, Apr 7, 2011 at 11:29 AM, Simon Knott knott.si...@gmail.com wrote:
  Yes, that's what I would have expected - how else would a recipe ever 
  retain
  which image it is related to?  Is the relationship purely stored within 
  the
  key of the Image?

  I must admit that without any knowledge of JDO and its relationship
  management, I'm just making wild guesses!

  --
  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: App Engine identifier. Key vs Id

2011-04-06 Thread Luca Matteis
Thanks for this. But is there a way to get a specific entity using the
ID/Name value generated by the data-store?

On Wed, Apr 6, 2011 at 8:19 AM, Ian Marshall ianmarshall...@gmail.com wrote:
 I use the following code to define my persistent entity classes in
 JDO.

 I have find my persistent entities by encoded key string or ID - my
 choice.

 Enjoy?

 @PersistenceCapable(identityType = IdentityType.APPLICATION,
  detachable = true)
 public class MyPersistentClass implements Serializable
 {
  private static final long serialVersionUID = 1L;

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

  @Persistent
  @Extension(vendorName=datanucleus, key=gae.pk-id, value=true)
  private Long loID;

  //
  // Other persistent data members...
  //

  public String getEncodedKey()
  {
    return sEncodedKey;
  }

  public Long getID()
  {
    return loID;
  }

  //
  // Getter and setter methods for
  // the other persistent data members...
  //
 }


 On Apr 5, 3:44 pm, Luca Matteis lmatt...@gmail.com wrote:
 To identify my JDO objects in Google App Engine I use the Key type. It
 works fine but when I need to pass this through urls it gets sort of
 long.

 For 
 example:http://mysite.com/user/aghtaWx1LWFwcHIZCxIGTXlVc2VyGAMMCxIHTXlJbWFnZR...

 When viewing my entities in my admin viewer I can see that the
 data-store also sets an id for my entity object, which seems to be
 an incremental numeric value, which is quite short compared to the Key
 string. Can I use this to grab information on my object? How do I do
 this? I tried using getObjectbyId() with the id instead of the key...
 it doesn't work.

 Also, should I be using a Long type to identify objects instead of Key types?

 --
 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] any where i can hire people to do development on app engine in singapore?

2011-03-25 Thread Luca Matteis
Just hire good Java developers. Competent Java developers are also
competent Google App Engine developers.

On Wed, Mar 23, 2011 at 7:00 PM, Elvin Li zelrealmem...@gmail.com wrote:
 looking for competent developers

 --
 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: Blobstore API vs Datastore API

2011-03-20 Thread Luca Matteis
I decided to go with datastore since I'll be storing simple thumbnail
images - nothing more than 100kb. I'm a bit afraid of the 30s limit
but I suppose it makes sense for Google. I work for a bioinformatics
group known at global level and I'm trying to show my team the power
of App Engine; hopefully I can give them enough good examples to make
a radical business change happen towards App Engine.

It's funny because some colleagues have doubted the uptime of Google
and disaster recovery scene, saying that we should have in-house
hosting for reliability - but I find it ridiculous because there's a
lot more chance of our in-house network going down rather than Google
going down.

Thanks for your help.
Luca

On 3/19/11, branflake2267 branflake2...@gmail.com wrote:
 The credit option has a budget and you can set it real low. Its unlikely
 unless you have huge amount of resource use that you'll go over. I've only
 had cents billed on my upload demo due to the amount of data stored.

 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.



[appengine-java] Why does google set quotas on their API calls?

2011-03-14 Thread Luca Matteis
From the Image Java API page:

Each Images service request counts toward the Image Manipulation API
Calls quota.

-- 
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: Why does google set quotas on their API calls?

2011-03-14 Thread Luca Matteis
Sorry, clicked on send before finishing my question.

Why does AppEngine set API limitations when I could just as easily use
a third-party library for manipulation and avoid this limitation?

Luca

On Mon, Mar 14, 2011 at 8:08 PM, Luca Matteis lmatt...@gmail.com wrote:
 From the Image Java API page:

 Each Images service request counts toward the Image Manipulation API
 Calls quota.


-- 
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: Why does google set quotas on their API calls?

2011-03-14 Thread Luca Matteis
Ok. Thanks for the information. I'm still new at this cloud thing, and
it looks great.

On Mon, Mar 14, 2011 at 8:29 PM, Jay Young jayyoung9...@gmail.com wrote:
 Because when you do image transformations, you are sending an API to another
 piece of Google's infrastructure, which I would assume is highly optimized
 for doing such things.  If you do it in your own code, you'll probably pay
 more in CPU cost than you would for the API call.  If it's just a matter of
 bumping into the number of times you are allowed to make those API calls,
 let them know.  They've been known to relax some quotas for users with real
 needs.

 --
 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] JSP error output using dev_appserver (appengine's development server)

2011-03-13 Thread Luca Matteis
When my JSP pages fail for some reason I can't find where the
development server puts the error output information. Most web-servers
just return a formatted HTML page showing the cause of the JSP error
but the built-in development web-server appengine uses doesn't.

Where can I get this information?

Thanks.

Luca

-- 
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] Blobstore Java API - people can upload whatever they want with no control

2011-03-11 Thread Luca Matteis
I have started using the Bloblstore Java API:
http://code.google.com/appengine/docs/java/blobstore/overview.html

It seems like the upload form goes to something like:

form action=/_ah/upload/agRtaWx1chsLEhVfX0Jsb2JVcGxvYWRTZXNzaW9uX18YTww

This is part of appengine, it's not my code. This means I can't
prevent uploads of a given type or uploads of a given length. They get
loaded into my datastore under __BlobInfo__ no matter what.
Isn't this sort of bad? I don't want to have my datastore be filled
with things even though it's google storing the data. Bots would just
use it to upload spam. I want the upload to happen only by some means
of authentication.

Any ideas?

-- 
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 Java API - people can upload whatever they want with no control

2011-03-11 Thread Luca Matteis
So you're saying I should only generate the upload key url if the
user is authenticated?
And that would make it secure? avoid spam and such?

On Fri, Mar 11, 2011 at 12:32 PM, Didier Durand durand.did...@gmail.com wrote:
 Hi,

 You're right: you can't control WHAT (size, etc...) the users upload
 but you can control IF they upload: the key after /upload is generated
 by App Engine and has to be a valid one (not too old, not used yet,
 etc,,) to be usable for an update.

 If you generate such an upload for authentified users, it gets pretty
 secure.

 What else you be looking for ? If it size, or content or something
 equivalent that means anyway that you have to get out of the browser
 sandbox in your application (via java applet, etc..) in order to do
 the additional controls you need: a regular web app can't access and
 check local files because of the sandbox.

 regards

 didier

 On Mar 11, 12:07 pm, Luca Matteis lmatt...@gmail.com wrote:
 I have started using the Bloblstore Java 
 API:http://code.google.com/appengine/docs/java/blobstore/overview.html

 It seems like the upload form goes to something like:

     form 
 action=/_ah/upload/agRtaWx1chsLEhVfX0Jsb2JVcGxvYWRTZXNzaW9uX18YTww

 This is part of appengine, it's not my code. This means I can't
 prevent uploads of a given type or uploads of a given length. They get
 loaded into my datastore under __BlobInfo__ no matter what.
 Isn't this sort of bad? I don't want to have my datastore be filled
 with things even though it's google storing the data. Bots would just
 use it to upload spam. I want the upload to happen only by some means
 of authentication.

 Any ideas?

 --
 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: Blobstore Java API - people can upload whatever they want with no control

2011-03-11 Thread Luca Matteis
Thanks, I think I got it. So basically you want to show the
%blobstoreService.createUploadUrl(/upload)% only to people that
should upload.

Luca

On Fri, Mar 11, 2011 at 2:21 PM, Didier Durand durand.did...@gmail.com wrote:
 Hi,

 I don't exactly know what you mean by secure but having only the
 logged in people be allowed to upload will already significantly
 reduce spam.

 And then, you can use captchas to make sure it's a human, etc.

 regards

 didier

 On Mar 11, 1:58 pm, Luca Matteis lmatt...@gmail.com wrote:
 So you're saying I should only generate the upload key url if the
 user is authenticated?
 And that would make it secure? avoid spam and such?

 On Fri, Mar 11, 2011 at 12:32 PM, Didier Durand durand.did...@gmail.com 
 wrote:
  Hi,

  You're right: you can't control WHAT (size, etc...) the users upload
  but you can control IF they upload: the key after /upload is generated
  by App Engine and has to be a valid one (not too old, not used yet,
  etc,,) to be usable for an update.

  If you generate such an upload for authentified users, it gets pretty
  secure.

  What else you be looking for ? If it size, or content or something
  equivalent that means anyway that you have to get out of the browser
  sandbox in your application (via java applet, etc..) in order to do
  the additional controls you need: a regular web app can't access and
  check local files because of the sandbox.

  regards

  didier

  On Mar 11, 12:07 pm, Luca Matteis lmatt...@gmail.com wrote:
  I have started using the Bloblstore Java 
  API:http://code.google.com/appengine/docs/java/blobstore/overview.html

  It seems like the upload form goes to something like:

      form 
  action=/_ah/upload/agRtaWx1chsLEhVfX0Jsb2JVcGxvYWRTZXNzaW9uX18YTww

  This is part of appengine, it's not my code. This means I can't
  prevent uploads of a given type or uploads of a given length. They get
  loaded into my datastore under __BlobInfo__ no matter what.
  Isn't this sort of bad? I don't want to have my datastore be filled
  with things even though it's google storing the data. Bots would just
  use it to upload spam. I want the upload to happen only by some means
  of authentication.

  Any ideas?

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



[appengine-java] Blobstore API vs Datastore API

2011-03-11 Thread Luca Matteis
After spending almost half a day implementing the Blobstore API
locally I realized only after uploading that it actually to have
billing enabled in order to work. I'm not exactly happy with that
because I wish the dev_appserver would've told me. Anyhow, I don't
feel like giving out my credit-card to Google for this feature since I
just want to test my little project and how it behaves, performance
wise, with Google's free option.

So after googling a bit I found this:
http://stackoverflow.com/questions/1513603/how-to-upload-and-store-an-image-with-google-app-engine-java
Which basically uses the datastore to store a Blob of the image. I'm
wondering, if this is possible, why is Google charging for the
Blobstore API?

-- 
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 API vs Datastore API

2011-03-11 Thread Luca Matteis
Is it possible to store the image directly on disk, as a resource?

On 3/11/11, Simon Knott knott.si...@gmail.com wrote:
 The datastore can handle blobs with a maximum size of 1MB, whereas the
 blobstore can handle blobs of 2GB.

 --
 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] Can I set GAE's dev_appserver to automatically reload context when I change .class files?

2011-03-10 Thread Luca Matteis
Hello everybody!

I'm using Google AppEngine with their built in web server. My
development goes about in a simple way: I make changes to my .java
sources or .jsp and compile using ant and to see the changes I have to
restart the development server.

I'm wondering if there's a way I can avoid this last step of
restarting my development server - somehow refresh the cached classes
context of my web-server. The options provided by Google on this dev
server are quite limited and am wondering if there's a better way.

I would like to avoid using something like JRebel which I could buy,
but for this simple project I'm just wondering if I can remove the
burden of restarting my web-server... otherwise I'll live with it.

Thanks.

Luca

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