Search Results

Search found 448 results on 18 pages for 'gae'.

Page 6/18 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Subqueries on Java GAE Datastore

    - by Dmitry
    I am trying to create a database of users with connection between users (friends list). There are 2 main tables: UserEntity (main field id) and FriendEntity with fields: - initiatorId - id of user who initiated the friendship - friendId - id of user who has been invited. Now I am trying to fetch all friends of one particular user and encountered some problems with using subqueries in JDO here. Logically the query should be something like this: SQL: SELECT * FROM UserEntity WHERE EXISTS (SELECT * FORM FriendEntity WHERE (initiatorId == UserEntity.id && friendId == userId) || (friendId == UserEntity.id && initiatorId == userId)) or SELECT * FROM UserEntity WHERE userId IN (SELECT * FROM FriendEntity WHERE initiatorId == UserEntity.id) OR userId IN (SELECT * FROM FriendEntity WHERE friendId == UserEntity.id) So to replicate the last query in JDOQL, I tried to do the following: Query friendQuery = pm.newQuery(FriendEntity.class); friendQuery.setFilter("initiatorId == uidParam"); friendQuery.setResult("friendId"); Query initiatorQuery = pm.newQuery(FriendEntity.class); initiatorQuery.setFilter("friendId == uidParam"); initiatorQuery.setResult("initiatorId"); Query query = pm.newQuery(UserEntity.class); query.setFilter("initiatorQuery.contains(id) || friendQuery.contains(id)"); query.addSubquery(initiatorQuery, "List initiatorQuery", null, "String uidParam"); query.addSubquery(friendQuery, "List friendQuery", null, "String uidParam"); query.declareParameters("String uidParam"); List<UserEntity> friends = (List<UserEntity>) query.execute(userId); In result I get the following error: Unsupported method while parsing expression. Could anyone help with this query please?

    Read the article

  • GAE/J: unable to register a custom ELResolver

    - by dfa
    I need to register a custom ELResolver for a Google App Engine project. Since it must be registered before any request is received, as specified by the Javadoc: It is illegal to register an ELResolver after the application has received any request from the client. If an attempt is made to register an ELResolver after that time, an IllegalStateException is thrown. I'm using a ServletContextListener: public class RegisterCustomELResolver implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent sce) { ServletContext context = sce.getServletContext(); JspApplicationContext jspContext = JspFactory.getDefaultFactory().getJspApplicationContext(context); jspContext.addELResolver(new MyELResolver()); } ... } The problem is that JspFactory.getDefaultFactory() returns always null. I've alreay filled a bug report. Any idea for a workaround?

    Read the article

  • Storing a list of objects in GAE

    - by Dominic Bou-Samra
    I need to store some data that looks a little like this: xyz 123 abc 456 hij 678 rer 838 Now I would just store it as a traditional string and integer model, and put in the datastore. But the data changes regularly, and is ONLY relevant when looked at as a COLLECTION. So it needs to be store as either a list of lists, or a list of objects, both of which can't really be done without pickling as far as I know. Can anyone help? Even storing it as a text file may work :S

    Read the article

  • How to output KML by GAE

    - by Niklas R
    Hi I use KML for a google map where entities have a geopt.db coordinate and soft memory limit was exceeded with 213.465 MB after servicing 1 requests total. The log says /list.kml 200 13130ms 10211cpu_ms 4238api_cpu_ms The file list.kml which outputs about 455,7 KB is a template as follows <?xml version="1.0" encoding="UTF-8"?><kml xmlns="http:// www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http:// www.w3.org/2005/Atom"> <Document>{% for a in list %} <Placemark> <name> </name> <description> <![CDATA[<a href="http://{{host}}/{{a.key.id}}"> {{ a.title }} </a> <br/>{{a.text}}]]> </description> <Style> <IconStyle> <Icon> <href> http://www.google.com/intl/en_us/mapfiles/ms/icons/green-dot.png </href> </Icon> </IconStyle> </Style> <Point> <coordinates> {{a.geopt.lon|floatformat:2}},{{a.geopt.lat|floatformat:2}} </coordinates> </Point> </Placemark> {% endfor %} </Document> </kml> Is there a memory leak in the template or the python that passes the list variable? Can I improve using other template engine or other framework than default? Is kmz compression a good idea in this case? Thanks in advance for any suggestion where or how to change the code.

    Read the article

  • GAE how to see production exceptions?

    - by bach
    Hi, I'm getting an error on the production env but not on the local one. Is there a way to see the exception that is probably being thrown from production? In tomcat - the user will be able the see the exception as the servlet returns its output

    Read the article

  • JDO, GAE: Load object group by child's key

    - by tiex
    I have owned one-to-many relationship between two objects: @PersistenceCapable(identityType = IdentityType.APPLICATION) public class AccessInfo { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private com.google.appengine.api.datastore.Key keyInternal; ... @Persistent private PollInfo currentState; public AccessInfo(){} public AccessInfo(String key, String voter, PollInfo currentState) { this.voter = voter; this.currentState = currentState; setKey(key); // this key is unique in whole systme } public void setKey(String key) { this.keyInternal = KeyFactory.createKey( AccessInfo.class.getSimpleName(), key); } public String getKey() { return this.keyInternal.getName(); } and @PersistenceCapable(identityType = IdentityType.APPLICATION) public class PollInfo { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent(mappedBy = "currentState") private List<AccessInfo> accesses; ... I created an instance of class PollInfo and make it persistence. It is ok. But then I want to load this group by AccessInfo key, and I am getting exception NucleusObjectNotFoundException. Is it possible to load a group by child's key?

    Read the article

  • Emptying the datastore in GAE

    - by colwilson
    I know what you're thinking, 'O not that again!', but here we are since Google have not yet provided a simpler method. I have been using a queue based solution which worked fine: import datetime from models import * DELETABLE_MODELS = [Alpha, Beta, AlphaBeta] def initiate_purge(): for e in config.DELETABLE_MODELS: deferred.defer(delete_entities, e, 'purging', _queue = 'purging') class NotEmptyException(Exception): pass def delete_entities(e, queue): try: q = e.all(keys_only=True) db.delete(q.fetch(200)) ct = q.count(1) if ct > 0: raise NotEmptyException('there are still entities to be deleted') else: logging.info('processing %s completed' % queue) except Exception, err: deferred.defer(delete_entities, e, then, queue, _queue = queue) logging.info('processing %s deferred: %s' % (queue, err)) All this does is queue a request to delete some data (once for each class) and then if the queued process either fails or knows there is still some stuff to delete, it re-queues itself. This beats the heck out of hitting the refresh on a browser for 10 minutes. However, I'm having trouble deleting AlphaBeta entities, there are always a few left at the end. I think because it contains Reference Properties: class AlphaBeta(db.Model): alpha = db.ReferenceProperty(Alpha, required=True, collection_name='betas') beta = db.ReferenceProperty(Beta, required=True, collection_name='alphas') I have tried deleting the indexes relating to these entity types, but that did not make any difference. Any advice would be appreciated please.

    Read the article

  • GAE Having Tasks generate pages for user

    - by mellort
    I have a web app that I would like to have the following functionality: user gives a url webapp gets json data from that url and others from same website (this can take anywhere from 1-10 seconds) webapp uses data to generate page for user With this approach, I believe that if the server is in the process of getting the data for one user, then the other user won't be able to load the page (server busy). I would like to avoid this if possible. It seems like the Google Tasks API would be useful for this, but I don't see how I can run the task, and then use the output of the task to generate the page (how would the main app know when the task was finished?) What is the best way to resolve this? Thanks in advance

    Read the article

  • How to store child objects on GAE using JDO from Scala

    - by Gero
    Hi, I'm have a parent-child relation between 2 classes, but the child objects are never stored. I do get an warning: "org.datanucleus.store.appengine.MetaDataValidator checkForIllegalChildField: Unable to validate relation net.vermaas.kivanotify.model.UserCriteria.internalCriteria" but it is unclear to me why this occurs. Already tried several alternatives without luck. The parent class is "UserCriteria" which has a List of "Criteria" as children. The classes are defined as follows (Scala): class UserCriteria(tu: String, crit: Map[String, String]) extends LogHelper { @PrimaryKey @Persistent{val valueStrategy = IdGeneratorStrategy.IDENTITY} var id = KeyFactory.createKey("UserCriteria", System.nanoTime) @Persistent var twitterUser = tu @Persistent var internalCriteria: java.util.List[Criteria] = flatten(crit) def flatten(crits: Map[String, String]) : java.util.List[Criteria] = { val list = new java.util.ArrayList[Criteria] for (key <- crits.keySet) { list.add(new Criteria(this, key, crits(key))) } list } def criteria: Map[String, String] = { val crits = mutable.Map.empty[String, String] for (i <- 0 to internalCriteria.size-1) { crits(internalCriteria.get(i).name) = internalCriteria.get(i).value } Map.empty ++ crits } // Stripped the equals, canEquals, hashCode, toString code to keep the code snippet short... } @PersistenceCapable @EmbeddedOnly class Criteria(uc: UserCriteria, nm: String, vl: String) { @Persistent var userCriteria = uc @Persistent var name = nm @Persistent var value = vl override def toString = { "Criteria name: " + name + " value: " + value } } Any ideas why the childs are not stored? Or why I get the error message? Thanks, Gero

    Read the article

  • How to Communicate between minifb and a GAE-Hosted Silverlight Client

    - by Nick Gotch
    I have a minifb app (technically gminifb) running on Google App Engine with a bunch of handlers for processing all kinds of requests from a Silverlight client. What's the recommended approach for adding the FB GET variables, such as fb_sig, to the HTTP requests? I believe I can technically pass the session key and uid directly and get things to work but it seems there's probably a much better way to do this. I was reading about FBJS AJAX and I'm trying to figure out how I can use it to proxy the HTTP requests from the Silverlight client through it. Is this a good way to do it? And if so, how would I go about doing so? Any other recommendations would be appreciated too. Thanks,

    Read the article

  • GAE Task Queue rate

    - by bach
    Hi, Is there a way to guarantee a task to be performed in X minutes (or after X min) ? (rate would mean the intervals between tasks but what about the first task, would the first task starts after the 'rate' time?)

    Read the article

  • GAE : Open Source Django Apps

    - by sprezzatura
    Am looking for open source Django apps in Google App engine. I want to play around with the code and learn in the process. Not mandatory, but Would be great feature in the app: - account registration/login - image/file upload

    Read the article

  • GAE transaction exception suggestion

    - by bach
    Hi, The current situation encourages the design of the system to split object fields to seperate objects in order to reduce the chance of the JDOCanRetryException to be thrown. If we could have the fields that were changed by the other client who changed the object in the exception content itself we could deside whether to re-retrieve the object or ignore...

    Read the article

  • gae error:AttributeError: 'NoneType' object has no attribute 'user_is_member'

    - by zjm1126
    class Thread(db.Model): members = db.StringListProperty() def user_is_member(self, user): return str(user) in self.members and thread = Thread.get(db.Key.from_path('Thread', int(id))) is_member = thread.user_is_member(user) but the error is : Traceback (most recent call last): File "D:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 511, in __call__ handler.get(*groups) File "D:\Program Files\Google\google_appengine\google\appengine\ext\webapp\util.py", line 62, in check_login handler_method(self, *args) File "D:\zjm_code\forum_blog_gae\main.py", line 222, in get is_member = thread.user_is_member(user) AttributeError: 'NoneType' object has no attribute 'user_is_member' why ? thanks

    Read the article

  • GAE update different fields of the same entity

    - by bach
    Hi, UserA and UserB are changing objectA.filedA objectA.filedB respectively and at the same time. Because they are not changing the same field one might think that there are no overlaps. Is that true? or the implementation of pm.makePersistnace() actually override the whole object... good to know...

    Read the article

  • how to download data which upload to gae ,

    - by zjm1126
    this is my code : import os from google.appengine.ext import webapp from google.appengine.ext.webapp import template from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.ext import db #from login import htmlPrefix,get_current_user class MyModel(db.Model): blob = db.BlobProperty() class BaseRequestHandler(webapp.RequestHandler): def render_template(self, filename, template_args=None): if not template_args: template_args = {} path = os.path.join(os.path.dirname(__file__), 'templates', filename) self.response.out.write(template.render(path, template_args)) class upload(BaseRequestHandler): def get(self): self.render_template('index.html',) def post(self): file=self.request.get('file') obj = MyModel() obj.blob = db.Blob(file.encode('utf8')) obj.put() self.response.out.write('upload ok') class download(BaseRequestHandler): def get(self): #id=self.request.get('id') o = MyModel.all().get() #self.response.out.write(''.join('%s: %s <br/>' % (a, getattr(o, a)) for a in dir(o))) self.response.out.write(o) application = webapp.WSGIApplication( [ ('/?', upload), ('/download',download), ], debug=True ) def main(): run_wsgi_app(application) if __name__ == "__main__": main() my index.html is : <form action="/" method="post"> <input type="file" name="file" /> <input type="submit" /> </form> and it show : <__main__.MyModel object at 0x02506830> but ,i don't want to see this , i want to download it , how to change my code to run, thanks

    Read the article

  • unable to add objects to saved collection in GAE

    - by Jeffrey Chee
    I have a ClassA containing an ArrayList of another ClassB I can save a new instance of ClassA with ClassB instances also saved using JDO. However, When I retrieve the instance of Class A, I try to do like the below: ClassA instance = PMF.get().getPersistenceManager().GetObjectByID( someid ); instance.GetClassBArrayList().add( new ClassB(...) ); I get an Exception like the below: Uncaught exception from servlet com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found.. So I was wondering, Is it possible to add a new item to the previously saved collection? Or was it something I missed out. Best Regards

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >