4/24/2016

Facial Landmarks implemented by DLib on Android

  In the past, Google had provided Vision API to detect facial landmark. However, if you would like to use that, it requires Android Play Services SDK level 26 or greater. Besides, the number of landmarks might not be enough for you. Luckily, after the release of dlib, v18.10, it includes a number of new minor features.  The main addition in that release is an implementation of an excellent paper from this year's Computer Vision and Pattern Recognition Conference:
One Millisecond Face Alignment with an Ensemble of Regression Trees by Vahid Kazemi and Josephine Sullivan
The implementation of facial landmark extraction is fast enough, and it has 68 landmarks. Therefore, I spent a while to implement this feature to Android platform. 

Hope it can be helpful to Android developers. If it is helpful to you, please give me stars on my Github repositories, dlib-android and dlib-android-app

Setup and install Web server on ubuntu

In the article, I will show simple commands to install apache web server for local development and run a web page on Ubuntu.

Install Apache
$ sudo apt-get install apache2

Open your browser, and go to http://localhost/

Now, you can see the HTML file in /var/www/html/. Then, you can replace html file with yours.

For example, I clone my own web page from my github, and display it on browser.

$ git clone https://github.com/tzutalin/tzutalin.github.io.git
$ cd tzutalin.github.io; sudo cp -rf . /var/www/html/

Finally, open your browser and type "localhost", then you can see the web page



Note:
If you would like to register your own domain name, you can find DNS providers like GoDaddy, Namecheap, 1&1 Internet, Dotster.com, etc.




4/20/2016

Add Singleton Pattern to AndroidStudio Live Templates

AndroidStudio provides Live Templates to increase productivity for Android developers.

You can complete and insert code snippets into your code by typing their abbreviation and pressing tab. You can see and change those settings in the Editor section of the Preferences.


You can add your own templates. E.g. I add Singleton pattern, thus I can implement and add Singleton Pattern in a class quickly by type my defined abbreviation('singleton').


abbreviation : singleton 
description : Generate Singleton template for the current class
template text:
private $class$() {
    
}

private static class $class$LazyHolder {
   private static final $class$ INSTANCE = new $class$();
}

public static $class$ getInstance() {
   return $class$LazyHolder.INSTANCE;
}

Remember to let it be applicable in Java

Finally, in your java editor