NoSQL and Polyglot Persistence


Historically, at the beginning in Databases We got a lot of cool things, like SQL, persistence, concurrence between transactions and all. But, for example in SQL we got some problems.

Object database could be cool. Save in the memory.

We were wrong. 

What object database are so good ? They have some answers to it, but it has passed. 

And the relational database continue dominates after 2000 years. It was hard to find a new way to get all informations and store them, using something better than RDMS.  

Particularly with the use of internet, we got a lot of traffic. Companies like Google or Amazon, for example, worry about those things. Computer costs a lot.  Lots a lots of CPUs it might be a good answer. Clusters?

Relational database are good to work in a single node. Companies like Google and Amazon created Bigtable and Dynamo, respectively. And then….NoSQL!

Basically, we cannot define NOSQL, but we can take a look in some characteristics, for example:

  • Open Source
  • Cluster friendly
  • Non-relational
  • Schema-less

Regarding to data models,web can find on the theory basically two data models: Key Value and Documents. Both are Aggregated. There are a fuzzy line between a document model and a key value model.

There are the Graph Model which is ACID and it’s not aggregated.

Discussing about Database, we should think about some inherent properties for a a relational database and so important in software development: Consistency.

Typically, We see RDBMS as ACID properties, We might to say noSQL are BASE! We should take care about consistency when We use a NoSQL database, and take a look for our system requirements. Normally, We use NoSQL when We need to get easier development and/or large scala data.

Nowadays, noSQL is an overrated theme, maybe we should talk about Polyglot Persistence.


Getting started with ExtJS4


What is EXTJS?
Ext JS is a javascript framework for rich apps in every browser. Using ExtJS 4 you dont worry about if your interface will render only in Firefox or Chrome. It’s a new standard to do web applications. ExtJS offers an extraordinary range of user interface widget. High performance scalable grids, trees, panels, menus, etc. There is a large community which build a lot of user extensions too.
Further Informations:

I’m not a good designer, ExtJs is for me ?
Of course! It’s not necessary have a design experience. That really comes in useful if you don’t know about design, cause ext will help you. With your standards interfaces, you can do amazing interfaces.

Is EXTJS for Beginers Javascript programmers?

No. It’s necessary some experience with javascript stuffs. If never already been programmed with Javascript, you may think extJS4 so hard. But always it’s time to start learning something new.

Talk is cheap, show me the code!

Are you ready to do the ExtJS Hello World?!

<!DOCTYPE html>
    <title>Hello ExtJS4</title>
    <link rel=”stylesheet” type=”text/css” href=””&gt;
    <!–extjs 4.0.2–>
    <script type=”text/javascript” charset=”utf-8″ src=””></script&gt;
    <script type=”text/javascript”>
        /* Put your ExtJS code here*/

We will create a simple form with two textfields. Some important aspects will be explained in the next posts. Now, I will only show the code.

Steps to create a good form:

Simple Form:

Simple Form

Stay tuned for the next posts!

P.S.: Thanks to  C. Milfont that helped me and encouraged me to study about it.

Possible problems with rails + mysql on OS X Lion


If you are trying to run your app with Rails and you got some errors when execute the rake db:migrate It is possible that you must to install the GCC. In Lion installation there is no gcc default. You can check GCC here:

Other possible error is the lack of a  symbolic link:

( Library not loaded: libmysqlclient.18.dylib )

ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

With these changes you may run successful the mysql + rails in your app.

Remembering that is a good practice to reinstall your gem after these changes:

gem uninstall mysql2

bundle install

Using web2py with postgreSQL


You must to install the packages:

  • python-dev
  • libpq-dev
