Introduction to Android development - Building an application without an IDE

Android doesn’t support ant anymore. Take a look at: Building an Android project from scratch using Gradle to learn how to create a project with gradle.

Getting the environment set up

There are two packages needed for developing android applications. One is the Java Development Kit and the other is the Android SDK. You can install JDK with this command:

sudo apt-get install default-jdk

You can get Android SDK from this site: The site will give you two options, to download ADT (Android Development Tookit), which is the SDK + Eclipse or just the SDK. Choose to download only the SDK.

After downloading the package you need to unzip it, open a terminal, navigate to the folder where you downloaded it, go the the tools folder and run the android script:

cd /android-sdk/tools
Read More

Making your local server accessible from anywhere

In reality you probably don’t want to host you websites on your local computer unless you have a very good computer, a very good internet connection and you are an expert system administrator, but this is very useful to learn how the internet works.

In this case I am doing this because I want to be able to develop on my computer no matter where I am. So I want to be able to SSH to my machine, modify my files and view my changes from a web browser. Here are the things that need to be done:

  • Setup a local HTTP server
  • Allow inbound traffic on port 80
  • Setup a free DNS service
  • Setup an SSH server
  • Forward requests to port 22 on your router to your computer
Read More

Introduction to Backbone.js

Backbone.js is a JavaScript framework that facilitates the separation between models and views. It’s lack of controllers make me think of it as being similar to Django framework, so familiarity with Django may make it easier to understand backbone.

Backbone comes packaged in a js file that you can download from If you are not planning to hack backbone you should probably download the production version. Backbone can be used with any templating system but it comes with underscore.js support by default. For this reason to use backbone you will also need to download it from jQuery is another dependency of backbone, so you also need to include it in your bundle.

In all the examples I show I assume that you have already included jQuery, underscore.js and backbone.js with something similar to:

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="underscore.js"></script>
<script type="text/javascript" src="backbone.js"></script>
Read More

Git hook to run code static analysis

This post is the next step from my PHP Code Static Analysis post. Once I had a way to run static analysis on my project with just one command, I wanted to make this an automatic check every time something was committed.

This would have been a super simple task except that there was one feature that didn’t come out of the box from my build file. I wanted the build to fail when PHPDoc issues a warning so code is not committed without their respective doc blocks.

Git hooks

Git hooks are really easy to create. You just need to go to .git/hooks/ in your repository and you will find a list of the available hooks followed by the .sample extension. To activate the hook you just need to remove the .sample extension and give the file execution permissions. The content of the hook can be any script that can be executed from a terminal.

Read More

JavaScript Static Code Analysis Using JSLint

JSLint is a Code Static Analysis tool created by Douglas Crockford. JSLint is written in JavaScript so it can easily be run from a browser but since I want to be able to check all my JS files automatically in a CI environment I will use Rhino, a JS engine written in Java that can be run from the command line. To install Rhino in Ubuntu just do:

sudo apt-get install rhino

Once installed you can take it out for a ride:

adrian@me:~$ rhino
Rhino 1.7 release 3 2012 05 18
js> var a = 4;
js> a;
js> a + 7;
js> quit();
Read More

Zend Framework Authorization

Authorization is the process of specifying access to resources to different users based on defined roles. Zend Framework provides Zend_Acl to define and enforce an Access Control List (ACL).


In Zend Framework context resources are usually actions you want to control access to. Zend provides the Zend_Acl_Resource class to create resources. Each resource should have a unique ID to identify it.

new Zend_Acl_Resource('resourceId');

Then you can add the resource to Zend_Acl using Zend_Acl::add:

Zend_Acl::add(new Zend_Acl_Resource('resourceId'));
Read More

Configuring Vim

In order to make Vim work the way I like I had to install some plugins:


Makes it easy to manage your plugins. To install:

mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl -Sso ~/.vim/autoload/pathogen.vim \

And add this to your .vimrc:

call pathogen#infect()
Read More

Introduction to Vim

Why vim?

I have in the past done most of my development in Linux machine using gedit with a series of plugins to help me do stuff faster. Some times out of necessity I found myself developing on a Windows machine in which case Notepad++ helped me not miss Gedit too much. Today I have found myself in the necessity to develop on a Mac computer and I realized that using a different editor each time I change my development machine wasn’t going to be a good solution in the long term.

People have recommended me to use some IDEs and editors that work in most platforms but most of them are really slow and the ones that are not slow require you to buy a license which is something I would rather avoid.

Vim is not a very friendly editor in the beginning but I have heard a lot of people say awesome things about it and it has the advantage of being available for virtually all operating systems out there (comes by default on MAC and most Linux machines), be very lightweight, extendable and most importantly, free.

Read More

Colorize git output

In linux git doesn’t show colors by default. To make git diff, log, status, etc…, show pretty colors you need to issue this command from a terminal:

git config --global color.ui true
Read More

Creating your own PHPCS standard

PHPCS is a great tool to help you make sure the correct coding style is being followed within a project. The problem is that some times the build in standards don’t cover all your needs so it is necessary to build custom rules. I will walk through the process I followed to create my own coding standard based on the build-in Zend standard.

Creating your work environment

In Ubuntu all PHPCS standards are stored in /usr/share/php/PHP/CodeSniffer/Standards/. There is a folder for each standard named after the standard name. I will call my standard Soonick, so I will create a folder with that name.

Read More