Archive for October, 2013


The Eye
======

Android app for finding your phone when you it on silent mode and forget 😛 Basically, an app for people just like me 🙂

 

We were a team of 5 people who actually pulled it off. Following is the paper we submitted so I thought of sharing it. 🙂

 

Introduction

These days the purpose of a cell phone is more important that just calling or receiving text messages. It’s the era of smart phones which are more useful and efficient and hence are a part of user’s life. Smart phones not only help you socialize and serve the purpose of a normal phone they also help users at work by their useful features and efficient applications. Misplacing or losing them can really harm the user in a lot of ways. So an android tracking device can be really helpful. In android devices space and time complexity are very important. Users always look for efficient applications which are not only fast but also occupy less space. Keeping this in mind the paper was designed. Usually device tracking applications are slow and don’t work with the same efficiency on all android versions. Android tracking devices are of great help to the users. One of the main features in all the android smart phones is availability of GPS by which it can show the location of the cell phone. Using this property the application gives the location of the cell so that the user can track its lost cell phone. Apart from this the application can get the cell phone to ring even if it is in silent mode that can help users to locate the cell phone. The application gets activated only if the user texts the keyword and the user can set the keyword according to their convenience and set words that are easy for them to remember.

Why Android?

Android operating system has gained a lot of popularity recently. According to a research conducted by Kantar Worlpanel Comtech 51.2% of all the smart phone users use android OS while 43.5% of them are using iOS. These statistics are good enough for us to realize that the market of android operating system is expanding at a fast pace and making an application on this platform will reach to a larger number of people And in many ways it is more efficient than all the other available mobile operating system. After original release there have been number of updates in the original version of Android. It is the software stack of mobile devices. Android SDK provides the API’s that is necessary to begin developing applications on the Android platform using the Java programming language. Android includes an embeddable browser built upon Web Kit, the same open source browser engine powering the iPhone’s Mobile Safari browser. There are following broad classifications in android based applications

Activities

From the home screen whenever an application is selected first the activity is launched. It is the part by the help of which the UI is implemented.

Boot-Up Receiver

The application starts on boot-up automatically and need not be started manually every time.

Content Provider

Basic job is to manage access to a persisted data. Usually comes into the picture when an application makes use of SQLite Database.

Broadcast receiver

It is basically launched to process a data element usually after occurrence of an event like receiving a text message. All these are the main building blocks of an android application. The architecture of android applications is really simple and that is the reason the number of android applications are higher than other operating systems.

Working of the app

This app really justifies its name “The Eye”, as it virtually has its watchful eyes on your device all the time. There are instructions which make this app very user-friendly. After installing the app and then opening it for the first time, the user gets a prompt to set the keywords for ring and GPS respectively in their particular areas. After saving, the app becomes active and henceforth it hunts for the keyword in all the incoming messages.

How does it actually work?

Before we dig deep into the technicalities, let’s zoom out a little and look at d generalized working of the app. But before that, one may wonder “what’s the need to find a phone? If I have one it’ll be in my pocket all the time!” Since the invention of phones, our dependency on them has also increased to a greater extent and people have become more forgetful of their phones as compared to the times earlier. And then came a new generation of phones appropriately called as the “smart phones” which gave a whole new meaning to our lives. A phone doesn’t mean just communication nowadays. We can plan our whole day on it. We expect a lot from our phones now! And thus, they need to be smarter! And this app adds to the smartness of these phones. The app starts up at d time of system boot and runs as a background activity throughout the system’s active time. On the first user login to the app, the user has to set a “trigger” keyword that is later on used in the effective working of the app. That’s it!!! The user need not do anything further except to remember the trigger keyword of course! Now, whenever the device is misplaced, the owner has to just text the keyword to his device from any other cell phone and this app makes his phone either ring (even in silent mode!) or send the GPS coordinates of his phone to the above mentioned secondary cell phone. The details of the two main feature of the app is given below- Main Features:-  Automatic Ringer Tone and GPS Tracking

