[appengine-java] Re: How to configure PHP, MySQL & GAE

2010-09-14 Thread Sergio Lopes
I guess people are using Quercus on GAE for Java. There're some
information here:

http://blog.caucho.com/?p=187



On 14 set, 13:24, Ravi Dhanwate  wrote:
> could you please provide the details about how to configure PHP with GAE?
>
>
>
>
>
> On Mon, Sep 13, 2010 at 4:33 PM, technut  wrote:
> > Hi
> > I have configured PHP with GAE and it works for me. But i am not able
> > to connect mySQL.
> > I have reviewed that mysql doesn't support directly to GAE and JDO is
> > one media for that. So how do i make connection from PHP to mySQL
> > through JDO.?
> > Its appreciate if you can reply me earliest. Thanks
>
> > -B
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to
> > google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine-java+unsubscr...@googlegroups.com > unsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.
>
> --
> Regards
> Ravi Dhanwate

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



[appengine-java] Contribution: slides from my presentation at QCon about GAEJ [in portuguese]

2010-09-14 Thread Sergio Lopes
Hi everybody!

Last weekend I gave a presentation at QCon São Paulo 2010, in Brazil.
I talked about my experiences with GAEJ since my first deploy in
September 2009. Unfortunately the slides are in portuguese, but I know
there're many brazilians (and portugueses, ...) working with GAE, so
it may be helpfull to someone :)

   http://slidesha.re/bN1sy1

The slides also have comments and explanations

Thanks

Sérgio Lopes
http://www.caelum.com.br

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



[appengine-java] Best Java Web Frameworks for GAE (aka speed)

2010-09-08 Thread Sergio Lopes
Hi everybody

I use GAEJ for a year now, mainly with VRaptor and Spring IoC
frameworks. As every GAE developer knows, we still have some issues
with Cold Start, specially because context loading happens in the
first request. So it seems to be a good thing to optimize that startup
time, something that Java developers are not used to (we usually focus
only in request processing time).

And, for me, it seems that Spring isn't a good choice for GAE. In my
projects, it seems that classpath scanning plus the container
initialization are taking a very long time. So, what are you using?
What's the best framework for GAE when talking about performance and
low startup time?

GWT?
JSF?
Spring?
Struts2?
Pure servlets? (joking :-)

Thanks
Sérgio

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



[appengine-java] Re: Can't flush response

2010-09-06 Thread Sergio Lopes
Too bad... thanks, Peter

On 6 set, 07:39, Peter Ondruska  wrote:
> It will not work, GAE in production will send response at once. 
> Seehttp://code.google.com/appengine/docs/java/runtime.html#Responses
>
> On Sep 6, 10:42 am, Sergio Lopes  wrote:
>
>
>
> > Hi everybody
>
> > I'm trying to use flushBuffer() of HttpServletResponse. I have some
> > use case here where I need to send some response to the user and later
> > send a little more.
>
> > But flushBuffer() doesn't seem to be working in production. Locally
> > everything works with the SDK, but in production the response only
> > shows up when the last byte is sent (not when flushBuffer is called).
>
> > Any idea?
>
> > Thanks
> > Sérgio

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



[appengine-java] Can't flush response

2010-09-06 Thread Sergio Lopes
Hi everybody

I'm trying to use flushBuffer() of HttpServletResponse. I have some
use case here where I need to send some response to the user and later
send a little more.

But flushBuffer() doesn't seem to be working in production. Locally
everything works with the SDK, but in production the response only
shows up when the last byte is sent (not when flushBuffer is called).

Any idea?

Thanks
Sérgio

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



[appengine-java] Re: Query BlobInfo in Java?

2010-09-06 Thread Sergio Lopes
I'm using the Datastore API to query __BlobInfo__ entity directly.
In my case, for example, I can have multiple versions of the same
filename but I need to get the last one.
So:

 Query query = new Query("__BlobInfo__");
 query.addFilter("filename", FilterOperator.EQUAL, filename);
 query.addSort("creation", SortDirection.DESCENDING);

 DatastoreService datastore =
DatastoreServiceFactory.getDatastoreService();
 PreparedQuery pq = datastore.prepare(query);
 List entList = pq.asList(FetchOptions.Builder.withLimit(1));

Hope that helps...


On 6 set, 05:13, Peter Liu  wrote:
> Hi all,
>
> Anyone know a simple way to query BlobInfo?
>
> Simple use case will be query the BlobInfo that has a specific file
> name.
>
> It seems there's a method to query BlobInfo for Python but I can't
> find it for java.
>
> Thanks!

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



[appengine-java] Re: HttpClient is not supported?

2010-06-23 Thread Sergio Lopes
Hi

I'm using HttpClient on AppEngine using a simple hack found here:
http://esxx.blogspot.com/2009/06/using-apaches-httpclient-on-google-app.html

It's basically a connection provider to HttpClient using Google's
URLFetch service. This way you can still use the beloved HttpClient
and (almost) all its power

Sérgio
http://www.caelum.com.br

On 22 jun, 13:36, Lu  wrote:
> Hi,
>
> I am trying to use HttpClient to extract the urls. It works in normal
> java application but not under the context of web application.
>
> HttpClient client = new HttpClient();
> GetMethod method = new GetMethod(url);
>
> I will get error says 'java.lang.NoClassDefFoundError: java.net.Socket
> is a restricted class. Please see the Google  App Engine developer's
> guide for more details'
>
> Does that mean it conflicts with google app engine?
>
> Thanks

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



[appengine-java] System property to know the application default version?

2010-05-17 Thread Sergio Lopes
Hi

Recently GAE added two system properties,
com.google.appengine.application.version/id.
I'm wondering if I can tell what is the default version besides
getting the current version. Is there any property like that?

Tks
Sérgio

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



[appengine-java] Re: false and JSESSIONID

2010-05-17 Thread Sergio Lopes
Hey Romesh
Thanks for your help!

I think JSESSIONID is not a "client session", it's just an identifier
that refers to a server-side session. It doesn't make sense in  world
without server-side sessions. I think that id means nothing if my
sessions are disabled on server



On May 17, 3:06 am, romesh soni  wrote:
> hello Sergio
> *
> *
> *This is not an issue. disabling session id in code will not stop the cookie
> from saving session id. When you enable session in app engine xml file than
> you are telling the framework that you don't want to save sessions in
> cookies (client side), instead you want to save them on server i.e. using
> _ah_session. Cookies JSession id is default behavior of Java session mgmt.
> And it is nothing to do with APP engine framework.*
> *
> *
> *thanks*
> *romesh*
> *
> *
>
>
>
>
>
> On Mon, May 17, 2010 at 11:19 AM, Sergio Lopes  wrote:
> > Hi everybody
>
> > I'm trying to make a completely stateless application. I configured
> >  to false and it seems that sessions are not being
> > created in server side (the datastore _ah_session table is not growing
> > anymore). But all requests are setting the JSESSIONID cookie. Why?
> > There is no session support...
>
> > Is this a bug? Should I fill this in issue tracker?
>
> > Thanks
> > Sérgio
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google App Engine for Java" group.
> > To post to this group, send email to
> > google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-appengine-java+unsubscr...@googlegroups.com > unsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/google-appengine-java?hl=en.

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



[appengine-java] false and JSESSIONID

2010-05-16 Thread Sergio Lopes
Hi everybody

I'm trying to make a completely stateless application. I configured
 to false and it seems that sessions are not being
created in server side (the datastore _ah_session table is not growing
anymore). But all requests are setting the JSESSIONID cookie. Why?
There is no session support...

Is this a bug? Should I fill this in issue tracker?

Thanks
Sérgio

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



[appengine-java] Re: SimpleDS 1.0_RC1 is out

2010-05-04 Thread Sergio Lopes
Great news!
I'm currently having some problems with second level cache and JPA, so
a nice alternative like SimpleDS is a good idea.
Just one question: does SimpleDS support query caching too? I've some
very popular queries and want to cache their results in a 2nd level
cache (not only its entities)

Thanks and congratulation for the release

Sérgio Lopes
http://www.caelum.com.br

On May 4, 6:31 am, Nacho Coloma  wrote:
> We are really excited with this release, which is the first feature-
> complete release of SimpleDS. Lots of things have been included in so
> little time.
>
> Getting up-to-date with AppEngine
> 
>
> It's hard to keep up the pace with these guys. This release includes:
>
> * Unindexed attributes.
> * Cursors support.
> * IN and != clauses.
>
> Cache
> =
>
> We have included a great Level 1 and Level 2 cache [1]. If you come
> from JDO/JPA, you may already know how it works:
>
> * Level 1 cache: This is basically a Map bound to the current thread.
> Until the end of the current request, any get() invocation will check
> this cache first. If a match is found, no invocation will be
> propagated to GAE.
> * Level 2 cache: Datastore entities are also stored in memcache, which
> is a second chance to get a positive match.
>
> Cacheable entities must be marked with @Cacheable, with an optional
> expiration time. This feature will work with single and batch get(),
> and the cache entries are updated with put() and delete()
> invocations.
>
> // Invoke memcache or the datastore
> List data = entityManager.get(key1, key2, key3);
>
> // this does not invoke anything (resolved by the Level 1 cache)
> MyData d2 = entityManager.get(key1);
>
> Functions
> 
>
> We are going extremely functional these days [2]. This release
> includes a package with functions to transform collections and
> PagedList instances, which can be combined with batch get() to get
> even better performance results. This is a simple example, equivalent
> to a common situation with relationships:
>
> // n + 1 requests to the datastore
> List data = entityManager.find(query);
> Collection parents =
> Lists.newArrayListwithCapacity(data.size());
> for (MyData d : data) {
>   parents.add(entityManager.get(d.getKey().getParent());
>
> }
>
> // Transformations: 2 requests
> List data = entityManager.find(query);
> Collection parentKeys = Collections2.transform(data, new
> EntityToParentKeyFunction(MyData.class));
> Collection parents = entityManager.get(parentKeys);
>
> That's all it takes to get all entities and their parents, and store
> them in the Level 1 cache so any request by PK will not hit memcache
> or the datastore. This release includes functions to retrieve parent
> and foreign keys, and also works with PagedList. We have taken two
> real-world snapshots with just this optimization (transformation +
> cacheable), applied to a single loop:
>
> Before:http://www.flickr.com/photos/koliseocom/4575062969/sizes/l/
> After:http://www.flickr.com/photos/koliseocom/4575696456/sizes/o
>
> Notice that requests "before" are targeted to the datastore, while
> most of the "after" are memcache requests.
>
> Background tasks
> ==
>
> I know that background tasks [3] are in the roadmap for AppEngine, but
> we needed these today. This started as an exercise to upgrade the
> datastore schema (add properties, delete entities, etc) and ended up
> as a full reusable implementation of tasks that I expect to deprecate
> once that AppEngine includes its own, probably better, implementation.
>
> Background tasks require adding a servlet to web.xml (and optionally
> appengine-web.xml as an admin-console entry) and configuring the tasks
> on application start using plain Java. Tasks can be invoked directly
> by cron triggers, queues or by POST requests.
>
> public class WriteBehindCacheTask extends IterableTask {
>
>         protected WriteBehindCacheTask() {
>                 super("my-task-id");
>         }
>
>         @Override
>         protected SimpleQuery createQuery(TaskRequest request) {
>                 return entityManager.createQuery(MyClass.class);
>         }
>
>         @Override
>         protected void process(MyClass entity, TaskRequest request) {
>                 // ...modify entity...
>                 entityManager.put(entity);
>         }
>
> }
>
> Query cursors and execution deferral will be done transparently (no
> need to limit or handle cursors). There are some implementation
> superclasses depending on what you need to do, and some of them just
> use the raw AppEngine datastore and don't even require SimpleDS to
> work.
>
> This is the first feature-complete release of SimpleDS. Next on the
> roadmap: cached queries and we may be revisiting relations.
>
> As always, all kind of feedback is welcome.
>
> Nacho.
>
> [1]http://code.google.com/p/simpleds/wiki/Cache
> [2]http://code.google.com/p/simpleds/wiki/Functions
> [3]http://code.google.com/p/simpleds/wiki/BackgroundTasks
>

[appengine-java] Re: Cache pages in Memcache

2010-05-04 Thread Sergio Lopes
Thanks for your answers!

The Cache-control idea is a good one, I think I'll try something here.
But maybe it's a good idea to have some kind of server cache too.

Ehcache Web Module has a nice Java Filter that threats many corner
cases (headers, gzip, ...). The only problem is that it's too coupled
to Ehcache. I think I'll try to fork that project to use their Filter
with AppEngine's memcache :)



On May 4, 6:22 am, Nacho Coloma  wrote:
> Hi Sergio,
>
> > I'm thinking in a Filter that put page results in memcache when first
> > accessed, and then getting that result in former accesses.
>
> That should work. All page cache implementations do more or less the
> same.
>
> > The idea is simple but the implementation is not. (how to get the
> > first request response? how to implement proper header management in
> > that filter? how to not disable gzip using this?)
>
> * If there is content in memcache, you can deliver it and exit.
> Otherwise, let the request proceed, and store in the cache.
> * Be sure to set the cache timeout and calculate the cache key
> correctly (e.g. include the user ID or the user locale if the cached
> contents depend on that).
> * For HTTP headers, this presentation may 
> help:http://www.slideshare.net/icoloma/caching-web-contents-in-the-browser...
>
> It's  more or less the same with JSP page fragments (except the
> headers, of course). No rocket science.
>
> Cheers,
>
> Nacho.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Google App Engine for Java" group.
> To post to this group, send email to google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/google-appengine-java?hl=en.

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



[appengine-java] Problems enabling Second-level cache with JPA

2010-05-03 Thread Sergio Lopes
Hi

I'm using GAEJ 1.3.3.1 and datanucleus-cache-1.1.1. I'm trying to
enable 2nd level cache in my application following the official
instructions: 
http://www.datanucleus.org/products/accessplatform%5F1%5F1/jpa/cache.html

