Skip to content

Instantly share code, notes, and snippets.

import gaerun
from google.appengine.ext import db
from google.appengine.api import urlfetch
from google.appengine.api import memcache
import simplejson
import logging
class User(db.Model):
name = db.StringProperty()
# GAE-RUN - Makes running Google App Engine code easy.
#
# Author: Luke Hubbard - http://twitter.com/lukeinth
#
# Usage:
# - Make sure you have Google App Engine installed.
# - Download this file and save as gaerun.py in your app folder.
# - Add "import gaerun" at the t
# op of your code.
# - Run your code using command line / editor. Tip: (command + R) in textmate
var soap_raw_data = escape('<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><TestDB xmlns="http://itstechservices.com/" /></soap:Body></soap:Envelope>');
new Ajax.Request('http://ws.itstechservices.com/TruckServices.asmx',
{
method:'post',
postData: soap_raw_data,
requestHeaders: {SOAPAction: "http://itstechservices.com/TestDB", "Content-Type": "text/xml; charset=utf-8"},
onSuccess: function(transport){
var response = transport.responseText || "no response text";
//alert("Success! \n\n" + response);
# Editable Folder
#
# Author: luke hubbard - http://twitter.com/lukeinth
#
# Simple interface and handler to serve editable files out of memcache, db, or disk.
#
# Usage:
# - save this file as editable.py
# - create a folder called 'editable' and place your default css / html files in there
# - add handler to webapp or django or whatever framework you use
if __name__ == '__main__':
from doctest import gae
from google.appengine.ext import db
from google.appengine.api import memcache
from google.appengine.api.labs import taskqueue
import time
def task(f, classtask=False, modeltask=False):
def g(*args, **kwargs):
31o5
als
bm_
booth_dev
codegent
escribitionist
iampz
jfxburns
jirasak
jonrandy
::::::::::::::::::::::::::::::::::::::::::
[]::[][][][]::::[]::[][]::::::::[]::[][][]
::[][][]::[][][]::[]::[]::[][][]::::::[]::
[][][]::[]::[]::[][]::::::[][]::[]::[]::[]
[][][]::[][][][][][]::[][][][]::[][]::[][]
[][][]::[]::[][]::::::[][]::[][][]::::::[]
::[][]::[]::::[]::[][]::::::::[]::[][]::[]
::::[][]::[][][][][][][]::::[][]::[][][]::
::[][][][][][]::::[][][]::[][]::::[][][][]
[][][][][][][][][][][][][][][][][][][][][]
Barcamp Bangkok : "knowledge blossoming from a lotus"
Agile
Asia
Bangkok
Barcamp
Blogging
Business
Change
Cloud
# Patch GAE console to play nice with Django App Engine Patch
# Insert just below 'sys.path.insert(0, dirname(dirname(__file__)))' in console/app/console.py
app_path = dirname(dirname(dirname(dirname(__file__))))
sys.path.insert(0, app_path+'/common/appenginepatch')
sys.path.insert(0, app_path+'/common/zip-packages/django-1.0.2.zip')
sys.path.insert(0, app_path+'/common/appenginepatch/appenginepatcher/lib')
sys.path.insert(0, app_path+'/common')
# Got hit by this crazy bug in python
result = urlfetch.fetch('http://domain/image.jpg')
multipart_upload_body = "multi part %s upload string" % result.content
# This caused an invalid ascii error since result.content is binary and python wanted to convert it to ascii.
# The solution was not obvious, the only way we found to do it was to create a byte array then write to it like a buffer
buffer = array.array("B") # B = unsigned bytes
buffer.fromstring("multi part ")