Monday 6 October 2014

Features of Angular JS


One of my tech lead Arun Gopi said in between 2011 that the “JavaScript gonna own the developer world in coming future”.  I didn’t care about his quote, i thought what is possible with this  lightweight scripting language, it  can do some kind of client side programmings other than that it is useless. On that period i was not aware about the possibilities of javascript. There were  lots of inventions of javascript frameworks on the time of 2011. And now with this lightweight scripting language we can do server side programmings, game developments,  desktop applications and mobile  applications etc. The JS frameworks build by some big bang companies made the JS so much popular. Some of the best popular JS frameworks are BackBone.js, Ember.js, Angular.js, Extjs (Sencha) etc. In these framework the most popular and hottest framework is AngularJS. How it come most popular and hottest one among these frameworks? It should have that much features and backed up supports. Since it is developed by google, there is no need of doubt on support for AngularJS. About the features, there is lots of comments are coming from different forums and blogs about the features of angular js. I started working on angular js and found the features of angular js is pretty cool. I am interested to share some of the features what i felt while developing in Angularjs.
Data Binding.

Most of the time , the data should be retrieve from the server and should show it visually. For this we always need to get data from server and assigned to a model and then this model is set to the corresponding view. If any change happened to the views it should reflect the model which we assigned so the events should be listened for the  change in view. Also there will be reverse case if there is any change happened to the model it should reflect the view also. So implementing this we need to write codings to implement the logic. The one of the interesting and which would i look most curiously look into the feature of angular js will do the  things which i have explained earlier. Since the feature of Two Way Data Binding, if we assign a model for a view then whenever a change is happened to the model it will automatically reflect to the view and whenever there is event have occurred in the views it will automatically reflect to the models. If any manual changes is required then this can be done by some of the functions provided by the AngularJS like $watch, $digest, $apply etc.

MVC

Every developers would like to develop their software  in a structured manner. Because it will be very helpful for coding, editing on them and easy to handle. For structuring the projects the best way is MVC Model-View-Controller concept. Most of the JavaScript framework will tell to do in MVC pattern and developers needed to implement it. In the case of AngularJS, it is implemented in such a way. Here the view is the projection of the model, whenever there is any change in model it will shown in view and vice versa. The changes for the models can be done by writing functions in controllers. Here view will be written in html files and there will be a controllers for these html files. These controllers will be assigned to html file with the help of directive called ng-controller. And there will be a scope variable for the controller.This scope variable will have the some properties and these will be the models. Your controller will be responsible for binding model data to views using $scope.

Services

We have gone through the two way data binding and MVC structure. Now we need to know how to write the business logic in AngularJS. As we discussed above the controller will bind the data does and it not contain the code to fetch the data and manipulating it. We can use Services for implementing the business logic and manipulations. Services is a singleton object which contain some useful functions. These functions can be used from anywhere from controller, filters etc. What should do to access these function is to inject the services into the controllers (which means just include the service). We can declare service in different ways, in that mostly used couple of methods are module.factory and module.service. We can use services to pass datas from one controller to another controller  with the help of $broadcast and $on. $broadcast is used to dispatch an event to the child scope which is registered to these event. $on will listen these event and will do the coding when these functions are triggered.

Directives

One of the important component angularjs is directive. Most of the things we used in angularjs will be directives. Some of them are ng-repeat, ng-if, ng-switch,  ng-model etc. Directive is the root of angular js and it makes the angular js more powerful. One of the interesting directive is ng-repeat. Most of them might know about the ng-repeat who have created a single angular app. With the help of this directive we can easily populate a data into a list or table etc. The basic idea behind directive is very simple. It makes your HTML truly interactive by attaching event listeners to the elements and/or  transforming the DOM. It is possible to implement your own directives too. This is what AngularJS refers to as "teaching HTML new tricks".

Write less achieve more

The most likely thing is we can achieve our goal by writing less code. From the above features i have explained above it is understandable that there is no need of large amount of coding needed for data manipulations and reflecting changes with respective to models. We can easily write reusable things with the help of directives. We can implement the business logic, server communications and transfer data between controllers with services.The MVC pattern coding make our more app structured and it will help for write less.
The above features can be also seen in many forums and blogs which is explained very well. While reading those  things i felt every one are saying the same kind of  features and they might be writing after reading a base forums. But when i tried working on angularjs and experienced the extraordinary cool features and understood why they praise about these features. If you didn’t start coding on angular js, please taste it and you gonna love it.

Sincere thanks to Shibu Basheer our great CTO who allowed me to research on Angular JS
ENJOY CODING :)

Saturday 2 November 2013

Everyone knows who you are?


I don't know whether title matches with the writing in this post. Anyways I am just writing my idea about an app i would like to create. I have started working on that, don't know whether i can finish it or not, it’s just a try. Am damn sure i might get lost in the middle.

Like every youngster, one of my main hobbies is spending time with friends to see girls coming in the mall. If we get any stare from the girls in such a way that they giving signal "Dude.. i saw you were watching me ehh." and a sweet smile. It’s enough to walk behind that girl in that mall till she leaves. After she leaves we will think "I must ask her PHONE NUMBER. She might give, if she was interested in me.. I will try to find her in FACEBOOK and will send friend request.. blah blah blah..".
I don't know her name, where she is studying/working, without these data how am I gonna find her in FACEBOOK, how am i gonna send friend request to her. The only thing I have is her image in mind, that's useless and wasting my memory space.

Will i get any details of the data contained in the image from internet? Yes, Google has image search technology, but this doesn't work for face recognition correctly. It will be interesting if the Facebook team list the profile's which matches the image i have uploaded. For now there is nothing like that, they provide name search only.

In my office i got an opportunity to research about Augment Reality. While doing research on that, i found some videos of application Augment reality apps. Please see the bellow video




The above app shows that we can have social networking profiles after detecting the faces.

Think I am having this kind of app in my android phone and going to mall, and while shooting a face with my camera listing all profiles such as Facebook, Linkedin, Google plus near to that face, it will be nice. The app will be useful in other way also, just like the above video shows, very helpful in meetings and conferences. But is this possible? Can we create such an app which recognize the face and list the profiles in social networks? While seeing Pranav Mistry's video i felt it is really a silly thing. Check out the video, actually it explains about the Sixth Sense technology. In this video he specifies the idea of getting feeds from social network details of te man standing in front of you.

 
The video is really interesting right? So is it possible to have an app which will give profile list of social network after detecting the face?. Anyways i am gonna try for that.. :)

Monday 6 August 2012

Learning about most effective View in Android 'ListView'


Hello every one, in this post i would like to share about the most powerful view in our android that is ListView (i felt  this view is the most effective one in Android). ListView class which is capable of displaying a scrollable list of items. The items can be of any type.

We have lots of ways to set values into a ListView. Some ways that i learned are 
  1. Setting ListView with layout(view) provided by Android resources.
  2. Setting ListView with our own layout.
  3. Setting ListView with different images as item.

Now i am gonna explain each way one by one..

Setting ListView with layout provided by Android resources

Add Listview to main.xml

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <ListView
        android:id="@+id/listView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
    </ListView>

</LinearLayout>

Then create an array named 'values' in the corresponding acitvity and put some items in it. Create Listview object and initialize it with corresponding id. Then comes the magic thing ‘ArrayAdapter’
As we know Listview is a group of items, each item will contain a TextView. Now the job of  ArrayAdapter is to take each values from the array ‘values’ and sets the TextView with that value, then this TextView is set as an item for ListView. So the ArrayAdapter works or loops as the length of the array we used. On the initialization of ArrayAdapter what we want to do is, indicate which array we are using and  which TextView (or view) we want to use as item of ListView.

ListExample Activity for main.xml

public class ListExample extends Activity {
       ListView lv;
       String[] values;
       ArrayAdapter<String>myAdapter;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        init();
        lv.setAdapter(myAdapter);
    }
       public void init() {
              // TODO Auto-generated method stub
              lv=(ListView)findViewById(R.id.listView1);
              values=new String[]{"folder1","image1.png","text.txt","image2.png","folder2","text2.txt"};
              myAdapter=new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, values);
       }
}

Here we have used android.R.layout.simple_list_item_1. The simple_list_item_1 will contain a TextView. To see the content in simple_list_item_1 navigate to android-sdk-windows/platforms/android-(api level)/data/res/layout. Here we see a lots of xml file which provided by Android resources

simple_list_item_1.xml

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/text1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:gravity="center_vertical"
    android:paddingLeft="6dip"
    android:minHeight="?android:attr/listPreferredItemHeight"
/>

The output for the above code will be like this
That's all for this post. The next post will explain 'Setting Listview with our own layout'.

Thursday 2 August 2012

How to Promote your Android Application?

I had made more than 10 apps in Android, yet i have't uploaded anything to Google Play. My dream is the first app i upload should make a lots of hit. For this i searched and found a good feature about "Promotion Of Mobile Application", sharing it with you.


If you have successfully developed and launched your dream Mobile Application. What next?
How will people come to know about the mobile application you have developed with lot of efforts?
How will you make them aware that something useful that your company has developed is waiting for them?
There are billions of Mobile Apps floating in the app world. How are you going to make the actual users download yours?
The answer to all the above questions is Promotion and Marketing of your Mobile Application. But this is not every one’s cup of tea. It can be a backbreaking task for a Mobile Application Development Company or a novice who is not aware how to start and from where to start its marketing.
So, here goes the list on tips to promote your Mobile Application:

1. Create pre launch buzz – Create a buzz for your app before it gets launched. Post in social networking websites to create curiosity amongst the public. Tell users that how the App is useful for them and that why they should download them. You can create an attractive page stating “coming soon on the shop floor” and buzz it on LinkedIn, Facebook and Twitter.

2. “Free” word is always attractive – Believe me this word does miracles. To begin with, a mobile application development company can launch the lite version of Mobile app, so that users can download it for free and try it. And once you gain popularity launch the further versions as paid ones. If it’s a gaming app, then give them a chance to play free.

3. App Store, your good friend – Not to mention, the app store is the best place to showcase your mobile application. People often search in the app stores and on Google for the latest available applications. Try to make your mobile app unique by assigning it a unique name. If possible use your targeted keyword in the App name so that when people search, yours app appear first. This will surely affect your number of downloads.

4. Get your Mobile App reviewed – Mobile application review sites, according to marketing experts, are outstanding platforms to promote mobile apps. There are good numbers of app reviews sites available in Mobile world wherein you can submit your mobile app and get reviews for it. This not only updates the users about your app but also help them deciding whether or not to download it.

The next two points sometimes wont be helpful for you..

5. Spread it through Press Release – Market your mobile application using Press Release. These media Releases do wonders if you use them suitably. Slot in targeted keywords associated with your mobile app in the press release, so that the users as well as the crawlers find it easy to locate your app in the Mobile app world. Press releases give your app an immediate visibility by reaching targeted users and increasing its awareness amongst the users.

6. Email marketing, old but gold – As most of the people access their emails using mobile devices; you can easily promote your mobile app via e-mail marketing. Here your focus should be on providing useful and informative content to your customers. Gather a list of users from database available on various sites and shoot an email showcasing your mobile app screenshots, features and technical specifications.

So, how do you like the post. Of course there is lot more to jot down and I am in the process of writing them down. But it might take some time because i wanna put the best in front of you. In the meantime you can apply the above ones and i am sure they will prove helpful.