Install OpenCV Ubuntu server in Digital Ocean, Vultr or Amazon EC2

In the last few months I have been working in a Image Recognition system using OpenCV. The idea is to provide a REST API for clients to request images to be matched against an online database.

To run an application like this in the cloud I needed OpenCV installed in a VPS server using services such as Digital Ocean, VULTR or Amazon EC2.

In this post I will show how to install OpenCV in Ubuntu server.

For the configuration I will be using ubuntu server 14.04 (64bits), Digital Ocean and OpenCV v2.4.9 Continue reading

Merge Sort Python Iterative and Recursive implementations

Merge sort is a famous sorting algorithm with guarantee running time N Log N. However, this algorithm uses extra space equivalent to N. The algorithms uses a divide and conquer approach where an is divided in two and sorted, then the two sorted halves are merged. This post shows the Merge Sort Python implemented in two ways: Recursively and Iteratively. The implementation were done in Python to explore a different approach than the traditional C and Java languages.

Continue reading

QuickSort Python Iterative and Recursive implementations

QuickSort is one of the most famous sorting algorithms in computer science. I implemented the QuickSort in Python using two approaches including Recursive QuickSort and Iterative QuickSort.

The implementation were done in Python to explore a different approach than the traditional C and Java languages. Finally I scored the average running time obtained by running multiple times each approach.
Continue reading

Nexus 5 red vs nexus five white

Nexus 5 Red vs White Photos Comparison


Nexus 5 red vs white

Today I did a small video with some pictures that I took from the Nexus 5 Red and White. I just want to share with you so you can have a look the differences as I was undecided which one to keep. At the end, I chose the red one and my girlfriend kept the white one. As you will be able to see the Nexus 5 Red is quite different to the white one.

The Android nexus phone line is the best out there. The price is really good for the specifications of the phones. In addition, is perfect for Android app development.

Which one do you prefer?

Add Android ADB path Mac OS X Mavericks

When we start developing Android Apps on is useful to add the Android SDK path variables to OSX so we can execute the platforms tools such as the “adb” in the Terminal and control your Android development set up.

The steps are:

– Download the SDK from the android official page
– Unzip the file and save in the Home folder for example
– Launch the Terminal App
– Navigate to the Home folder “cd ~/”
– Write the command “echo $PATH” to see your current environment variables. It will return something similar to the line 2 below

– Create the .bash_profile file with the command “touch .bash_profile” Continue reading

Java vs C++ Performance Comparison, JIT Compilers, Java Hotspot & C++ Native Compiler

Java vs C++

Java vs C++

The gap between Java vs C++ performance has been narrowing for the past years; studies (Y Nikishkov, G Nikishkov & Savchenko, 2003; Taboada et al. 2013; Lewis & Neumann 2013; Oracle n.d.; Oancea et al. 2011) have shown that Java can achieve similar performance to natively compiled languages such as C++. Taboada et al. (2013, p425) argue that thanks to the Just-in-Time (JIT) compiler of the Java Virtual Machine (JVM) Java obtains native performance from Java bytecode.

Just-In- Time (JIT) compiler can significantly speed up the execution of Java applications. The JIT, which is an integral part of the JVM takes the bytecodes and compile them into native code before execution. Since Java is a dynamic language, the JIT compiles methods on a method-by-method basis just before they are called. If the same method called many times or if the method contains loop with many repetitions the effect of re-execution of the native code can dramatically change the performance of Java code (Y Nikishkov & G Nikishkov & Savchenko 2003. p2402).

With JIT the compilation can be optimized to the targeted CPU and the operating system model where the application runs. The system is able to collect statistics about how the program is actually running in the environment it is in, and it can rearrange and recompile for optimum performance. Continue reading

Java vs C++ Memory Management Features Comparison

Java vs C++

Java vs C++

There exist great differences between Java vs C++ memory management. One of the strengths of the Java platform is that performs automatic memory management; thereby developers do not need to worry about the complexity of explicit memory management. On the other hand, C++ provides developers with control over memory allocation and de-allocation using pointers, which indicate the memory can be use more efficiently and that performance programs can be optimized. However, Sun Microsystem (2006, p3) states that this can lead to serious executions errors. As a result, a large proportion of developers time is often spend debugging and trying to correct such error. In addition, there is nothing that restrains C++ developers from accessing OS data, or even executable code that resides in the memory (Vivanco & Pizzi 2005, p241). Continue reading