Sebastián S.

Sep 20

App Engine People Source Code Available

We started AppEnginePeople.net to learn more about GAE and hopefully create something useful. Enough devs signed up and showed interest, more then we anticipated, so we decided to open source the code of the site.

It’s available on Bitbucket and licensed under the Apache license: https://bitbucket.org/sserrano/ae-people/src

It’s one of our first app engine projects. Sorry if the code is messy. We hope it’s useful and don’t hesitate to fork and contribute patches.

thanks, Mugur Marculescu, Sebastian Serrano and Martin Riva.

Aug 12

Flying with Flask in Google App Engine

May 16

App Engine People gets stats

mugurm:

Sebastian put up a statistics page up on appenginepeople.net. Check it out and see what version of the SDK devs are using and also what the countries with the most google app engine developers are.

Mar 28

BlobStore upload with django form validation Example

This is my current approach to handle blobstore uploads that also need a django form validation.

You can find the get_uploads helper function here: blobstore get_uploads helper function for django request

I tried to do the example as simple as possible, but complete. This may not be perfect, all comments are welcome.

Seba


#### core/models.py ####

from google.appengine.ext import blobstore
from google.appengine.ext import db

class PhotoItem(db.Model):
    name = db.StringProperty()
    photo = blobstore.BlobReferenceProperty()

#### core/forms.py ####

from django import forms

class PhotoForm(forms.Form):
    name = forms.CharField(required=True)


##### core/views.py ####

from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext

from google.appengine.ext import blobstore

from core.models import PhotoItem
from core.forms import PhotoForm
from core.utils import get_uploads

def upload_photo(request):
    if request.method == 'POST':
        photo_blobs = get_uploads(request, field_name="photo", populate_post=True)
        form = PhotoForm(request.POST)
        if form.is_valid() and len(photo_blobs) == 1:
            photo_item = PhotoItem(name=form.cleaned_data['name'],
                                   photo=photo_blobs[0])
            photo_item.put()
            
            return HttpResponseRedirect("/success")
        
        #ok, not valid
        if len(photo_blobs) == 0:
            #the file input is missing
            request.session['upload_error'] = "Photo is required"
            
        #save the post data in the session to be able to present errors after redirect
        request.session['upload_form_post'] = request.POST
        return HttpResponseRedirect(reverse("core.views.upload_photo"))
    elif request.session.has_key('upload_form_post'):
        form = PhotoForm(request.session['upload_form_post'])
        del request.session['upload_form_post']
    else:
        form = PhotoForm()
    
    params = {
        'upload_url': blobstore.create_upload_url(reverse("core.views.upload_photo")),
        'form': form,
        'upload_error': request.session.pop('upload_error', None)
    }
    
    return render_to_response("upload_photo.html", 
                              params,
                              RequestContext(request))

#### Example upload_photo.html ####
{% extends "base.html" %}

{% block main_content %}
    <h1>Upload Photo</h1>
    
    {% if upload_error %}
    <div class="error">{{ upload_error }}</div>
    {% endif %}
    <form action="{{ upload_url }}" method="post" 
                  enctype="multipart/form-data">
    <ul>
        {{ form.as_ul }}
        <li><input type="file" name="photo"/></li>
        <li><input type="submit"/></li>
    </ul>
    </form>
{% endblock %}

Mar 25

late snack

late snack

Mar 09

AppEngine Developer Directory

mugurm:

We’ve recently launched AppEnginePeople.net, a new directory site for Google App Engine developers, which is basically a clone of DjangoPeople.net but for app engine.

If you are interested in creating a profile just visit the site and sign in with your Google account.

Mar 08

appenginepeople

if you develop apps for #appengine you can add yourself to http://www.appenginepeople.net/

Feb 17

antibiotics for an awful cold

antibiotics for an awful cold

Dec 20

tracking html5/css3 support with analytics and modernizr

You may think that html5 and css3 is going to become widespread in something akin to a geologic time scale. The truth is that many html5 and css3 features have currently widespread support.

Below, there is an small snippet to track the browser support for these advanced features for your user base, using google analytics and modernizr.

Modernizr is a small footprint javascript library that let you test the support of html5 and css3 features. With the combination of modernizr and analytics custom vars, we can track which percent of our users support a particular html5 or css3 feature.

So suppose we want to know the user base support for: sessionstorage, localstorage, canvas, fonfaces and borderradius.

Our analytics tracking code would look like:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? 
"https://ssl." : "http://www."); 
document.write(unescape("%3Cscript src='" + gaJsHost + 
"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript" src="/media/js/modernizr-1.1.min.js"></script>
<script type="text/javascript">

try {
var pageTracker = _gat._getTracker("UA-YYYYY-X");

pageTracker._setCustomVar(1, "sessionstorage", Modernizr.sessionstorage , 2 );
pageTracker._setCustomVar(2, "localstorage", Modernizr.localstorage, 2 );
pageTracker._setCustomVar(3, "fontface", Modernizr.fontface, 2 );
pageTracker._setCustomVar(4, "canvas", Modernizr.canvas, 2 );
pageTracker._setCustomVar(5, "borderradius", Modernizr.borderradius, 2 );

pageTracker._trackPageview();

} catch(err) {}</script>

After you append this to your site html body the results are going to appear on analytics under “visitors > custom variables”

Using a similar snippet we found that at www.wegif.com more than 80% of our users support all these features. Cool right?

For more info about how all this works, continue reading at:

http://www.modernizr.com/

http://code.google.com/intl/en/apis/analytics/docs/tracking/gaTrackingCustomVariables.html

Dec 17

this kitty got popular (animated gif)