Tuesday, March 10, 2015

Components of IMS Architecture


HSS (Home Subscriber Server) - or USPF (user profile server function) is a master user database that supports the IMS network entities that actually handles the calls. It contains subscriber information, performs authentication and authorization of the user and can provide information about the subscribers location and IP information. It is similar to GSM HLR (Home location register) and Authentication Centre (AuC) A Subscriber Location Function (SLF) is needed to map user addresses when multiple HSS are used. 

User Identities 
Various identities may be associated with IMS, IP Multimedia Private Identity (IMPI), IP Multimedia Public Identity (IMPU), Globally Routable User Agent URI (GRUU), Wildcard Public User Identity. Both IMPU and IMPI are not phone numbers or other series of digits, but they are URIs that can be digits ( a tel url such as tel:+1-555-123-4567) or alphanumeric identifiers (a sIP URI such as sip:john.doe@example.com)

IP Multimedia Private Identity (IMPI)
IMPI is IP Multimedia Private Identity which is a permanently allocated global identity assigned by the home network operator and is used for example for Registration, Authorisation, Administratio and Accounting purposes. Every IMS user will have one IMPI 

IP Multimedia Public Identity (IMPU)
IMPU is used by any user for requesting communication to other users (e.g. this might be included on a business card). There can be multiple IMPUs per IMPI. The IMPU can be shared with another phone, so that both can be reached with same identity (for e.g. single phone number for entire family) 

Globally Routable User Agent URI 
Globally routable User Agent URI is an identify that identifies a unique combination of IMPU and UE instance. There are two types of GRUU, Public-GRUU and temporary GRUU/ 

P-GRUU - lives longer and reveals the IMPU 
T-GRUU - do not reveal IMPU and are valid only until the contact is explicitly de-registered or the current registration expires. 

Wild Card Public User Identity 
This expresses a set of IMPUs grouped together. The HSS subscriber database contains the IMPU, IMPI, IMSI, MISDN, subscriber service profiles, service triggers, and other information. 

References: 

Xcode project, finding number of lines

I was trying to get the total number of lines present in a project and below are some of the results from investigation.

The utility can be downloaded from  source forge at the link here http://cloc.sourceforge.net/


perl cloc-1.62.pl .//

running the above gave results like this. 

176 text files.
176 unique files.
4 files ignored.

http://cloc.sourceforge.net v 1.56  T=2.0 s (86.0 files/s, 10838.0 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Objective C                     80           3848           1876          11844
C/C++ Header                    92            980           1716           1412
-------------------------------------------------------------------------------
SUM:                           172           4828           3592          13256

-------------------------------------------------------------------------------

references:

http://stackoverflow.com/questions/2003534/how-to-find-out-how-many-lines-of-code-there-are-in-an-xcode-project

Sunday, March 8, 2015

Java Sockets - Client and Server

Creating a socket server and socket client is easy as below.

Server

import java.net.*;
import java.io.*;
public class KnockKnockServer
{
public static void main (String a[])
{
        int portNumber = Integer.parseInt(a[0]);
        try
        {
             ServerSocket serverSocket = new ServerSocket(portNumber);
             Socket clientSocket = serverSocket.accept();
             PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
             BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
             String inputLine, outputLine;
            
            // Initiate conversation with client
            KnockKnockProtocol kkp = new KnockKnockProtocol();
            outputLine = kkp.processInput(null);
            out.println(outputLine);
            
            while ((inputLine = in.readLine()) != null) {
                outputLine = kkp.processInput(inputLine);
                out.println(outputLine);
                if (outputLine.equals("Bye."))
                    break;
            }
        }
        catch (Exception ex)
        {
            ex.printStackTrace();
        }
}
}
Client 
Client is pretty simple as well, just give the hostname and the ip at which the server listens. 

String hostName = args[0];
int portNumber = Integer.parseInt(args[1]);

