For my little framework Pyxer I would like to to be able to use the Google AppEngine datastores also outside of AppEngine projects, because I'm now used to this ORM pattern and for little quick hacks this is nice. I can not use Google AppEngine for all of my projects because of its's limitations in file size and number of files.
A great alternative would also be, if there was a project that provides an ORM with the same naming as the AppEngine datastore. I also like the GQL approach very much, since this is a nice combination of ORM and SQL patterns.
Any ideas where or how I might find such a solution? Thanks.
I have this website which decides on the display language by a GET parameter.
http://www.mysite.com/index.php?page=home&locale=en
which is rewritten as
http://www.mysite.com/en/home
When no language is specified, the system defaults to English (en). Now how do I tell the search engines that many versions of the website exist? When the search bot enters the site, it will trigger the default English Language and after finishing, will just leave the site without considering other languages.
I can very well have a sitemap with links to the default pages of each language, so the bot can navigate from there.
But how do I say the bot that the entry in the sitemap is the home page for that language? Like if someone searches for 'mi sitio', they should be presented with the result http://www.mysite.com/es/home and not some other internal page.
Any light on this? Thanks.
what is the difference between owned one to many relationship and
owned one to many bidirectional relationship
i read the article below but i don't understand it.
Article
Is there a datastore performance difference between adding dynamic properties of the expando class when they are needed for an entity or the simpler (for me) framework of just setting up all possible properties I might need from the start even though most instances will just be left empty.
In my specific case I would be having 5-8 empty ReferenceList properties as 'overhead' that will be empty when I skip using expando class.
class person()
{
public int Id{get;set;}
public string Name{get;set;}
}
HomeController.cs
ActionResult Index()
{
IList list=new[]{
new person { Id = 1, Name = "Name1" },
new person { Id = 2, Name = "Name2" },
new person { Id = 3, Name = "Name3" }
};
ViewData["mygrid"]=list;
return view();
}
Home\Index.spark
!{Html.Grid[[person]]("mygrid",
(column=>{
column.For(c=>c.Id);
column.For(c=>c.Name);
}))
Am getting the error
Dynamic view compilation failed..error CS1501: No overload for method 'Grid' takes '2' arguments.
I have added reference to MvcContrib.dll
And added following namespace in the _global.spark file
<use namespace="MvcContrib.UI"/>
<use namespace="MvcContrib.UI.Grid"/>
<use namespace="MvcContrib.UI.Pager"/>
<use namespace="MvcContrib.UI.Grid.ActionSyntax"/>
<use namespace="Microsoft.Web.Mvc.Controls"/>
I want to bind the data to my grid in spark view.Can anybody help.
GAE webapp allows to map single handler to a route:
application = webapp.WSGIApplication([
('/login', gae_handlers.UserLogin),
], debug=True)
Is there any way I can have a chain of request handlers?
I want to have handler which does authentication before all other handlers run.
I have a field device which keeps on sending data over to any designated port using sockets. I am planning to use GAE for server-side infrastructure.
I read GAE does not support sockets. But i can configure the device to send the data over port 80. so we wrote a genericservlet to capture this data on GAE. But it is not obtaining any values from the client.
any suggestions to fix this issue?
Good day!
https://developers.google.com/appengine/docs/python/gettingstarted/helloworld
this is the hello world that I'm trying to run.
I can seeing the
Hello, world!
Status: 500
message. however it will be turned to a "HTTP Error 500" after I hit the refresh.
and... it seems that the appengine only shows me the good result once after I re-save either app.yaml or helloworld.py
This is the trace for the good result
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 187, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 239, in _LoadHandler
raise ImportError('%s has no attribute %s' % (handler, name))
ImportError: <module 'helloworld' from 'D:\work\[GAE] tests\helloworld\helloworld.pyc'> has no attribute app
INFO 2012-06-23 01:47:28,522 dev_appserver.py:2891] "GET /hello HTTP/1.1" 200 -
ERROR 2012-06-23 01:47:30,040 wsgi.py:189]
and this is the trace for the Error 500
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 187, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 239, in _LoadHandler
raise ImportError('%s has no attribute %s' % (handler, name))
ImportError: <module 'helloworld' from 'D:\work\[GAE] tests\helloworld\helloworld.pyc'> has no attribute app
INFO 2012-06-23 01:47:30,127 dev_appserver.py:2891] "GET /hello HTTP/1.1" 500 -
here's my helloworld.py
print 'Content-Type: text/plain'
print ''
print 'Hello, world!'
my main.py. (app is used instead of application)
import webapp2
class hello(webapp2.RequestHandler):
def get(self):
self.response.out.write('normal hello')
app = webapp2.WSGIApplication([
('/', hello),
], debug = True)
and the app.yaml
application: helloworld
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /hello
script: helloworld.app
- url: /.*
script: main.app
libraries:
- name: webapp2
version: "2.5.1"
any clue what's causing this?
Regards,
I'd like to load some test data into my development db but not put it into my production db.
In django you can create database-specific fixtures using this mechanism: http://docs.djangoproject.com/en/dev/ref/django-admin/#database-specific-fixtures
It is possible to do something similar with django-nonrel?
ex:
username:zjm1126
password:11
i stored the password to the datastore on gae,
when i see the data view at /_ah/admin, i can see the password all people's password who register,
i think it is not safe , yes ?
is password stroed like this ?
how to stored password,
thanks
I'm using GwtUpload to upload images on GAE. The problem is that the images seem to get much bigger when I move them into a blob. I've noticed the same for simple text fields and in that case I've realised that some weirdo characters are being appended to the end of the field values (encoding right?). Can anyone help?
public class ImageUploadServlet extends AppEngineUploadAction {
/**
* Maintain a list with received files and their content types
*/
Hashtable<String, File> receivedFiles = new Hashtable<String, File>();
Hashtable<String, String> receivedContentTypes = new Hashtable<String, String>();
private Objectify objfy;
public ImageUploadServlet() {
ObjectifyService.register(Thumbnail.class);
objfy = ObjectifyService.begin();
System.out.println("ImageUploadServlet init");
}
/**
* Override executeAction to save the received files in a custom place and
* delete this items from session.
*/
@Override
public String executeAction(HttpServletRequest request,
List<FileItem> sessionFiles) throws UploadActionException {
Thumbnail t = new Thumbnail();
for (FileItem item : sessionFiles) {
//CacheableFileItem item = (CacheableFileItem)fItem;
if (false == item.isFormField()) {
System.out.println("the name 1st:" + item.getFieldName());
try {
// You can also specify the temporary folder
InputStream imgStream = item.getInputStream();
Blob imageBlob = new Blob(IOUtils.toByteArray(imgStream));
t.setMainImage(imageBlob);
System.out.println("blob: " + t.getMainImage());
} catch (Exception e) {
throw new UploadActionException(e.getMessage());
}
} else {
System.out.println("the name 2nd:" + item.getFieldName());
String name = item.getFieldName();
String value;
try {
InputStream is = item.getInputStream();
StringWriter writer = new StringWriter();
IOUtils.copy(is, writer,"UTF-8");
value = writer.toString();
writer.close();
System.out.println("parm name: " + name);
System.out.println("parm value: " + value + " **" + value.length());
System.out.println(item.getContentType());
if (name.equals("thumb-name")) {
t.setName(value);
}
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("Error");
e.printStackTrace();
}
}
removeSessionFileItems(request);
}
objfy.put(t);
return null;
}
As an example the size of the image is 20kb, and the lib has some debugging that confirms that this is the case when it's uploading the file but the blob ends up being over 1 MB.
Wes
Hi,
I've got spark intellisense working but when I open the parameters () of the method I can not see what is supposed to go in there and several of the methods have overloads so I can't see what options I have.
For example !{Html.Hidden()} once I open the () I can not see what parameters I am to pass
any ideas?
I'm running into a few problems with adding gae-sessions to a relatively mature GAE app. I followed the readme carefully and also looked at the demo.
First, just adding the gaesesions directory to my app causes the following error when running tests with nose and nose-gae:
Exception ImportError: 'No module named threading' in <bound method local.__del__ of <_threading_local.local object at 0x103e10628>> ignored
All the tests run fine so not a big problem but suggests that something isn't right.
Next, if I add the following two lines of code:
from gaesessions import get_current_session
session = get_current_session()
I get the following error:
Traceback (most recent call last):
File "/Users/.../unit_tests.py", line 1421, in testParseFBRequest
data = tasks.parse_fb_request(sr)
File "/Users/.../tasks.py", line 220, in parse_fb_request
session = get_current_session()
File "/Users/.../gaesessions/__init__.py", line 36, in get_current_session
return _tls.current_session
File "/Library/.../python2.7/_threading_local.py", line 193, in __getattribute__
return object.__getattribute__(self, name)
AttributeError: 'local' object has no attribute 'current_session'
Any suggestions on fixing the above would be greatly appreciated.
I've changed my model from
class Place
include DataMapper::Resource
has n, :trails
property :id, Serial
property :name, String, :length => 140
property :tag, String, :required => true
timestamps :at
end
to
class Place
include DataMapper::Resource
has n, :trails
property :id, Serial
property :name, String, :length => 140
property :tag, String, :required => true
property :trail_count, Integer, :default => 0
timestamps :at
end
I just added "property :trail_count, Integer, :default = 0"
and i want to migrate the existing appengine table to have the extra field "trail_count"
i've read that DataMapper.auto_upgrade! should do it.
but i get an error "undefined method `auto_upgrade!' for DataMapper:Module"
can you please help How do i migrate the DM models?
Hi,
In this example IS the exception being thrown if ANY of the Table elements are being changed by another client OR only if the element that we changed has been changed by another client?
Just to verify - the exception is thrown from the commit() isn't it?
PersistenceManager pm = PMF.get().getPersistenceManager();
try {
pm.currentTransaction().begin();
List<Row> Table = (List<Row>) pm.newQuery(query).execute();
Table.get(0).setReserved(true); // <----- we change only this element
pm.currentTransaction().commit();
} catch (JDOCanRetryException ex) {
pm.currentTransaction().rollback() // <----- if Table.get(1) was changed by another client do we get to this point???
}
Anyone have or know of a java implementation of an openid relying party(consumer) for gwt/gae?
openid4java and joid bring in too much baggage for my needs.
When a user sends a filled form, I want to print an error message in case there is an input error. One of the GAE sample codes does this by embedding the error message in the URI.
Inside the form handler (get):
self.redirect('/compose?error_message=%s' % message)
and in the handler (get) of redirected URI, gets the message from request:
values = {
'error_message': self.request.get('error_message'),
...
Is there a way to accomplish the same without embedding the message in the URI?
i can use this code to download all data from my app on gae :
appcfg.py download_data --application=zjm1126 --url=http://zjm1126.appspot.com/remote_api --filename=a.csv
it is not use bulkloader , so can i upload all data without bulkloader ,
thanks
I have a module called nbemail.py and in this module I want to use the function package_post defined in the module main.py. I am using this statement:
from api.main import package_post
But I am getting this error:
ImportError: cannot import name package_post
I really don't know why I am getting this error! I do have _init_.py files in the api directory (which contains the files nbemail.py and main.py) and I do have the function package_post defined in main.py.
Any idea to help fixing this problem?
JID jid = new JID("[email protected]"); //success with code
SUCCESS
JID jid = new JID("mycomponent.host.domain.com"); //send fail with
code INVALID_ID ,but when i try send from gmail OR jabber to
mycomponent.host.domain.com . it was a success.
Is this a but in google xmpp api?
Thanks for the help.
Currently I import in gae:
from google.appengine.ext.webapp import template
then use this to render:
self.response.out.write(template.render('tPage1.htm', templateInfo ))
I believe the template that Google supplied for Django templete is version 0.96.
How do I setup and import the newer version of only the Django template version 1.2.1?
Brian
I am impressed with django.Am am currenty a java developer.I want to make some cool websites for myself but i want to host it in some third pary environmet.
Now the question is can i host the django application on appengine?If yes , how??
Are there any site built using django which are already hosted on appengine?
I realise there are EL and near EL frameworks like StringTemplate, JUEL, Velocity, etc.
However, I am not asking for list of alternatives to JSTL/EL.
I came across a package more than a year ago, someone who wrote a util that emulates the functionality of JSP for non-servlet env, i.e., JSP composition which does not need a "servlet container" to function.
I ignored it and now I think it would be helpful to me and I need help to recall what it is.
My actual motivation is similar to what StringTemplate, JUEL, Velocity would offer to help me compose SQL blocks, HTML blocks but I am thinking that JSPs are precompiled into bytecode and JSPs are more run-time efficient since run-time parsing is done no more than once.
So actually, recommendation for alternatives would be acceptable as long as the templates are precompiled into bytecode. But I still prefer the JSP emulator.