I did a “lightning talk” today at a local meetup for developers interested in cloud computing and Google’s App Engine specifically. The demo covered the basics of how Rotzy (which is built entirely on AppEngine) works and what it does etc… but I also tried to fit in as many tips and tricks for using App Engine as I could. Seemed like at least a few devs found it useful which is great!
Here are some of the (poorly made) slides I used while explaining some of the App Engine specific stuff. Hopefully some more people will find it useful too. Also, definitely check out Rotzy for the iPhone… it was built in our spare time and we are excited that it is growing steadily with a great community of users
Gee Projects, Python, Tips, rotzy appengine, google, iphone, rotzy
Today Google announced that they have removed the “high cpu request” limit on their AppEngine platform. This is great news as it used to limit your requests to a certain CPU usage quota… so any requests that used up too many cycles would eventually fail (if you did it too many times).
There is also one negative aspect to this. The old quota really helps you to optimize your code to run fast and hence be more scalable. Now that the quota is gone, it’ll be easier to be lazy about that
Here are the recent changes that were announced:
- No more “High CPU Requests”! App Engine Apps were once allowed no more than 2 CPU-intensive requests per minute. We’ve made some adjustments to the way we handle requests, and have eliminated this limitation altogether. To learn more about how this works and the implications for your app, see our documentation.
- Response deadline raised to 30 seconds. The amount of time an App Engine app can take to respond to an incoming request has been raised from 10 to 30 seconds! There are limits on the number of simultaneous active requests an application can process at any given moment–see our docs to learn more.
- Size limits on code files, static files, and requests/responses raised to 10MB! App Engine apps can now receive requests and send responses of up to 10MB in size, and users can upload 10MB code and static files as well. Note that API requests (e.g. memcache.set(), db.put()) are still limited to 1MB in size.
Gee News, Python appengine, google, Python
Here is a code snippet that I found very helpful thanks to zachary:
I needed to calculate a simple distance between two latitude, longitude pairs in miles and this did the trick. Apparently, its not the most accurate way to do it since the Earth is not a perfect sphere, but its close enough (an error of 0.5% at most I believe).
import math
#
# The following formulas are adapted from the Aviation Formulary
# http://williams.best.vwh.net/avform.htm
#
nauticalMilePerLat = 60.00721
nauticalMilePerLongitude = 60.10793
rad = math.pi / 180.0
milesPerNauticalMile = 1.15078
def calcDistance(lat1, lon1, lat2, lon2):
"""
Caclulate distance between two lat lons in NM
"""
yDistance = (lat2 - lat1) * nauticalMilePerLat
xDistance = (math.cos(lat1 * rad) + math.cos(lat2 * rad)) *
(lon2 - lon1) * (nauticalMilePerLongitude / 2)
distance = math.sqrt( yDistance**2 + xDistance**2 )
return distance * milesPerNauticalMile
Hopefully someone will find this useful as well.
Gee Python, Tips