try (
Socket kkSocket = new Socket(hostName, portNumber);
PrintWriter out = new PrintWriter(kkSocket.getOutputStream(), true);
BufferedReader in = new BufferedReader(
new InputStreamReader(kkSocket.getInputStream()));
)

references:
http://docs.oracle.com/javase/tutorial/networking/sockets/clientServer.html

Wednesday, March 4, 2015

NGINX server

NGINX server is something happened to explore due to a sudden requirement mail. 

The configuration and install was really simple as below few steps. 

Install the nginx-1.7.10.tar.gz 

unzip and go to the directory and 

./configure
make 
sudo make install

there are difernet module it looks like and they can be configured like mentioned in the mail below 


references:

Xcode how to Build from command line

The most useful command i could find is,


 xcodebuild -project "MyProj.xcodeproj" -scheme "MyProjProdScheme"  SYMROOT="/User/Builds/1.0.4.190/Prod_twc_adhoc" DSTROOT="/Users/Builds/1.0.4.190/Prod_twc_adhoc" archive

This generates the SYM and DSYM which is good.

References:
https://developer.apple.com/library/ios/technotes/tn2339/_index.html

Monday, March 2, 2015

iOS Extension Sharing Data between two apps

Solution is to setup an app group. App groups are the scheme iOS uses to share data between two different apps. If the apps have the right entitlements and proper provisioning, they can access a shared directory outside the local sandbox. 

It looks like we can enable the app group from the Application settings in the Xcode. Basically, Xcode is setting up the right entitlements and proper provisioning so that they can access shared directory outside of their normal sandbox. 

When flap the Xcode switch that says App Groups, Xcode contacts to developer centre to configure the app ID for app groups. Next, it will ask the developer for the group name. This will create one group and can download the provisioning profile. IF this doesn’t work from the Xcode, then developers also have a choice to do it from the developer centre online after logging into it. 

The simplest way to use app group is via sharing NSUserDefaults. But it is a little different that the app group is created specific to the domain. 

NSUserDefaults *myAppDefaults = [[NSUserDefaults alloc]initWithSuiteName:@“group.com.mycompany.testapp”];
[myAppDefaults setObject:@“foo” forKey:@“bar”];

the above approach is good if we don’t have to share much data. If apps want to share much data, then NSFileManager can be used as well. like below

NSURL *groupURL =[ [NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@“group.com.mycompany.testApp”];

Any App extension matching the group entitlement can access the same directory. 

References: 

Sunday, March 1, 2015

Android - Linear Layout Learning

Android Linear Layout: 
Linear layout is a ViewGroup that aligns all children in a single direction, vertically or horizontally. The layout direction can be specified in android:orientation attribute. 
All children of LinearLayout are stacked after the other, so a vertical list will only have one child per row no matter how wide they are, and a horizontal list will only e a 
row high, the height of tallest child, plus padding. A LinearLayout respects margins between children and the gravity (right, centre or left alignment) of each child.

Layout Weight 
LinearLayout also supports assigning a weight to individual children with the android:layout_weight attribute. This attribute assigns and importance value to a view in terms of how much 
space it should occupy on the screen. A larger weight value allows it to expand to fill any remaining space in the parent view. Child views can specify a weight value and then any remaining space 
in the view group is assigned to the children in the proportion of their declared weight. Default weight is zero. 

For e.g. f there are three text fields and two of them declare a weight of 1, while the other is given no weight, the third field without weight will not grow and will occupy only the area required by its content. 
The other two will expand equally to fill the space remaining after all three fields are measured. If the 3rd filed was given weight as 2, then it is now declared more important than both the others, so it gets harf the remaining space and the first two share the space equally. 

Below example gives an idea of the linear layout. 

    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:orientation="vertical" >
   
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="To" />
   
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Subject" />
   
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:gravity="top"
        android:hint="Message" />
   
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:text="Send" />


the device screenshot for the above is: 


references: 
http://developer.android.com/guide/topics/ui/layout/linear.html