Murtaza Fazal's Blog

Murtaza Fazal's Blog
Murtaza Fazal's Blog

Saturday, December 5, 2009

Tracing Recursive calls in Fibonacci Series


In mathematics, the Fibonacci numbers are the numbers in the following sequence:

0 , 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...


By definition, the first two Fibonacci numbers are 0 and 1, and each remaining number is the sum of the previous two. Some sources omit the initial 0, instead beginning the sequence with two 1s.

int F(int num)
{
      if ( num <=1)
           z = num;
     else
           z =  F(n-1) + F(n-2);
     return z;
}

In this function , if we pass n, it should return n+1th term , e.g passing 6 will return 8 so let suppose we pass 5 to the function F then in this case, it will call the function for 5. It will test either if num (which is 5 at the moment) is with <= 1? NO, hence it will move to the else part where it will call the function F again for 2 new values and their final sum will be restored in z. so the equation will become like this

z = F(4) + F(3);

Now we’ll use the first come first bases rule and go and evaluate F(4) then F(3) . Hence F(4) will be called exactly as F(5) was called, it will again test for <=1 which is NO again and then it will call again the 2 recursive functions for F(4) i.e

z = F(3) + F(2);

This can be better explained in terms of a TREE






The bold objects are the values returned by the if clause of the function F. Blue color numbers are the one being returned to the previous state from the stack.

Wednesday, November 18, 2009

I Tried To Find Myself

I tried to find myself
I tried to burn myself
I left everything which was important to me
was it my family, friends or enemy

Every second I could feel the pain
you won't understand what I could gain
I wanted to burn myself
I wanted to find myself

But now I do miss all the good times
all the laughs and all the smiles
I know I'll get all of you back
but I won't b able to find myself after that

Today I don't feel any hesitations to cry out loud
I’m just leaving myself dead tonight
u won't find the same person ever
the one who wanted to know himself is lost forever

You won't see me sad again
do not think I’m insane
I just lost someone who was dear to me
it wasn't u but it was me

I wish I knew the end
I could have always pretend
that I never felt offend
as u r my best-friend

Friday, October 23, 2009

Windows 7/ Windows Server 2008 R2 / Exchange Server 2010 Sneak Peek

Windows 7 was released for retail distribution earlier today. The launch event started at around 9 a.m. at Sheraton Hotel, Karachi. The event witnessed presence of not only leading IT personals but also corporate guests from Telecom and Banking Industry. The chairperson HEC was also part of the event. The best part of event was the separate corner for bloggers with online laptops to blog and tweet the event live as it happened.




Find below, a pictorial peek of the event.








Wednesday, October 14, 2009

When You Love Someone - Bryan Adams

When you love someone - youll do anything

Youll do all the crazy things that you cant explain
Youll shoot the moon - put out the sun
When you love someone

Youll deny the truth - believe a lie
Therell be times that youll believe you can really fly
But your lonely nights - have just begun
When you love someone

When you love someone - youll feel it deep inside
And nothin else can ever change your mind
When you want someone - when you need someone
When you love someone...

When you love someone - youll sacrifice
Youd give it everything you got and you wont think twice
Youd risk it all - no matter what may come
When you love someone
Youll shoot the moon - put out the sun
When you love someone

Sunday, September 27, 2009

Naney Asghar (A.S)

Naney sey bachey na bhi ek misaal kayam kardi
hussain(A.S) key maqsad main jaan bhar di
na bol paya kuch bhi nanna Asghar (A.S)
kam sini mein he hujat tamaam kardi

Aya tha pani ki talab mein
theen roz jo ho gay they pani ko band howey
khush galey mein jo zabaah ko helaya
teer na bachey ko shahadat ka maqam per pouchaya

Tuesday, September 22, 2009

FACEBOOK LITE


With the immense use of facebook and everyday a new application is being developed. Facebook developers showed their concern about people who are not able to use facebook due to their slow connections. They have introduced a newer version of facebook framework as Facebook Lite.
Its fast, true me!!! It stripes down all the stuff like runtime searching capabilities and gives the user with the simplest and easiest form of interface. It emphasizes with the use of the 4 facebook features i.e wall, photo and video, friends and info.

If u got slow connection, try ‘lite.facebook.com’ rather than the regular one


Tuesday, September 1, 2009

Nullable Type in Visual Studio 2005+

Many of us learn programming through books or in some programming course. They course starts with simple data types and ends with a good looking application but one thing most of the books or instructors forget that the first and farmost requirement of a good looking application is to have good backend programming as well. I’ve being working on C# since a long time but I never came across this Nullable type in any of the books for beginners or Professionals and to me it seemed as one of the basic knowledge that was missing.

What does Nullable do? So far when we write a small piece of code, like for instance we are taking bio-data from the user in a console based application and if he presses enter without typing anything i.e. entered nothing in that field, what would happen? And what should have happened? The user pressed enter which means it should be a null field whereas a character 13 (ASCII CODE) is saved in its place. Is that the correct thing? Definitely not, and to overcome this state most of the books teaches us to use conditions that if its equal to 13 then ignore it or do something.

In Framework 2.0 and onwards, Microsoft has provided us with Nullable type through which we can allow null values in our simple datatypes. Nullable types represent value-type variables that can be assigned the value of null. You cannot create a nullable type based on a reference type. (Reference types already support the null value.)

Nullable < T >   variable;

Here T is a value type. The two forms are interchangeable. As in our example, we can use following code:

Nullable < string >  name = null;

Or what if we want to have a 3 state Boolean variable? True, False and Null? Thanks to Nullable type we can implement this within seconds by declaring our boolean variable under nullable type

Nullable < bool >  flag;

Microsoft added this feature but what’s the use of it?  Why to add another state even if we could do it through some conditions? With the use of Nullable, we can have the normal range of values of the underlying value type with additional of null value. Two fundamental members of the Nullable structure are “HasValue” and “Value” properties. If the HasValue property for a Nullable(T) object is true, the value of the object can be accessed with the Value property. If the HasValue property is false, the value of the object is undefined and an attempt to access the Value property throws an InvalidOperationException. The Nullable class supports obtaining the underlying type of a nullable type, and comparison and equality operations on pairs of nullable types whose underlying value type does not support generic comparison and equality operations.

Tuesday, August 4, 2009

It Was Never 'Us' It Was Always You And Me

It Was Never 'Us' It Was Always You And Me


I cannot say when was this second
I have no idea but it just happened
Suddenly my life was full of action
You just changed my life's passion

I cannot forget all the moments
Being with you and smelling your fragrance
Gettin stuck at things and asking for your guidance
Making you my only preference

Dunno from where i got the courage
To propose you and ask you for marriage
But i find there was some shortage
Or was i expecting too much privilege

With every wind that blew , i felt dat i mite lose you
But there isn't anything left to argue
It was just me who had no clue
It was me who just had this flue

It was never us it was always you and me
Why did i react so bluntly?
Now at this stage i do agree
That it was never us it was always you and me

I wish i could make you understand how important you are for me
Things weren't straight but i tried to be
I wish i could tell you how badly it hurts me
I wish these tears were worthy

Dunno i should be happy or sad
But i have one thing to be glad
atleast you considered me your friend
I still hav some time with you to spend

Today i lost my destiny
I wanted you so badly
But now i come to a conclusion
Was it just a confusion?

I mite get you or i may not
But i will always have this thought
That i wasn't the one you liked
That i wasn't the one you liked

I will always luv you as i did
Even if you forbid
I loved you truely and will always do
Even if you have no clue

I may not b able to complete this poem today
But my luv was complete the day i saw you
I cannot forget those days
But it was never us,it was always you and me


~~Murtaza Fazal~~
wrote this a year back

Sunday, July 12, 2009

The Pain of Life

The Pain of Life

The pain of life will never end
its just the beginning my friend
everyday a new sorrow will hunt u down
doesn’t matter how much u frown

Friends, foes or even the dear ones
won’t be there, unless it’s for some fun
you need to bear all the pains of life
its like killing yourself with your own knife

Running in the life’s race
we might forget for what was this chase?
Trying to avoid the disgrace
we don’t even bother to face

Winning is not the only end
At times you have to lose it for a friend
they won’t get how important they are
how painful it was for you to go so far

The pain of life will never end
its just the beginning my friend
everyday a new sorrow will hunt u down
doesn’t matter how much u frown