Monday, November 30, 2015

Github learning - Hands on

the git config seems to be for the git directory that is initialized 

$git config user.name “Test Name“
error: could not lock config file .git/config: No such file or directory

unless the git init is called, the config cannot be done 

$git init
$git config user.name “Test Name“
$ git config user.email “test.name@gmail.com"


However, if we use the —- global switch, the configuration applies globally 

git config --get --global user.name 

This above command gives the user name that is configured globally. 


References:

Android Creating Library project


Android seems to have brought back the android libray project creation in Android latest studio. Below given the steps for it 

Go to File -> New -> New Module 
Select Java Library at the end of Options List 
Enter the name of the jar lib and name of the class and hit finish action 

Now as usual we can add this as dependancy by right clicking the app module and on the dependancy tab, press + and select the newly created 
jar file as dependancy. 

After building, if notice in the build / libs folder, the jar file can be found with the name classes.jar. This can be distributed across. 
To note, if right click and try to add resource folder to this directory, we cannot find the option to add resource directory unlike it can be 
found when right clicking on the library module project which outputs aar file.  

References:


Saturday, November 28, 2015

Android Fixing Manifest Error - manifest merger failure


When included a new Android Library module, got the conflict below. This happens when the Manifest merge fails between the module and the Application.

Error:(10, 9) Attribute application@label value=(IoT League) from AndroidManifest.xml:10:9
Error:(10, 9) Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@label value=(MyTestApp) from AndroidManifest.xml:10:9
  is also present at MyTestApp2:mytestlib:unspecified:13:9 value=(@string/app_name)
  Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:7:5 to override

To solve it, below can be added in the application manifest 

"http://schemas.android.com/apk/res/android"
package=“com.testapp” xmlns:tools="http://schemas.android.com/tools"

android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label=“MyTestApp2”
android:theme="@style/AppTheme"
tools:replace="android:label" 


References:

Friday, November 27, 2015

Android Project Management options

In Android studio, a module is first level of containment within a project that encapsulates specific types of source code files and resources. 
There are several module types in a project.

Android Application Modules : This is container for applications source code, resource files, and application level settings such as module level build file, resource files and android manifest file. The application module contents are eventually built into .apk files that get installed into device

Test Modules : Contains code to test the application and are built into test applications that run on a device. Bu default the test module can get the JUnit test cases inserted

Library Modules: Contains shareable android source code and resources that can referred in Android projects. Library modules cannot be installed onto a device, however, they are pulled into the .apk file at build time. 

App Engine modules: Android studio lets to easily add cloud backend to the application. A backend allows to implement functionality such as backing up user data to the cloud, serveing content to client apps, real time interactions, sending push notification through GCM. App Engine modules are App Engine Java servlet module for backend development, App Engine Java Endpoint module convert server side Java annotations into RESTful backend APIs, and App Engine Backend with GCM to send push messages to the server to Android devices. 


Referecens

Thursday, November 26, 2015

MAC some network debugging tips

To list all the active internet connection, lsof -i
this was giving output something like below

COMMAND     PID       USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
UserEvent   361 retheesh.r    4u  IPv4 0xff43389e676bc9b7      0t0  UDP *:*
SystemUIS   430 retheesh.r   19u  IPv4 0xff43389e60c1d5d7      0t0  UDP *:53182
SystemUIS   430 retheesh.r   21u  IPv4 0xff43389e6425e317      0t0  UDP *:*
sharingd    451 retheesh.r   25u  IPv4 0xff43389e60c1f8ff      0t0  UDP *:*
sharingd    451 retheesh.r   29u  IPv4 0xff43389e64203507      0t0  UDP *:*
com.apple   608 retheesh.r    6u  IPv4 0xff43389e676bc2af      0t0  UDP *:*
Skype       929 retheesh.r   21u  IPv4 0xff43389e60c1dcdf      0t0  UDP localhost:64712

When tried to open a page from Chrome, it listed as Google in the list above.


References:

Java How to Instantiate a class with Parameter arguments

Below is the way to do it. By default, the Class object has a newInstance method. however, this does not accept the parameter. 
We have a way to get the constructors of a class by using the getDeclaredConstructor method. This method accepts variable list of arguments
so that we can pass in the type of arguments of the constructor we would like to invoke. Sample is given below 

myConnection = myConnectionClass.getDeclaredConstructor(String.class,Hashtable.class).newInstance("CONN_ID",connProps);


References


What are the reasons for 488 SIP response

The Incoming NOTIFY to the client was generating a 488 Not accepted here response back to the server. Based on the description on the links given below, it appears that if the SIP header or body parameters are not in the formatted expected by the client, then it can send back the 488 message. 

In my case, the XML was not correctly formatted and hence it was giving this error. 

references: