Month: January 2013

Introduction Of SEO : Part 1

Search engine optimization is collection of technique that allow your site to get more traffic  from search engine like Google, Microsoft Bing etc. SEO can be divided in to two main categories

  • On Page SEO (Website changes that makes on your site)
  • Off Page SEO (Works that takes place out of your site).

In this tutorial we will discuss brief about these method’s,

On Page SEO –

                On page SEO means the work take place on your web site which help’ s to get more traffic on your site from search engine.  On page SEO divided in following areas

  1. Title Tag – The most important part of your web page is title tag (<title></title>) because search engine crawl web sites day and night for taking the information and categories them so user can easily get what they are find or want. So make your title as clear as they have topic’s, so search engine clearly distinguish your pages from others.
  2. Header & Bold Tag – In web development generally HTML developer so many CSS for formatting topics of each page. It’s bad because while search engine crawl websites they simply ignore all CSS tags like <span> and etc.  instead of this use header tag i.e. <h1> to <h6> to  set topics of each page, while important topics put in to bold for user notifications.
  3. Keywords – While doing SEO for your site you must know which keyword or terms  you want to target. The SEO  keyword for site is divided in to three categories,
  • Specific keywords  e.g. – Black color shoes  etc.
  • Broad keywords e.g. – shoes, sports etc.
  • unique keywords  e.g. – unique identity of your site.

Off Page SEO –

                 Off page SEO is work that makes out of your site. The off page work is divided in following area

  1. Anchor Tag – Simply getting link from any other website or put your web site link on others web site is not enough to rank well in search engine but it’s depend on quality of your anchor text.
  2. Targeting Competitor – When you search for your competitor’s website, you will find out the most authoritative sites that mention your competitor. Visit these sites and try to get a link from those site’s. If  it is a review site, it may be as easy as sending a free product for review. If it is a forum or wiki, it may be just as easy as adding your link.

Don’t do this all at once, Make a note all of the sites you would like to get a link from, and slowly,  slowly acquire links from them. There is no set time period.

Consuming Webservices & Parsing JSON Response Tutorial :Part 1

Hi Folks ,

Today, I want to make a demonstration of fetching data from web servers by using NSURLConnection on objective-c platform.

What we are going to do?

We are going to create an application that will demonstrate you guys to make a GET  request with NSURLConnection. After that, the retrieved data will be shown in UiTableview .It would be basically my favorite Artist name and his image .

For this tutorial i am going to consume one WCF web service ,thanks to one of my colleague to helping me 🙂


Retrieved Data would be JSON format shown as below:


Now first of all create a new project on Xcode as a single view application. You may use any other of them however the project that I have started with was single view application.

Put UiTableView onto a xib, and make the bindings related to the view controller’s header file.

Open your view controller’s header class. In my example it is called “ViewController.h” and modify it as like as below.

import <UIKit/UIKit.h>

@interface ViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>


NSMutableData *receivedData;


@property (nonatomic, assign) IBOutlet UITableView *myTableView;



What we have done in here, we have created UITableView, and 1 NSMutableData object. One of the most important thing in here is that our view controller has implemented NSURLConnectionDataDelegate. Whenever our connection object start to fetching from a web page, if the delegate of our connection object is set to this view controller, it will call delegate methods to warn our view controller about the state of connection. Now let’s make some coding over view controller’s .m file.

First of all, I would like to implement the connectWebServiceSync method. Whenever  application will enter in ViewWillAppear Mode  it will call connectWebServiceSync method.

connectWebServiceSync  simply create NSURLConnection request and execute it.

Modify your .m as shown below



//call webservice here

[self connectWebserviceSync];




// Create the request.

NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@””%5D



// create the connection with the request

// and start loading the data

NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

if (theConnection) {

// Create the NSMutableData to hold the received data.

// receivedData is an instance variable declared elsewhere.

receivedData = [[NSMutableData data] retain];

} else {

// Inform the user that the connection failed.

NSLog(@”connection failed”);



Here I create url, and afterwards a request with respect to instance of url. These are the same procedures for every requests

The tricky part , the delegation, comes into play at this time. The folks at Apple has created a simple way to deal with the states of connection by using delegation structure.There are actually lots of delegate methods in NSURLConnectionDataDelegate however, just only 3 of them is required to be implemented in class. Those are;

this method might be calling more than one times according to incoming data size

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{
[receivedData appendData:data];
if there is an error occured, this method will be called by connection
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{
NSLog(@”%@” , error);
if data is successfully received, this method will be called by connection
-(void)connectionDidFinishLoading:(NSURLConnection *)connection{
 NSString *responseString = [[[NSString alloc] initWithData:receivedData encoding:NSUTF8StringEncoding] autorelease];   NSLog(@”Succeeded! Received JSON String %@ “,responseString);
// release the connection, and the data object

    [connection release];

[receivedData release];


-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data this method is called more than ones if the data returned by server is huge. NSURLConnection is clever enough how to split and whenever it gets any kind of data it calls this method from bound delegate class.

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error this method is called if something is abnormally going on during the connection.

-(void)connectionDidFinishLoading:(NSURLConnection *)connection this method is called when connection finishes its job successfully. All the actions after fetching data from server can be done here. In our example, we have filled our data into our object “receivedData”. Now that, we can  convert our data into string with UTF8 encoding, and then can store it somewhere or Log it.

For this tutorial i just used NSLog to print json response.If you are implementing above code hit run and look into your console for output.


What to do next?

We have Raw JSON string as a we have to parse that raw JSON response and populate data over UITableView view

to be continued…..


Hi Folks,

Hopes you are enjoying your weekend…

This is another tutorial related to UITableView,previously we have learned

1.Creating and using Simple tableView and populated data.

2. Creating UITableView using xib.

You can check Part 1 here and Part 2 here.

Some time you need to Edit your table view according to app .Let’s say you are dealing with some Music Player App, user must be able to delete songs from the list and thus UITableView requires Editing of Cells.

If you’re presenting data to your users in a tableView, it is very likely you would want to add & remove rows from the table. In order to do this, UITableViews have a BOOL property called isEditing, which you can use to enter & exit edit mode.

Edit Mode on a UITableView is configured through the

– (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath*)indexPath


– (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath

Swipe-to-delete will be enabled by default if a tableView can be edited.

methods of the UITableView DataSource Protocol.Add these two method to part 2 tutorial source code.

Enabling Edit Mode

Return YES for all IndexPath Sections / Rows you want Edit Mode enabled for.

– (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath*)indexPath


// Return YES



Configuring Edit Mode – The TableView:

The following code will affect how  existing ones deleted.

– (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath


if (editingStyle == UITableViewCellEditingStyleDelete) {

// Delete the row from the data source

[items removeObjectAtIndex:indexPath.row];

//reload Table view

[tableView reloadData];


Now hit run and swipe to delete the cell

Screen Shot 2013-01-27 at 3.10.01 PM

Screen Shot 2013-01-27 at 3.10.22 PMDone…Enjoy coding.. stay tune for more tutorial

UITableView Tutorial Part 2: Customizing Table View

Hi Folks,

Hope you have enjoyed my previous tutorial if not ,go and explore it here

This second part of UITableView tutorial is all about customizing Table View  using xib.Creating your own tableview cell could be such a hassle when you do it programmatically. To be able to follow this tutorial, you need to know how to add a tableview first. Refer to the previous tutorial on how to add a tableview if you still don’t know how to add it yet.

Let’s start!

1. Add a new file of subclass UITableViewCell.


2. After adding a new UITableViewCell class, only .h and .m files are created. So, let’s add another file, an empty Interface Builder Document (xib file). Name it with the same name with our .h and .m files (to avoid confusion).

choose templates

3. Drag a tableview cell to your xib file, and change its class to SampleTableCell (the one we added a while ago).


4. Start customizing your cell. Here in my example, I want to make a Top Artist Cell (One with profile pictures, & name)

    1. I changed the height of my cell to 90 (instead of the default cell height which is 44).
    2.  I added a UIImageView for the profile pictures.
    3. Added a UILabel for the name.

5. Make an IBOutlet property of the objects that might change dynamically. In our example, our profilePicture object may change dynamically, depends on who is on Top Artist Chart.  And remember to synthesize these objects.
//Inside .h file

@property (nonatomic, assign) IBOutlet UIImageView *picture;
@property (nonatomic, assign) IBOutlet UILabel *name;

//Inside .m file

@synthesize picture;
@synthesize name;
6. Connect these outlets to your objects in your xib file.

7. Create a new File, subclass of NSObject. This file will serve as our “Artist” object. This class must hold the important information we need, like the profilePicture filename, Name.
//Artist.h file

@interface Artist : NSObject
@property (nonatomic, strong) NSString *artistName;
@property (nonatomic, strong) NSString *imageName;
//Artist.m file
@implementation User
@synthesize artistName;
@synthesize imageName;

8. Create your Artist objects and put them all in your items Array.
//I created five Artist. Sample code…

    Artist *artist1 = [[Artist alloc] init];

//Put them all in our array list
items = [[NSArray alloc] initWithObjects: artist1, artist2, artist3, artist4, artist5, nil];
9. Before we proceed, change the cell’s Identifier . We need it later.One more thing add some Artist images in project

cell identifier

Remember the Datasource and Delegate methods of our tableView from the previous tutorial? We are going to modify/add some methods.

10. Remember that our customized cell’s height was changed to 90, right? It has become taller than the usual height of our tableViewCell. Add this method so that our tableView will know that the cell’s height was changed.
//If we did not change the height of our cell, we do not need to add this method.

– (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 90.0;

11. Lastly, modify this method cellForRow. This is the part where we tell the tableView that we will use our custom cell.

– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifier = @”ArtistCell”;
    SampleTableCell *cell = (SampleTableCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        NSArray* topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@”SampleTableCell” owner:self options:nil];
        for (id currentObject in topLevelObjects) {
            if ([currentObject isKindOfClass:[UITableViewCell class]]) {
                cell = (SampleTableCell *)currentObject;
    // Configure the cell.

    Artist *artist = [items objectAtIndex:indexPath.row];

cell.picture.image= [UIImage imageNamed:artist.imageName]; = artist.artistName;

cell.selectionStyle = UITableViewCellSelectionStyleNone;

return cell;


12. Hit Run! check output as shown below

Runenjoy coding….stay tune

UITableView Tutorial Part 1: Introduction to iPhone TableView

Hi fellas

This 3 Part of UITableView Tutorial will take you that level where you can able to deal with creating,customizing, modifying ,Binding data and much more to the iPhone TableView.

So Let’s start..

Table view is commonly used to show lists of data. A table view is the view object that displays table’s data and instance of UITableView. Each visible row in a table view is implemented by UITableViewCell. Table views are not responsible for storing your table’s data. They store only enough data to draw the rows that are currently visible. Table views get their configuration data from an object that conforms to the UITableViewDelegate protocol and their row data from an object that conforms to the UITableViewDataSource protocol.

Follow the steps below to create UITableView sample:

1.Open Xcode and create new view based project named ‘MyTable’

2.Modify code in the MyFirstTableViewController.h file as follow:


#import <UIKit/UIKit.h>

@interface MyFirstTableViewController : UIViewController


NSArray *listData;


@property(nonatomic, retain) NSArray *listData;


3.Open MyFirstTableViewController.xib file and drag Table View from Library over to the View Window.

4.Connect tableview’s dataSource and delegate from connection inspector to File’s Owner.

5.Modify code in the MyFirstTableViewController.m file as follow:


#import “MyFirstTableViewController.h”

@implementation MyFirstTableViewController

@synthesize listData;

– (void)viewDidLoad {

NSArray *array = [[NSArray alloc] initWithObjects:@”iPhone”, @”iPod”,


self.listData = array;

[array release];

[super viewDidLoad];


– (void)dealloc {

[listData dealloc];

[super dealloc];


#pragma mark –

#pragma mark Table View Data Source Methods

– (NSInteger)tableView:(UITableView *)tableView



return [self.listData count];


– (UITableViewCell *)tableView:(UITableView *)tableView

cellForRowAtIndexPath:(NSIndexPath *)indexPath


static NSString *SimpleTableIdentifier = @”SimpleTableIdentifier”;

UITableViewCell *cell = [tableView


if (cell == nil) {

cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault

reuseIdentifier:SimpleTableIdentifier] autorelease];


NSUInteger row = [indexPath row];

cell.textLabel.text = [listData objectAtIndex:row];

return cell;



In viewDidLoad we are creating an array of data to pass to our Table View.
We have also added two more methods of data source delegate which are mandatory to implement when your implementing UITableViewDataSource delegate.


(NSInteger)tableView:(UITableView *)tableView


which specifies how many number of rows are there in one section of the Table View.
The default number  of section in Table View is one.

Another method is


  – (UITableViewCell *)tableView:(UITableView *)tableView

cellForRowAtIndexPath:(NSIndexPath *)indexPath

Which is called by table view when it needs to draw a row. This method is called n times and value of n is equal to value returned by first method. As this method is called once for every row,


if (cell == nil)

checks, if cell exits before, if not create new cell. Here ‘indexPath’ parameter gives us current Indexpath of the row from which we can get the current drawing row. Then we set the text of textLabel property of the current drawing cell and finally return the cell to the Table View.


Output will look like this: