Debugging Android applications

Recently I have been exploring Android development and it was just a matter of time to find myself in the need to debug some of the code I write. Android documentation talks a little about debugging using Eclipse, but I try to stay away from bloated IDEs, so I have to pay by not getting the sugar they offer. The alternatives are not as easy and pretty as using an IDE with a compatible debugger, but hopefully they will do the job.

Logging

I come from PHP and JavaScript, so logging or dumping stuff is something that I am used to doing. When I started using JavaScript and I wanted to know what my code was doing or the value of a variable in a specific point in time I used console.log to print it to the browser terminal. Using this approach is really easy and very helpful in a lot of scenarios.

Read More

Twitter Bootstrap

Twitter bootstrap is a front end framework that helps rapidly develop responsive web apps. Everybody says it is awesome, so I thought it was time to explore what it does.

I started by downloading it from Twitter Bootstrap Website. Twitter Bootstrap depends on jQuery and requires an HTML5 doctype so make sure your page has both.

Read More

Android Menus

There are three different types of menus that can be added to an Android app:

Action bar – For older devices this is the menu that you get when you click on the menu button on your device. Since most new devices don’t have this button anymore the recommended way to create this type of global menus is by using the action bar which is visible by default and located on the top of the screen.

Contextual action mode – This menu allows you to perform actions on selected elements. The contextual action bar can be found in the same place where the action bar was, but it only appears when elements are selected and actions can be performed against them.

Popup menu – This is a modal popup menu that should be used to perform actions related to the current view.

Read More

Creating a chrome extension

A few days ago I found that I wanted to create a browser extension for fixing some things that annoyed me about Jira, so I started my Journey of learning how to do this for Chrome. I had in the past written an extension for Firefox and I am not sure if it is because I did it so long ago or because chrome system is more friendly, but I felt this time was a lot easier.

Setting up the environment

The step of setting up the environment is extremely easy. Chrome gives you a lot of flexibility to do things the way you like, so basically the first thing you need is a folder and a manifest.json file inside of it. Here is an example of one:

Read More

Creating user interfaces with android (Part 2 of 2)

This is part 2 of an introduction to creating user interfaces for Android.

Styling

If you come from a web development background, you probably find it ugly to define styles inline. Luckily as with HTML and CSS, you can define your styles in an external file. The syntax is completely different so it may take some time to get used to, but I think of it as assigning classes to the elements I want to style and then defining their styles.

To create a stylesheet we need to create an XML file in the res/values/ directory, it should look something like this:

1
2
3
4
5
6
7
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="FillWidth">
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">wrap_content</item>
    </style>
</resources>
Read More

Creating user interfaces with android (Part 1 of 2)

I am resuming my journey to learning Android development and for this article I will focus on the UI. On this post I will explain how to add labels, buttons and related elements so the user can interact with our app.

The way I see building UIs for Android is very similar to they way they are built for the web. You can do it in two ways: programmatically or declaratively. Programmatically means creating elements using Java code and declaratively means using XML files. If you are familiar with web development, this is analogous to how JavaScript and HTML interact. As on Web, the recommended way is to do it declaratively whenever possible since it is usually faster.

While designing a user interface for android it is important to keep in mind Android design guidelines to give the user a consistent experience among different apps.

Read More

Creating web applications with Node and Express

Express is a web framework which allows you to easily make web applications on node. I already wrote about writing a simple server with node, but this time I will focus more on the application structure.

Lets start by creating a folder for our app called app/ and put a file inside named package.json. This is a special file used to define node projects. You can find more information about it on node JSON documentation, in this example I’ll use just the basics:

1
2
3
4
5
6
7
8
{
  "name": "app",
  "description": "A simple sample app",
  "version": "0.0.1",
  "dependencies": {
    "express": "3.x"
  }
}

An important thing to mention is that this has to be a JSON file, so all the json attributes and values must be wrapped by double quotes (“). Most of the fields are just information about the project, but the dependencies attribute defines which packages my projects depends on. These packages will by default be downloaded from npmjs.com. We specified that we want the latest revision of version 3 of Express for our project.

Read More

Getting started with Raspberry Pi

I got my hands into a Raspberry Pi, so I thought it was time to start playing with it. My goal is to show the first steps to get your Pi running, so basically installing the OS in the SD card.

I am going to install Raspbian, which you can get from Raspberry Pi’s download page. I used the torrent option, which downloaded a zip file. After getting the zip file, extract it’s contents and keep it handy for later.

To verify which devices are mounted run:

1
df -h

Now insert your SD card in your computer and run the command again. The device that wasn’t there is your SD card. The output looks something like this:

1
/dev/sdb1  3.7G 4.0K  3.7G  1% /media/adrian/Pi

Now that we know the device, we need to unmount it:

1
umount /dev/sdb1
Read More

Writing JavaScript unit tests with venus.js

JavaScript used to be a language mainly for handling minor interactions or animations in the browser, but not anymore. Now you can see full applications built using JavaScript. Frameworks like backbone have brought architecture to the browser and you can even see JavaScript being used in the server with frameworks like node. As JavaScript becomes a language for building real applications, it becomes important to also adopt professional practices like having a way write and run unit tests.

Venus

Venus is a test runner that makes it very easy to run your tests and plug them into a CI system. Venus is written in JavaScript and runs on Node. It lets you choose which tools you want to use to organize your tests, write assertions or create mocks.

You can get more information about venus at venus’ website and you can get the code at github.

Read More

Getting started with Jenkins Continuous Integration

For those of you who don’t know, Jenkins is an application that allows you to create a Continuous Integration environment for your software projects. Most of the time it is used to periodically run test and build your project in an environment that should be similar to your production environment.

Installation

To install Jenkins on a Debian based system you only need to use:

1
sudo apt-get install jenkins

This command will install it and will automatically start it as a service. This service will be started automatically every time your system is restarted.

If you are using another OS you can download a war file from Jenkins main site and run it using:

1
java -jar jenkins.war

To see your instance of Jenkins running you can visit http://localhost:8080

Read More