Thursday, 29 March 2012

Android land at Mobile World Congress 2012

A little late but here are some shots from Android land at Mobile World Congress 2012.




An android making little Android statues.



Club Android.



Wednesday, 29 February 2012

MWC: Huawei pretty booth

Huawei has got a very impressive boot here at MWC and some very neat products, but I didn't have much time as I was just passing by on my way to see Android's booth!











Saturday, 25 February 2012

Mobile World Congress



It's here once again, Mobile World Congress or MWC, is upon us and mad scramble for free badges is in full swing. You'd think a pretty large company would have this all sorted out by now, but what's the fun in that, besides as my crazy aunt always says, procrastination is the art of keeping up with yesterday.

So there you have it, I've just got my badge sorted out and I'll be there everyday till it's over. It's being held in beautiful Barcelona, Spain. Engadget have a beautiful picture of the venue worth checking out.

I'll be out and about looking at cool things to come and will try to live blog as fast as I can. So stay tuned folks because there's more to come.

Tuesday, 14 February 2012

Why use liburl when you can have 'requests'!

If you're is using liburl/liburl2, you might want to take a look at 'requests'. Very neat, clean and soft on the eyes :)

Sunday, 29 January 2012

Python simpleapi flask

I was looking for a quick and simple way to implement APIs with Flask and came across one aptly called Simpleapi.

After going through the examples, there seems to be a problem with getting POST data to the server, so after a small edit, GET works fine.

By default simpleapi client sends POST data, we will need to make a small change to make it send GET data. In /lib/python2.7/site-packages/simpleapi/client/client.py, line 62, change

client.py
try:
                response = urllib.urlopen(self.ns,
                                        urllib.urlencode(data))
Change to:
try:
                response = urllib.urlopen(self.ns %
                                        urllib.urlencode(data))
Flask server
from flask import Flask

from simpleapi import Route
from handler import calculator

app = Flask(__name__)
app.route('/api/', methods=['GET'])(Route(calculator, framework='flask', debug=True))

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8888, debug=True)
Client
#!/usr/bin/env python

from simpleapi import Client, RemoteException

calculator = Client(ns='http://127.0.0.1:8888/api/?%s')
print "the answer is", calculator.add(a=23, b=3)

Monday, 16 January 2012

Flask, virtualenv and Aptana/PyDev

I've just started playing with Flask and it's good, really really good. Today I want to tell you how I got Flask + virtualenv + Aptana studio 3, which includes PyDev, to work together.

  1. Create project directory and setup virtualenv environment in it
    mkdir projectfolder
    cd projectfolder
    virtualenv env
    . env/bin/activate
    
  2. In Aptana, import project then setup a new Python Interpreter which points to the 'Python executable' in the 'env' folder created by virtualenv command earlier.
    Go under 'Preferences -> PyDev -> Interpreter - Python',  click 'New...'.
    Now browse to your [PROJECT_FOLDER] -> env -> bin and select 'python2.7'.
    Change the 'Interpreter Name' to something descriptive like '[PROJECT_FOLDER]-Python' and click 'Ok'.
    A 'Selection needed' window will pop-up. Do not touch anything, click 'Ok'.
    An 'Error: Python stdlib source files not found' window will pop-up. Click 'Proceed anyways'. Click 'Ok' on preference window.
  3. In PyDev Package Explorer window, right-click on your project folder and select 'PyDev -> Set as PyDev Project'
  4. Right-click on project folder again and select 'Properties'.
    Go under 'PyDev - Interpreter/Grammer'
    Then under 'Interpreter' select the one we setup in step 2, [PROJECT_NAME]-Python.
  5. Click on 'Ok' and you're all set.
So it all runs pretty good so far, brought to you by the good folks of the 'internets' :)