Publishing an Android app to the play store

There is extensive documentation of what you need to do to release your app in the Android documentation. It is so much documentation that I wanted to gather a more straight forward list of steps.

Create a self-signed key

To generate your key, use this command:

1
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

You will be prompted for a password (You might want to use a strong one) for your keystore. Then you will be asked for some information and finally another password for your key (You can use the same as the one you used for the keystore). That will generate a file called my-release-key.keystore. Keep this file in a safe place because you will need it every time you update your app.

Read More

Instant mock testing with PowerMock - Book Review

A few weeks ago someone from Packt publishing contacted me offering me a free copy of Instant mock testing with PowerMock if I accepted to write a review afterwards. Since I’ve been lately suffering with Unit Testing on Android I accepted and here is my review.

The book is really short and focused, which made it a very fast ready. I like this because I don’t really want to spend a lot of time learning how to mock something, it should be really straight forward.

Read More

Big O Notation

Big O notation is a way to represent how well an algorithm scales as the amount of data involved increases. I will go over some examples of the most common orders and try to explain what each one means:

O(1)

This means that the algorithm will perform the same way no matter how long the data set is. This is usually the case for hash tables. Here is an example of an O(1) algorithm:

1
2
3
4
5
var myArray = [];

function addToArray(num) {
  myArray.push(num);
}
Read More

Increase number of files Command-T will search

I was having a problem with Vim’s Command-T plugin, where it didn’t find some files. Searching through the documentation I found the problem was that Command-T will search a maximum of 10,000 files by default. This can be changed by adding this to your .vimrc:

1
2
" Increase the number for files Command-T will search "
let g:CommandTMaxFiles=50000
Read More

Running simple web server on a folder

There are multiple web servers out there that allow you to do almost anything you can think of, but what I needed was to run a simple web server that would serve the files in a folder. Python allows you to do this very easily:

1
python -m SimpleHTTPServer
Read More

Command line task manager for Linux

I found this little gem because I wanted to see how my raspberry pi was handling one running process. You can use the top command to see the running processes:

1
top

You will probably have a bunch of zombie processes you don’t care about. To omit those use:

1
top -i
Read More

Writing unit test for Android with Easymock

I already wrote a post about how to create a test suite for Android, but while trying more complex tests I noticed that a lot of things are not as easy as I would have expected. Unit testing Java is different that unit testing JavaScript, but unit testing Android is even a little harder. The problem with Android is that a lot of things depend on the Activity life cycle and most of the methods have been made final so they are impossible to mock.

Alternatives

Easymock wasn’t my first alternative. My first choice was Robolectric because I heard a lot of people say good things about it, the problem is that it has very little documentation and most of it is specific for eclipse. They also have a sample project but I wasn’t able to make it work. I also tried Mockito but I wasn’t able to make it work with my project. The reason I chose Easymock is because it was really easy to make it work and it seems to have a lot of support and documentation.

Read More

Android emulator acceleration

The android emulator if used as it comes from the package is pretty slow, so it is good to know that there are ways to make it a little faster.

Graphics acceleration

To use this feature you need to have these versions installed:

  • Android SDK Tools, Revision 17 or higher
  • Android SDK Platform API 15, Revision 3 or higher

You can verify that you meet these requirements by launching the android app:

1
/path/to/android-sdk/tools/android
Read More

Introduction to Compass

Compass describes itself as an open source CSS authoring framework. For me, it is a tool that helps me organize my CSS and create sprites easily.

To install compass you need to have ruby on your system, which I trust you can do by yourself. Once you have ruby installed you need to use these commands:

1
2
gem update --system
gem install compass

Next you will want to create a compass project. Go to your project folder and use this command:

1
compass create <project-name>
Read More

Trasfering files via SSH

I sometimes need to transfer files from one computer to another using SSH and I always forget how to do it so I decided to write a short post as a reminder.

To copy a file from one computer to another we use the scp command, which is very easy to use:

1
scp file.txt <remote user>@<some domain or ip>:<remote path>

The cool thing is that you can copy from the remote computer to your local computer inverting the order:

1
scp <remote user>@<some domain or ip>:<remote path to file> /home/adrian/

Finally, if you want to copy a folder with all it’s content you need to add a -r flag.

Read More