KML Parsing in Android Using JSoup

I have a KML file and I want to extract certain portion of the file only. I am mainly interested in the coordinates of a line path.

Since I am using Java, there is an API which one can use to do the parsing. It is JSoup. You can download the library here. However, since I’m using Android Studio, I just included it in my build.gradle module file.

dependencies {
    ...
    compile 'org.jsoup:jsoup:1.8.1'
    ...
}

Sync the project afterwards.

Continue reading

Google Maps Android API v2 Tutorial using Android Studio

If you want to include Google Maps in your Android app and you are using Android Studio, just follow the simple steps below:

1. In your SDK Manager, make sure that the Google Play Services is installed.

01

2. Next is to get the SHA1 key needed for the registration of the app to Google’s Developer Console.

In the command line, issue the following command for Windows:

keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

I am not sure what it does, I just read it from the documentation. For other operation systems, check the documentation (see the debug certificate). If you cannot find the keytool program, it is located under the bin directory of your JDK folder. Continue reading

Implementing and Analyzing Network Topology in Mininet Using Python

I have an assignment in my Networks class which involves analyzing the performance of three different network topology, namely: flat, tree and layered. Below are the diagrams which represent the different network setup.

H0 is the server while H1 to H5 are all clients.

Flat Network Setup

flat

Tree Network Setup

tree

Layered Network Setup

layered

The task was to write a script that would allow all the hosts (H1-H5) to simultaneously ping the server (H0). Afterwards measure the average delay. Each link has a bandwidth of 10Mbps, delay of 5ms and 0% packet loss. Continue reading

Missing apache2 In /etc/init.d Directory

For some weird reason, I can’t start my Apache web service on my server. My server runs on Ubuntu Server. I tried to remove, purge and re-install the apache2 package. Still, the problem persisted.

My theory is that I installed apache2 before and removed it. Whenever I try to issue the following command:

sudo service apache2 start

I get this error message:

apache2: unrecognized service

Ubuntu will tell me that apache2 is an unrecognized service although I know apache2 was installed. After inspecting the /etc/init.d directory, the apache2 command was actually missing.

Re-installing with the simple apt-get remove and install will not work based on my experience. After searching for some answers in the forums, I came across this command:

sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2.2-common

I am not sure what it completely means but I guess it forces Ubuntu to re-install all the files and re-install the common files of apache2. After issuing this command, my apache2 command under the /etc/init.d directory came back.

It worked for me. Reference here.

AdMob Android Guide

If you are developing an Android app and you want to use AdMob, you can just follow the steps in this page.

However, what I noticed is that after including AdMob in the application, the APK grew tremendously. I came across one forum and one way to shrink the application size is modifying the gradle.build (module level).

dependencies {
    ...
    compile 'com.google.android.gms:play-services:6.+'
    ...
}

into this one:

dependencies {
    ...
    compile 'com.google.android.gms:play-services-ads:6.+'
    ...
}

This will save you around 600 KB.

Managing Your App’s Version in Android Studio

As I was trying to upload my app in the Google Play Store, I encountered the following error:

Capture

The error has got something to do with the version code of the APK I was uploading. I tried searching the Internet for answers and found out that I have to specify the version code inside the Android Manifest file. It has to be different from what is already in the Play Store (usually increment).

However, I still got the same error after generating the signed APK. Later I found out that if you are using Android Studio, you should modify the build.gradle (module level). You specify the version code there:

defaultConfig {
        applicationId "net.yancyparedes.subnetcalculator"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 2
        versionName "1.1"
    }

The version code does not necessarily mean the major revision version number. It should always be a whole number. If you only have a minor revision, you can specify it in the version name.