I've noticed that dev_appserver inbound mail tab now encodes the email body to base64. Why the change? How can I detect what the encoding of the message is?
Hi guys,
Don't know if anyone has experience with the Google Spreadsheets API or the Zend_GData classes but it's worth a go:
When I try to insert a value in a 750 row spreadsheet, it takes ages and then throws an error that my memory limit (which is 128 MB!) was exceeded. I also got this when querying all records of this spreadsheet but this I can imaging because it's quite a lot of data. But why does this happen when inserting a row? That's not too complex, is it? Here's the code I used:
public function insertIntoSpreadsheet($username, $password, $spreadSheetId, $data = array()) {
$service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($username, $password, $service);
$client->setConfig(array( 'timeout' => 240 ));
$service = new Zend_Gdata_Spreadsheets($client);
if (count($data) == 0) {
die("No valid data");
}
try {
$newEntry = $service->insertRow($data, $spreadSheetId);
return true;
} catch (Exception $e) {
return false;
}
}
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 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?
I've have not had any trouble deploying through eclipse until now.
I'm guessing it might have to do with all the stuff I've added today
a folder of .pdf and .tex files (in war/web-inf directory)
a bit of JDO stuff
and a servlet that reads the files in the directory and indexes them into the JDO
Is there any way to find out what exactly is the problem?
I currently get stuck at "Initiating update"
and the stack trace say "ConnectionReset"
Any helkp of imput will be appreciated, I really need to deploy this today, thanks!
here's the deploy trace:
Unable to update:
java.net.SocketException: Connection reset
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at com.google.appengine.tools.admin.ServerConnection.getAuthCookie(ServerConnection.java:315)
at com.google.appengine.tools.admin.ServerConnection.authenticate(ServerConnection.java:219)
at com.google.appengine.tools.admin.ServerConnection.send(ServerConnection.java:145)
at com.google.appengine.tools.admin.ServerConnection.post(ServerConnection.java:81)
at com.google.appengine.tools.admin.AppVersionUpload.send(AppVersionUpload.java:427)
at com.google.appengine.tools.admin.AppVersionUpload.beginTransaction(AppVersionUpload.java:241)
at com.google.appengine.tools.admin.AppVersionUpload.doUpload(AppVersionUpload.java:98)
at com.google.appengine.tools.admin.AppAdminImpl.update(AppAdminImpl.java:56)
at com.google.appengine.eclipse.core.proxy.AppEngineBridgeImpl.deploy(AppEngineBridgeImpl.java:271)
at com.google.appengine.eclipse.core.deploy.DeployProjectJob.runInWorkspace(DeployProjectJob.java:148)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderFieldKey(Unknown Source)
at com.google.appengine.tools.util.ClientCookieManager.readCookies(ClientCookieManager.java:123)
at com.google.appengine.tools.admin.ServerConnection.connect(ServerConnection.java:340)
at com.google.appengine.tools.admin.ServerConnection.getAuthCookie(ServerConnection.java:314)
... 11 more
How to open a file in the parent directory in python in AppEngine?
I have a python file module/mod.py with the following code
f = open('../data.yml')
z = yaml.load(f)
f.close()
data.yml is in the parent dir of module. The error I get is
IOError: [Errno 13] file not accessible: '../data.yml'
I am using AppEngine SDK 1.3.3.
Is there a work around for this?
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 web form in SPARK which allow the editing of a Facility class that contains Rooms. When editing the Facility all the Rooms are listed for editing too. The form works fine for editing, but I would like to include a button "Add Room" that adds a new blank room below the existing ones. Any idea how this is accomplished?
Currently I am doing this in my SPARK page:
[All the Facility editing stuff...]
<p>Room</p>
<div class="small">Enter the rooms associated with this facility.</div>
<div class="add">
<div id="room">
<AddFacilityRoom each="var roomModel in Model.FacilityRooms" RoomModel="roomModel" Index="roomModelIndex" />
</div>
<a id="addRoom" class="add" href="events/room/add.mvc">Add a room</a>
</div>
AddFacilityRoom contains the html elements for editing a room.
I would like add.mvc to create a new empty Room class and inject a new identical (but empty) control below the existing ones. Currently, though it opens a new page when the "Add a Room" button is clicked.
I am implementing a tagging system for a website that uses JDO .
I would like to use this method.
However I am new to relationships in JDO.
To keep it simple, what I have looks like this:
@PersistentCapable
class Post {
@Persistent String title;
@Persistent String body;
}
@PersistentCapable
class Tag {
@Persistent String name;
}
What kind of JDO relationships do I need and how to implement them? I want to be able to list all Tags that belong to a Post, and also be able to list all Posts that have a given Tag. So in the end I would like to have something like this:
Table: Post
Columns: PostID, Title, Body
Table: Tag
Columns: TagID, name
Table: PostTag
Columns: PostID, TagID
Hi. Can someone please help me figure out a way to achieve the following (see snippets below) in Django templates? I know that you cannot use more than one extends, but I am new to django and I do not know the proper syntax for something like this. I want to be able to do this so that I can use my nested div layout for css reasons without having to type it like that each time and risking a typo. In words, I want to be able to have a page template extend my base.html file and then use html snippets of dynamic template content (i.e. template for loops or other template logic devices, not just a context variable I set from my view controller).
------------------------------------------------------------
base.html
------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>{% block title %}Title{% endblock %}</title>
</head>
<body>
<div class="wrapper">
<div class="header">
This is the common header
</div>
<div class="nav">
This is the common nav
</div>
{% if messages %}
<div class="messages">
<ul>
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
<div class="content">
{% block content %}Page Content{% endblock %}
</div>
<div class="footer">
This is the common footer
</div>
</div>
</body>
</html>
------------------------------------------------------------
columnlayout2.html
------------------------------------------------------------
<div class="twocol container2">
<div class="container1">
<div class="col1">
{% block twocol_col1 %}{% endblock %}
</div>
<div class="col2">
{% block twocol_col2 %}{% endblock %}
</div>
</div>
</div>
------------------------------------------------------------
columnlayout3.html
------------------------------------------------------------
<div class="threecol container3">
<div class="container2">
<div class="container1">
<div class="col1">
{% block threecol_col1 %}{% endblock %}
</div>
<div class="col2">
{% block threecol_col2 %}{% endblock %}
</div>
<div class="col3">
{% block threecol_col3 %}{% endblock %}
</div>
</div>
</div>
</div>
------------------------------------------------------------
page.html
------------------------------------------------------------
{% extends "base.html" %}
{% block content %}
{% extends "columnlayout2.html" %}
{% block twocol_col1 %}twocolumn column 1{% endblock %}
{% block twocol_col2 %}twocolumn column 2{% endblock %}
{% extends "columnlayout3.html" %}
{% block threecol_col1 %}threecol column 1{% endblock %}
{% block threecol_col2 %}threecol column 2{% endblock %}
{% block threecol_col3 %}threecol column 3{% endblock %}
{% endblock %}
------------------------------------------------------------
page.html output
------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Title</title>
</head>
<body>
<div class="wrapper">
<div class="header">
This is the common header
</div>
<div class="nav">
This is the common nav
</div>
<div class="content">
<div class="twocol container2">
<div class="container1">
<div class="col1">
twocolumn column 1
</div>
<div class="col2">
twocolumn column 2
</div>
</div>
</div>
<div class="threecol container3">
<div class="container2">
<div class="container1">
<div class="col1">
threecol column 1
</div>
<div class="col2">
threecol column 2
</div>
<div class="col3">
threecol column 3
</div>
</div>
</div>
</div>
</div>
<div class="footer">
This is the common footer
</div>
</div>
</body>
</html>
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.
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?
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,
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
I have an application built with GWT/Appengine/Jdo...and i am using Google User Service for authentication.
Google Chrome Extensions can use OAuth...I don't really undestand OAuth yet..
Would GWT RPC have to be reworked to enable OAuth?
Is there another way to authenticate users for Chrome Extensions?
How to find all clusters of forest on map ?
I have simple class cell like (Type is enum {RIVER, FOREST,GRASS,HILL}
class Cell{
public:
Type type;
int x;
int y
};
and map like vector<Cell> grid. Can anyone suggest me algorithm to create list<list<Cell>> clusters where list contains FOREST cells in same cluster (cluster are set of connected cells - connection can be in eight direction:up,down,left,right,up_right,up_left,down_left,down_right)? I need to find all clusters of forest on map and put every single cluster in list<Cell>.
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.
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 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'm trying to understand how can I do to let my site be reachable from google image search spiders.
I like how last.fm solution, and I thought to use a technique like his staff do to let google find artists images on their pages.
When I'm looking for an artist and I search it on google image search, as often as not I find an image from last.fm artists page, I make an example:
If I search the band Pure Reason Revolution It brings me here, the artist's image page
http://www.last.fm/music/Pure+Reason+Revolution/+images/4284073
Now if I take a look to the image file, i can see it's named:
http://userserve-ak.last.fm/serve/500/4284073/Pure+Reason+Revolution+4.jpg
so if I try to undertand how the service works I can try to say:
http://userserve-ak.last.fm/serve/ the server who serve the images
500/ the selected size for the image
4284073/ the image id for database
Pure+Reason+Revolution+4.jpg the image name
I thought it's difficult to think the real filename for the image is Pure+Reason+Revolution+4.jpg for image overwrite problems when an user upload it, in fact if I digit:
http://userserve-ak.last.fm/serve/500/4284073.jpg
I probably find the real image location and filename
With this tecnique the image is highly reachable from search engines and easily archived.
My question is, does exist some guide or tutorial to approach on this kind of tecniques, or something similar?
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.
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?
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?
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