Ringer: – The “ringer” is one of the most important features that the app promises to provide. Now the first question that strikes our minds is “what unique feature is it to make a phone ring? It already does so, isn’t it?” Here’s where the app’s ability comes in the foreground. We use the audio manager class and some of its objects to get our cell to ring.

final Audio Manager mAudio = (Audio Manager) getSystemService (Activity.AUDIO_SERVICE);

mAudio.setRingerMode (AudioManager.RINGER_MODE_NORMAL);

Notification = RingtoneManager.getDefaultUri (RingtoneManager.TYPE_RINGTONE);

GPS: – Mobile phone tracking refers to the attaining of the current position of a mobile, stationary or moving. Localization may occur either via multiple iterations of locating the phone by sending radio signals between (several) radio towers of the network and the phone, or simply via GPS. The technology of locating is based simply on the logic that a phone communicates with its nearest radio tower. So, the location of the phone could be figured out in that way! Usually, there are 3 basic tracking methods prevalent in use. Namely, Network-based (uses the service provider’s network to identify location) , Handset-based (requires installing client technology to use its benefits) and SIM-based (uses the SIM’s GSM or CDMA technology based on radio transmission). But, after the research on various tracking systems, we infer that HYBRID based technology is most beneficial for tracking purposes. But what is “hybrid” technology anyways? The HYBRID based tracking technology uses both “GPS” as well as the network provider to locate any device. This proves to be more efficient as compared to other methods, as is obvious by the fact that it mixes up the logic of more than 1 technology and hence becomes less error prone. In “The Eye”, we make use of this hybrid technology to track the location of our device. Firstly, the device receives a trigger from any secondary device and the network provider of the device comes into play. The device then tracks the GPS coordinates of itself, while GPS is enabled on it and sends back the information back to the secondary device in the form of a text message. If in case, the GPS is disabled on the android device, this app prompts the user to enable it.

if(gps.canGetLocation()){

     double latitude = gps.getLatitude(); double longitude = gps.getLongitude();

}

Summary

Although there are many android tracking applications found but they either occupy a lot of more or do not work efficiently on all the android versions. This application tries to works on both these problems and even plans to develop it further and make it better than the other applications available. The project is used to demonstrate the idea of a smart android tracking device that can store the keyword without using a data base and can efficiently track the phone’s location. Many more features can be added to this application to make it more efficient and attractive to the users. The current application is under further development to add features like camera activation, password protection of the app and the like. We are thinking to incorporate more such features into the application. This application can prove to be a really helpful and after further development it will attract more android users to us it.

Future Scope-

We all know that Android is a rising technology and hence, we believe that it can prove to provide a better scope for further developments in this app. The features that Android programming provides along with its hardware compatibility, has led to the inception of some ideas which could be implemented as an added advantage for “The Eye”.

Some of those would be as follows-

  • Camera enabled tracking – Along with GPS tracking of the device, the camera of the phone could also be enabled automatically so as to get the snaps of the immediate vicinity of the phone. This would help in better location of the device.
  • Controlling activities like calls, SMS or alarms – In case the user is sure about theft of the device, an option to control all the important activities would be a good option and also in terms with security & privacy of private data.
  • SIM Card blocking – We like to call it “The Self Destruct Mode”. And as the name suggests, In case there is no hope of retrieving the lost device, this feature could come into play and destroy sensitive & confidential data from the phone.
  • Password protection- A very good security feature in “The Eye” would be being able to enable password protection of the device remotely. In that way, as soon as the user realizes the loss of his device, he could enable the password protection feature to avoid further damage and prevent unwanted users from accessing it

 

 

The Project is hosted on my github page in case any of you would like contribute to it. 😀 Fork first please..

Happy to contribute people are welcome 🙂

 

 

Cloud Computing

NIST definition of cloud computing Cloud computing is a model for enabling convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, servers, storage, applications, and services) that can be rapidly provisioned and released with minimal management effort or service provider interaction.

Layers of Cloud Computing

Layers of Cloud Computing

