Using SQLite Database with Android

By : Bala Subrahmanyam Varanasi - Where there's a will, there's a way.

Android embeds an Open Source Database called SQLite, which supports standard relational database features like SQL syntax, transactions and prepared statements. In addition it requires only little memory at runtime (approx. 250 KB). In this post I would like to show how to work with a simple pragmatic example : Baby Names App.

Before writing the code, let me show you some of the screen-shots of Baby Names App, which requires interaction with the database.

  1. When ever you launch the App, it will shows a Menu of items as below. Baby Names App Menu

  2. When we click on the highlighted button - "Common Names", it will ...

more info..
Topics : android java

Haml for Django developers

By : Shabda Raaj

Haml is taking the Ruby(and Rails) world by storm. Its not used as heavily by Python(and Django) developers as the Python solutions aren't as mature. I finally gave Haml a try and was pleasantly surprised how easy it was.

The most mature Python implementation of Haml is hamlpy, which converts the hamlpy code to Django templates. Others are shpaml and GHRML

Lets look at some templates from Django tutorial

{% if latest_poll_list %}
    <ul>
    {% for poll in latest_poll_list %}
        <li><a href="/polls/{{ poll.id }}/">{{ poll.question }}</a></li>
    {% endfor %}
    </ul>
{% endif %}

Here is this template converted to Haml

-if ...

more info..
Topics : django

Coffeescript for Python programmers

By : Shabda Raaj

I just learnt Coffeescript, and as a Python programmer loved being able to write Javascript in a Python like language. Coffeescript is inspired by Python/Ruby and is very close to these languages. Writing Coffeescript and reading the compiled Javascript also improved my understanding of Javascript. Without much ado here is translation of some Python code to Coffeescript to get you started.

Defining a variable

Python
a = 10

Coffeescript
a = 10

Setting scope is done via whitespaces.

Python

if i == 10:
    foo()

Coffeescript

if i == 10
    foo()

No semicolons

List comprehensions

Python

languages = ["Python", "Coffeescript", "Java", "Ruby", "Haskell"]
languages = [lan ...

more info..
Topics : coffeescript
© Agiliq, 2009-2012