Already configured persistence.xml to use datanucleus cache with
javax.cache. Already made my entities Serializable. But when calling
EntityManager#merge, memcache throws:

Caused by: java.lang.IllegalArgumentException: can't accept class
org.datanucleus.identity.IdentityReference as a memcache entity
at
com.google.appengine.api.memcache.MemcacheSerialization.serialize(MemcacheSerialization.java:
262)
at
com.google.appengine.api.memcache.MemcacheSerialization.makePbKey(MemcacheSerialization.java:
199)
at
com.google.appengine.api.memcache.MemcacheServiceImpl.get(MemcacheServiceImpl.java:
234)
at
com.google.appengine.api.memcache.stdimpl.GCache.remove(GCache.java:
174)
at
org.datanucleus.cache.javaxcache.JavaxCacheLevel2Cache.evict(JavaxCacheLevel2Cache.java:
192)
at
org.datanucleus.ObjectManagerImpl.performLevel2CacheUpdateAtCommit(ObjectManagerImpl.java:
2982)
at
org.datanucleus.ObjectManagerImpl.preCommit(ObjectManagerImpl.java:
2925)
at
org.datanucleus.TransactionImpl.internalPreCommit(TransactionImpl.java:
369)
at org.datanucleus.TransactionImpl.commit(TransactionImpl.java:
256)
at
org.datanucleus.jpa.EntityTransactionImpl.commit(EntityTransactionImpl.java:
104)

It doesn't seem to be something related to my application. Any ideas?

I'm used to Hibernate, not Datanucleus, so a few things are not clear
to me. First, why are all entities cacheable by default? Shouldn't I
enable caching only when needed?

And, second, how query cache works on datanucleus? Is it enabled too?
For all queries? Or should I enable query cache per query? And how to
do that?



Also, we know both Google and Datanucleus people post here. So here is
a suggestion: make things more clear. It's very very difficult to find
information about those things. There is no mention in Google
Documentations. And Datanucleus' doesn't mention GAE, you have to
figure out how to configure, what's the right version. Also the
@Cacheable annotation mentioned there doesn't work, only @Extension.

Anyway, just a suggestion... I think it'd be better to GAE community
to have better tutorials.

Thanks again

Sérgio

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



[appengine-java] Cache pages in Memcache

2010-05-03 Thread Sergio Lopes
Hi

Are there anyone using some kind of server-side page cache using
memcached?
I'm thinking in a Filter that put page results in memcache when first
accessed, and then getting that result in former accesses.

The idea is simple but the implementation is not. (how to get the
first request response? how to implement proper header management in
that filter? how to not disable gzip using this?)

I tried Ehcache with the Web Module (https://groups.google.com/group/
google-appengine-java/browse_thread/thread/7cfa0eae3bc26444) but it's
not working.

Maybe someone here has an idea on how to implement an effective page
cache using Java

Tks
Sérgio

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



[appengine-java] Trying to use Ehcache 2.0.1 with web module

2010-05-03 Thread Sergio Lopes
Hi everybody

Ehcach announced recently their AppEngine support. I'm using version
2.0.1 (latest stable release) with Ehcache Web Module. I'm using
SimpleCachingHeadersPageCachingFilter to cache page results.

When I run my application, I'm getting an AccessControlException
because Ehcache Web is trying to do something nasty to the current
Thread (of course, gae does not allow):

java.security.AccessControlException: access denied
(java.lang.RuntimePermission modifyThread)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:
323)
at
java.security.AccessController.checkPermission(AccessController.java:
546)
at
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at com.google.appengine.tools.development.DevAppServerFactory
$CustomSecurityManager.checkPermission(DevAppServerFactory.java:166)
at com.google.appengine.tools.development.DevAppServerFactory
$CustomSecurityManager.checkAccess(DevAppServerFactory.java:203)
at java.lang.Thread.checkAccess(Thread.java:1287)
at java.lang.Thread.setName(Thread.java:1068)
at
net.sf.ehcache.constructs.web.filter.CachingFilter.buildPageInfo(CachingFilter.java:
240)
at
net.sf.ehcache.constructs.web.filter.CachingFilter.doFilter(CachingFilter.java:
185)
at
net.sf.ehcache.constructs.web.filter.Filter.doFilter(Filter.java:86)


Is there anyone here using Ehcache on GAE? And specifically, Ehcache
Web Module?
I read that ehcache filter implementation and it really seems to call
things restricted by gae

I followed the instructions found on Ehcache website:
  http://ehcache.org/documentation/googleappengine.html
  http://ehcache.org/documentation/web_caching.html

Is Ehcache really GAE compatible?

Tks
Sérgio Lopes

-- 
You received this message 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.