Sunday, June 12, 2011

For a project, I needed a way to perform long-poll requests with GAE. Just using a normal connection doesn't work because of the 30-Seconds request limit GAE enforces. But starting with Version 1.4 Google released the Google Appengine Channel API which allows long-pull requests with a javascript client library.
It's quite easy to use. create a channel:
from google.appengine.api import channel
token = channel.create_channel(chan_name)

And start sending messages:
channel.send_message(chan_name, msg)

Unfortunately, there is neighter any non-javascript client library for use in desktop applications, nor is there any specifications of the protocol available. So I reverse-engineered the javascript-client and created a python client implementation. Feel free to use it. But be aware that although it seems to work quite well, it's not well tested yet. I've not yet used it on a real-world application. Be also aware that google could change the underlying protocol without any notice, which would obliviously break this library.

Saturday, June 11, 2011

Last weekend, I've created this simple QR-Code Generator. It was small just-for-fun project. It's not that I felt the world'd need another QR Code Generator. I was looking for a simple project to play a with Googles Closure Library and Closure Compiler, especially its option for Advanced Optimization. It enables function inlining and dead code removal, which I think is a really cool feature for javascript libraries, as you hardly every use all the features such libraries provide. This means you javascript files will get unnecessarily big, even if you do use some code minifier like Yahoo YUI or Closure Compiler (without Advanced Optimization).

In my case I get the following javascript file sizes:

simple optimization: 251K (gzipped: 57K)

advanced optimization: 60K (gzipped: 22K)

As far as I know jQuery unfortunately is not compatible with Advanced Optimization, though its documentation is mutch better.

The QR-Code Generator itself offers functionality for encoding Text, URLs, phone numbers and SMS. It has an option for shortening URLs. Wherefore it makes use of the goo.gl URL Shortener API. QR-Code-Images are generated using Google Chart API.

I've published a it as a WebApp on Chrome Web Store. That's also something I wanted to try out. Maybe even some people consider it useful.