We will use the PsycoPg which is the most popular PostgreSQL adapter for Python.
Download the PskycoPg.
At psycopg directory:
$python install
At, you can use:
    db = DAL(‘postgres://postgres:postgres@localhost/name’)

Non-Recursive Hanoi


A lot of people can think about how to do the Non-recursive Hanoi algorithm.

There is a Binary Solution(Binary Solution), and a version of a non-recursive on Wikipedia in others sites.

My algorithm was based on:

Hanoi Non-Recursive Solution (Wikipedia)

Moves Hanoi

The Algorithm:

Input: Number of disks(n = number of disks)
Output: Movements of Hanoi Tower

for ( i <- 1,...,2^n -1 )

if( n == even number)

if( i == odd number )



if( i == oddnumber)


About the functions:


This function moves the smaller disk in right direction.


This function moves the smaller disk in left direction.


This function moves the non-smaller disk in a movement that not involves the smaller disk.

The functions moveright() and moveleft() can be proved by induction.

Android 5 – Features


Game Devs


Android Work


Ahead-of-time (AOT) compilation

ART introduces ahead-of-time (AOT) compilation, which can improve app performance. ART also has tighter install-time verification than Dalvik.

At install time, ART compiles apps using the on-device dex2oat tool. This utility accepts DEX files as input and generates a compiled app executable for the target device. The utility should be able to compile all valid DEX files without difficulty. However, some post-processing tools produce invalid files that may be tolerated by Dalvik but cannot be compiled by ART. For more information, see Addressing Garbage Collection Issues.

Bluetooth low energy


Project Volta

In addition to new features, Android 5.0 emphasizes improvements in battery life. Use the new APIs and tool to understand and optimize your app’s power consumption.

Scheduling jobs

Android 5.0 provides a new JobScheduler API that lets you optimize battery life by defining jobs for the system to run asynchronously at a later time or under specified conditions (such as when the device is charging). Job scheduling is useful in such situations as:

  • The app has non-user-facing work that you can defer.
  • The app has work you’d prefer to do when the unit is plugged in.
  • The app has a task that requires network access or a Wi-Fi connection.
  • The app has a number of tasks that you want to run as a batch on a regular schedule.

A unit of work is encapsulated by a JobInfo object. This object specifies the scheduling criteria.

Use the JobInfo.Builder class to configure how the scheduled task should run. You can schedule the task to run under specific conditions, such as:

  • Start when the device is charging
  • Start when the device is connected to an unmetered network
  • Start when the device is idle
  • Finish before a certain deadline or with a minimum delay

For example, you can add code like this to run your task on an unmetered network:

JobInfo uploadTask = new JobInfo.Builder(mJobId,

                                         mServiceComponent /* JobService component */)



JobScheduler jobScheduler =

        (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);


If the device has stable power (that is, it has been plugged in for more than 2 minutes and the battery is at a healthy level), the system will run any scheduled job that is ready to run, even if the job’s deadline has not expired.

To see an example of how to use the JobScheduler API, refer to the JobSchedulerSample implementation sample in this release.

Further informations:

Printing Framework

Render PDF as bitmap

You can now render PDF document pages into bitmap images for printing by using the new PdfRenderer class. You must specify a ParcelFileDescriptor that is seekable (that is, the content can be randomly accessed) on which the system writes the the printable content. Your app can obtain a page for rendering with openPage(), then call render()to turn the opened PdfRenderer.Page into a bitmap. You can also set additional parameters if you only want to convert a portion of the document into a bitmap image (for example, to implement tiled rendering to zoom in on the document).

For an example of how to use the new APIs, see the PdfRendererBasic sample.

I’ve collected these informations from:

Error: failed to fetch from registry: cordova on ionic installation

vagrant@precise32:~$ sudo npm install -g cordova
npm http GET

npm ERR! Error: failed to fetch from registry: cordova
npm ERR! at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR! at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR! at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR! at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR! at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR! at Request.emit (events.js:88:20)
npm ERR! at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR! at ClientRequest.emit (events.js:67:17)
npm ERR! at HTTPParser.onIncoming (http.js:1261:11)
npm ERR! at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR! <>
npm ERR! or use
npm ERR! reportbug --attach /home/vagrant/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "cordova"
npm ERR! cwd /home/vagrant
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: cordova
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/vagrant/npm-debug.log
npm not ok

You need to set the NPM registry

npm config set registry

Apple’s WatchKit



This is a new development kit will allow developers to create interesting and exciting ways to use the Apple Watch hardware and software in their apps. This kit will help developers to create amazing functionalities, using Actionable notifications. During the presentation, Apple demonstrated some Facebook/Twitter notifications and others, for example, Car Location.

Are you excited to code for Apple Watch ?