The main idea behind cloud computing is not a new one. Remote servers have been used from a very long time now. Just the need for more space took over the idea over the multi functionalities of Cloud computing. Grid Computing, Utility Computing, Virtualization, Autonomic Computing, etc are the few of the related technologies which have gained popularity with the advent of Cloud Computing.

We’ll be focusing on the research challenges that Cloud Computing is facing in present day scenario:

  • Automated service provisioning
  • Virtual Machine Migration
  • Server Consolidation
  • Energy Management
  • Traffic Management and Analysis
  • Data Security
  • Software Frameworks
  • Storage Technologies and data management
  • Novel Cloud Architecture

To the technological aspects belong in particular issues related to (1) scale and elastic scalability, which is not only currently restricted to horizontal scale out, but also inefficient as it tends to resource over usage due to limited scale down capabilities and full replication of instances rather than only of essential segments. (2) Trust, security and privacy always pose issues in any internet provided service, but due to the specific nature of clouds, additional aspects related e.g. to multitenancy arise and control over data location etc. arise. What is more, clouds simplify malicious use of resources, e.g. for hacking purposes, but also for sensitive calculations (such as weapon design) etc. (3) Handling data in clouds is still complicated – in particular as data size and diversity grows, pure replication is no viable approach, leading to consistency and efficiency issues. Also, the lacking control over data location and missing provenance poses security and legalistic issues. (4) Programming models are currently not aligned to highly scalable applications and thus do not exploit the capabilities of clouds, whilst they should also simplify development. Along the same line, developers, providers and users should be able to control and restrict distribution and scaling behaviour. This relates to (5) systems development and management which is currently still executed mostly manually, thus contributing to substantial efficiency and bottleneck issues.

On the other hand, non-technological issues play a major role in realizing these technological aspects and in ensuring viability of the infrastructures in the first instance. To these belong in particular (1) economic aspects which cover knowledge about when, why, how to use which cloud system how this impacts on the original infrastructure (provider) –long-term experience is lacking in all these areas; and (2) legalistic issues which come as a consequence from the dynamic (location) handling of the clouds, their scalability and the partially unclear legislative issues in the internet. This covers in particular issues related to intellectual property rights and data protection. In addition, (3) aspects related to green IT need to be elaborated further, as the cloud offers principally “green capabilities” by reducing unnecessary power consumption, given that good scaling behaviour and good economic models are in place.

Let’s concentrate on the traffic control problem of Cloud computing architecture.

The use of virtualization and resource time sharing, clouds serve with a single set of physical resources a large user base with different users needs. Users paying only for the used resources and services by Service Level Agreement (SLA), without any knowledge of how a service provider uses a underlying computer technological knowledge. Therefore, the service provider is required to execute service requests from a user by maintaining quality of service (QoS) requirements. Queuing systems in which arriving customers who find all servers and waiting queue (if any) occupied may retry for service after a period of time are called Retrial queues [1, 2], because of the complexity of the retrial queuing models, analytic results are generally difficult to obtain. There are a great number of numerical and approximations methods available. The M/Ek/1 queuing system with cloud computing service station is very useful to provide basic framework for efficient design and analysis of several practical situations including various technical systems. Multiple servers in Cloud computing has several advantages, i.e. the system performance increases effectively by reducing the mean queue length and waiting time than compared to the traditional approach of having only single server so that the users need not wait for a long period of time and also queue length need not be large.

This is mere example of how queuing models(Erlang distribution) can be implemented in Cloud Computing Architecture to improve the performance of it in terms of speed and traffic control.

Another two important aspects of Cloud Computing are storage and framework management, which have been dealt by google itself:

Distributed file system over clouds

Google File System (GFS) is a proprietary distributed file system developed by Google and specially designed to provide efficient, reliable access to data using large clusters of commodity servers. Files are divided into chunks of 64 megabytes, and are usually appended to or read and only extremely rarely overwritten or shrunk. Compared with traditional file systems, GFS is designed and optimized to run on data centres to provide extremely high data throughputs, low latency and survive individual server failures. Inspired by GFS, the open source Hadoop Distributed File System (HDFS) stores large files across multiple machines. It achieves reliability by replicating the data across multiple servers. Similarly to GFS, data is stored on multiple geo-diverse nodes. The file system is built from a cluster of data nodes, each of which serves blocks of data over the network using a block protocol specific to HDFS. Data is also provided over HTTP, allowing access to all content from a web browser or other types of clients. Data nodes can talk to each other to rebalance data distribution, to move copies around, and to keep the replication of data high.

Distributed application framework over clouds

HTTP-based applications usually conform to some web application framework such as Java EE. In modern data centre environments, clusters of servers are also used for computation and data-intensive jobs such as financial trend analysis, or film animation. MapReduce is a software framework introduced by Google to support distributed computing on large data sets on clusters of computers. MapReduce consists of one Master, to which client applications submit MapReduce jobs. The Master pushes work out to available task nodes in the data center, striving to keep the tasks as close to the data as possible. The Master knows which node contains the data, and which other hosts are nearby. If the task cannot be hosted on the node where the data is stored, priority is given to nodes in the same rack. In this way, network traffic on the main backbone is reduced, which also helps to improve throughput, as the backbone is usually the bottleneck. If a task fails or times out, it is rescheduled. If the Master fails, all ongoing tasks are lost. The Master records what it is up to in the filesystem. When it starts up, it looks for any such data, so that it can restart work fr

om where it left off. The open source Hadoop MapReduce project is inspired by Google’s work. Currently, many organizations are using Hadoop MapReduce to run large data-intensive computations.

The term social network has become so popular and familiar during the past couple of years that even non-techie people understand what the term means. Facebook, however, has its own vernacular when it comes to understanding social networking. They call it the social graph. The social graph can be defined as the interconnections that exist among family, friends, and acquaintances that every person has.

You do need to know a Web programming language such as PHP or Java.

Facebook has its own platform – called the Facebook Platform. The Facebook Platform is a standards-based programming framework that enables developers to create applications that interact and integrate with core Facebook services.

Now, Let’s try to understand the architecture of Facebook applications.

Facebook applications are not installed directly onto the Facebook server. Instead, they are placed on the developer’s server and then called by Facebook when the application URL is requested. To interact with applications, Facebook uses a callback metaphor. The URL of your application is associated with a registered application in Facebook. When the Facebook application URL (such as http://www.facebook.com/avengers) is requested, Facebook redirects the request to your server. Your application processes the request, communicates with Facebook using the Facebook Application Programming Interface (API) or Facebook Query Language (FQL), and returns Facebook Markup Language (FBML) to Facebook for presentation to the user inside of its canvas.

The Facebook Platform consists of four components that you work with

inside your code:

  • Facebook API
  • FBML (Facebook Markup Language)
  • FQL (Facebook Query Language)
  • Facebook JavaScript

Facebook API : The Facebook API is a Web services programming interface for accessing core services (profile, friends, group, event, photo) and performing other Facebook-centric functionality (log in, redirect, update view).

Facebook officially supports client libraries for PHP (4 and 5) and Java. These can be downloaded at developers.facebook.com/resources.php. Several unofficial client libraries have been developed for most every major Web programming language, including ASP.NET, ASP (VBScript), C++, C#, PHP4, Perl, Python, Ruby, VB.NET and Windows Mobile. To download these unofficial versions, go to wiki.developers.facebook.com.

When you use a client library, you use language-specific methods to access Facebook  services. For example, here’s how you can retrieve the name and picture of a user and then display it on a page:

$user_data = array(‘name’, ‘pic’, ‘activities’);

$current = $facebook->api_client->users_getInfo($user, $user_data);

echo “<p>Your name is {$current[0][‘name’]} </p>”;

echo “<p>Here is what you look like: <img src=’{$current[0][‘pic’]} /></p>”;

Facebook Markup Language (FBML) is an HTML-like language used to display pages inside of the Facebook canvas. Here are three basic facts about FBML:

  • FBML contains a subset of HTML elements. Such common elements as p, ul, and h1 are part of FBML.
  • FBML provides qualified support for script and style elements. Normal JavaScript is not supported in a script element, although Facebook JavaScript (see the “Facebook JavaScript” section below) does permit some scripting capabilities. You cannot use the style element to link to external style sheets, but you can use it for internal CSS.
  • FBML also includes several proprietary extensions for Facebook-specific UI elements as well as program flow.

For example, the fb:name element displays the name of the user based on

the value of the uid attribute:

<p>Your name is: <fb:name uid=”665127078” useyou=”false”/></p>

Consider the following:

<fb:if-can-see uid=”665127078” what=”profile”>

<p>You are granted access, you lucky one!</p>

<fb:else>Go somewhere else, you unfortunate one.</fb:else>

</fb:if-can-see>

Facebook Query Language (FQL) is a SQL-based interface into Facebook data. You can access many Facebook database tables, including user, friend, group, group_member, event, event_member, photo, album, and photo_tag. It is somewhat similar to SQL that you might be acquainted. You can actually perform most of the same data access routines using either API or FQL.

$friends = $facebook->api_client->fql_query(“SELECT uid, name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=$user)”);

Facebook JavaScript (FBJS): FBML does not support the use of standard JavaScript using the script element. However, Facebook JavaScript (or FBJS, for short) allows for limited scripting functionality inside a Facebook application. Here are some of the differences between FBJS and JavaScript:

  • Instead of using the standard JavaScript DOM, Facebook provides its own alternative DOM implementation.
  • Many FBJS object implementations are the same as standard JavaScript, although there are some differences. For example, instead of accessing a JavaScript property (such as document.href), FBJS uses a pair of get and set methods instead (getHref, setHref).
  • When Facebook processes scripting code inside of script elements, it tacks on the application ID to function and variable names. Facebook does this to create an application-specific scope.

Before coding the application itself, you are going to need to get some application-specific information from Facebook to communicate with the Facebook Platform. Your first step is, therefore, to register the application with Facebook. When you do so, you’ll get an API key and secret key that you can plug into your code.

You can register from this site: www.facebook.com/developers

They provide with a API key and other details that you’ve to register before actual coding of your application. There is alternate way to register the server in which the app is to be loaded. This comes in with the Cloud platform and facebook provides a direct link to Heroku site for server upload. You can register for Heroku and they provide you with a different space where you can upload your app, in case you don’t have server of your own.

Note down the API key, the secret key for your app and the callback URL, for you’ll be needing them while coding of the app.

Furthermore, you can download the Client Library files from facebook.com/developers/apps.php on whichever language you’re planning to use.

Here’s a small demo on how to include the key files in your app. I’ve used PHP as a language here. However you can use java, or any other language to your desire.

<?php

require_once ‘../facebook-platform/client/facebook.php’;

// *** Add your Facebook API Key, Secret Key, and Callback URL here ***

$appapikey = ‘[your_api_key]’;

$appsecret = ‘[your_secret_key]’;

$appcallbackurl = ‘[your_web_app_url]’;

// Connect to Facebook, retrieve user

$facebook = new Facebook($appapikey, $appsecret);

$user = $facebook->require_login();

// Exception handler for invalid session_keys

try {

// If app is not added, then attempt to add

if (!$facebook->api_client->users_isAppAdded()) {

$facebook->redirect($facebook->get_add_url());

}

} catch (Exception $ex) {

// Clear out cookies for app and redirect user to a login prompt

$facebook->set_user(null, null);

$facebook->redirect($appcallbackurl);

}

?>

That’s all you need to get started. 🙂

Have fun building great apps for facebook 🙂 See you soon 😀

More is Less

Usually when we get more.. we actually start thinking otherwise and end up with nothing.. There are times when we had nothing, so we made plans for taking up everything.. Now, when we get many things we end up with nothing to actually work on and hence end up with nothing again..

Back in home, i didn’t get access to fast internet and i completed three projects in three different areas. Now, I’m having an internet speed of 2Mb/s and I dunno what to do with.. So, basically I’m gonna end up winning over it and do some pretty stupid meaningless things.. This time, I’m gonna something new..

But first I would need an idea to work on to.. Stand by..

Coming in hard this time  😉

%d bloggers like this: