Wednesday, May 20, 2015

FOSSology

FOSSology

FOSSology is an open source analyze tool. The mission of this is to build a community that facilitates the study of free and open source software by providing free and open source data analysis tools. However, this tool has been evolved to be a set of tools to assist open source governance. Today, the predominent use of FOSSology to scan files for copyrights and licenses. 

the installation files can be checked out from the link http://www.fossology.org/releases/ 
there are debian, Fedora, RHEL, ubuntu variants of the software. 

Once the setup is done, just can give the files to analyze or the SVN url of the target project to analyze and the report will be generated by scanning the files and giving the Licenes used the in the app. This tool tell the licensing used in various sources included in the application. Whether or not they to be corrected, is unto the developer. 

References:

IBM Bluemix - A high level understanding

IBM bluemix is an  open standards, cloud platform for building, running and managing applications. With Bluemix, developers can focus on building excellent user experiences with flexible compute options, choice of DevOps tooling, and a power full set of IBM third party APIs and services. 


Bluemix works in the below way. 

When an app is deployed on bluemix, developer needs to configure it with enough information. 

For a mobile app, Bluemix contains an artifact that represents the mobile apps backend, such as the services that are used by the mobile app to communicate with the server. 

For Web App, developer must ensure the information about the proper runtime and framework is communicated to bluemix, so that it can set up the proper execution environment to run the app. 

Each execution environment, including both mobile and web, is isolated from the execution environment of other apps. The execution environments are isolated even though they are not same physical machine. The following figure shows the basic flow of how bluemix manages the deployment of apps. 

When an app is deployed in to Bluemix, the environment determines an appropriate virtual machine to which the app or artifacts that the app represents is sent. For mobile apps, a mobile backend projection is created on Bluemix. Any code for the mobile app running in the cloud eventually runs in the bluemix environment. For a web app, the code running in the cloud is the app itself that the developer deploys the the bluemix. 

The VM of Bluemix is knows an Droplet Execution Agent (DEA). 


Picture courtesy, IBM 

When the app is deployed, if it has a web interface (as for a Java web app,) or other REST based services (such as mobile services exposed publicly to the mobile app) users of the app can communicate with it by using normal HTTP requests. 

Each app can have one or more URLS associated with it. But all of them must point to the Bluemix endpoint. When a request comes in, Bluemix examines the request, determines which app is intended for and then selects one of the instances of the app to receive the request.   

references:

Sunday, May 17, 2015

Few Jargons - Google Fiber, Project Fi

Google Fiber:
- Google Fiber is is about Super fast internet. This is Fiber-to-the premises service in the US providing broadband internet and cable television to a small and slowly increasing number of locations. As of March 2015, it had 27000 TV subscribers 



Project Fi 
Project Fi is a program to deliver fast, easy Wireless experience in close partnership with leading carriers , hardware makers, and Google users. 



Project Fi uses new technology to give users fast speed in more places and better connections to WiFi. Project Fi makes it easy to communicate in more places and use user’s  number with all his devices
Call and text can be made over WiFi for more coverage. 

Calls transition seamlessly between Wifi and cellular networks. 

To use phone number on any device, Connect any device that supports Google hangouts to the number then talk and text with anyone. The device can be Android , iOS, windows Mac OR Chromebook 

references:
https://fi.google.com/

Monday, May 11, 2015

MQTT on constrained devices - Part III

MQTT is designed for constrained devices. 
- Protocol comprised of bit-wise headers and variable length fields. 
- Smaller possible packet size is 2 bytes 
- Asynchronous bidirectional “push” delivery of messages to applications (no polling)
- Supports always connected and sometimes-connected models 
- Provides session awareness
- Configurable keep alive providing granual session awayreness 
- Last will and testament enable applications to know when a client goes offline abnormally.
- Typically utilises TCP based networks e.g. web sockets . The Http protocol can be upgraded as web sockets  
- Tested on many networks - vsat, gprs, 2G —

This protocol provides multiple deterministic message delivery qualities of Service. 

- 0. message delivered at most once
- 1 message will be delivered but may be duplicated 
- 2 - once and once only delivery
- QOS maintained over fragile network even if connection breaks. 

The protocol is suited for applications . devices that may have limited resources available 
- 8 bit controllers and upwards 
- Battery constrained devices 

There are multiple MQTT client implementations are available in many form factors / languages 
- Tiny footprint MQTT client and server libraries e.g. a C client lin in 30Kn and Java lib in 64 kb


References:

MQTT - Topics - Part II


A Topic forms the namespace. 
- Topic is  hierarchical with each “sub topic” separated by / 
- An example topic space 

A house publishes information about itself on
- / / / //energyConsumption 
- / / / / / solarEnergy 
- / / / / / alarmState
- / / / / / solarEnergy 
And it subscribes for control commands 
- / / / / / thermostat / setTemp 

A subscriber can subscribe to an absolute topic or can use wildcards. 
- Single level wildcards “+” can appear anywhere in the topic string 
- Mutli level wildcards “#” must appear at the end of the string 
- Wildcards must be next to a separator 
- Canot be used wildcards when publishing 

For example 
- India/KA/Bangalore/560100/1/energyconsumption
Energy consumption for 1 house in Bangalore
- India/KA/Bangalore/+/+/energyconsumption
Energy consumption of all houses in Bangalore
- India/KA/Bangalore/560100/# 

Details of Energy consumption, solar and alarm for all houses in 560100 

A subscription can be durable or non durable. 
Durable 
Once the subscription is in place, the broker will forward matching messages to the subscriber. 
Immediately if the subscriber is connected
If the subscriber is not connected, the messages are stored on the server/broker until the next time the subscriber connects. 
Non-Durable 
The subscription lifetime is the same as the time the subscriber is connected to the server / broker. 

A publication may be retained
- A publisher can mark a publication as retained. 
- The broker remembers the last known good message of a retained topic. 
- The broker gives the last known good message to new subscribers 

i.e. the new subscriber does not have to wait for a publisher to publish a message in order to receive its first message. 

references: 

MQTT in a Nutshell


MQTT stands for MQ Telemetry Transport. In a nutshell, it is a light weight event and message oriented protocol allowing devices to asynchronously communicate efficiently across constrained networks to remote systems. 

MQTT was invented before 13 years ago. The idea of this protocol is to get the data from the sensors, actuators, embedded controllers to a centralised data base system. Also this deals with how to get the control messages to these devices. In short, this is about connecting the traditional physical world devices to the IT infrastructure. 

Below are few design goals of MQTT 

1. To make it simple to connect the M2M (physical) world to the traditional IT world 
2. Expect and cater for frequent network disruption - built for low bandwidth, high latency, unreliable, high cost network (cost per byte) 
3. Expect client applications may have very limited resources available (8 bit controller, 256 kb ram)
4. Provide loose coupling to support dynamic system environments where high volumes of physical world messages and events needs to be made available to enterprise servers and other consumers in ways that may not have been originally anticipated. 
5. Provide multiple deterministic message delivery qualities of service to reflect tradeoffs between bandwidth, availability, and delivery gurantees
6. Capable of supporting large number of devices (10k MQTT clients) 
7. Simple for application developers and implementation of the protocol. 
8. Publish the protocol for ease of adoption by device vendors and third party client software enabling support for a proliferation of platforms, technologies and networks that are driven by very diverse equations of cost, technology and physical constraints. 
9 To be industry agnostic. 

MQTT is a publish subscribe messaging mechanism. 

A producer sends (publishes) a message (publication) on a topic (subject) 
A consumer subscribes (makes a subscription) for messages on a topic (subject) 

A message server / broker matches publications to subscriptions 
- if no matches the message is discarded 

- if one or more matches the message is delivered to each matching subscriber or consumer. 

references: 
https://www.youtube.com/watch?v=-KNPXPmx88E

Saturday, May 9, 2015

iOS VoIP Socket connections

Creating a socket connection and sending some data over the socket connection is pretty simple. 

Configuring the connection 

        CFReadStreamRef readStream;
        CFWriteStreamRef writeStream;
        CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)@"192.168.1.6",5060, &readStream, &writeStream);
        
        self.inputStream = (__bridge_transfer NSInputStream *)readStream;
        self.outputStream = (__bridge_transfer NSOutputStream *)writeStream;
        [self.inputStream setProperty:NSStreamNetworkServiceTypeVoIP forKey:NSStreamNetworkServiceType];
        // Setting the self delegate in input/output stream
        [self.inputStream setDelegate:self];
        [self.outputStream setDelegate:self];
        [self.inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
        [self.outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
        
        // Open the Connection
        [self.inputStream open];

        [self.outputStream open];


Handlign callbacks 
- (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode
{
    switch (eventCode) {
        case NSStreamEventNone:
            break;
            
        case NSStreamEventEndEncountered:
            [self printLog:@"Stream Event End"];
            break;
            
        case NSStreamEventErrorOccurred:
            [self printLog:[NSString stringWithFormat:@"Stream error: %@", aStream.streamError]];
            break;
            
        case NSStreamEventHasBytesAvailable:
            if (aStream == self.inputStream)
            {
                uint8_t buffer[1024];
                uint8_t *pongString = (uint8_t *)"Plong!\r\n";
                NSInteger bytesRead = [self.inputStream read:buffer maxLength:1024];
                NSString *stringRead = [[NSString alloc] initWithBytes:buffer length:bytesRead encoding:NSUTF8StringEncoding];
                stringRead = [stringRead stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
                
                [self printLog:[NSString stringWithFormat:@"Received: %@", stringRead]];
                [self.outputStream write:pongString maxLength:strlen((char*)pongString)];
                
            }
            break;
            
        case NSStreamEventHasSpaceAvailable:
            if (aStream == self.outputStream)
            {
                if (aStream == self.outputStream)
                {
                    [self.outputStream write:(const uint8_t *)"Plong!\r\n" maxLength:strlen("Plong\r\n")];
                    [self printLog:@"Plong sent"];
                }
            }
            break;
            
        case NSStreamEventOpenCompleted:
            if (aStream == self.inputStream)
            {
                [self printLog:@"NSStreamEventOpenCompleted"];
            }
            break;
            
        default:
            break;
    }
}

References: