Showing posts from 2011

C# Polymorphic types conversion with Generics

Polymorphism has been interviewer's  delight for ages. I have been taking interviews for quite some time.  And ever since i started preparing question on C# Polymormism, I have been getting surprises. To prepare interview questions, I try writing code, verify it and and then twist the code snippet to make it "interview-able".
This blog is to highlight some of the surprises that i have got while preparing the questions.  The motive of this blog is to highlight tricky points to keep in mind while writing overloaded Functions with Generic parameter. To explain the concept, I'll start with this short code snippet and would like readers to predict the output without scrolling down to answer.

If you know the output and the reasoning behind it, then you may leave the rest of blog as you probably are better expert than rest of my audience.  And if you are still reading this line it means you are searching for the answer. You will definately get to know the answer, but befor…

A morning dream

My eyes were paining,
as I coded per requirements,
I shouted for it was crowded,
and he gifted me diamonds,

I kept on coding
and he kept on gifting,
Diamonds kept shining,
and it started rhyming,

and then a figure appeared
it said in my ears...
"it's not wise
to loose your eyes
for diamonds
for any requirements"

oh please,
one day i'll be rich
with AAA from Fitch
and S&P would die to rate me,
who you are to teach me,
do you love,
or do you hate me?

and there the dream broke,
was it a reality or was it a joke?

I would always be there

I never said, won't need help,
neither I said, you won't help,
its friendship that we share,
asking help is too rare,
I know before I need it,
you would always be there,
you would always be there.

our frindship may stale,
and those memories may ail
but am assured my pal,
you would be there
when rest may fail,

you talked like a bro,
with skills of a pro,
never get tired,
of teaching me to grow
i trust you and i know
before I need you my bro,
you would hared like a hare
as you would always be there,
you would always be there.

I promise before you ask for it,
...I would always be there,
I would always be there,

Data Binding in .net

I have been toying with data binding in .net for quite some time now. And ever since I started working and analyzing the binding support in .net f/w 2.0, I have always been eager to know:

What makes WPF data binding so great that Microsoft showcased it as the biggest driver for WPF and MVVM? Even though the data binding existed in .net framework 2.0, why didn't MS pushed for its use as it did for WPF?
The INotifyPropertyChanged interface was introduced in .net framework 2.0 and was fully supported by WinForm binding engine. However, most of my fellow developers are unaware of this fact. 
So the fundamental question that arise is why should one go for WPF if all we want is nice Data Binding support and it’s available in .net 2.0?
The answer to this question is, MS has introduced an all new Data Bindinding engine in WPF which fixes lots of bugs of WinForm data binding, has a much improved performance. And I think this is enough for any GUI developer to consider switching to WPF as being …

the last few walks...

I could have resisted but couldn't,
could have missed it but couldn't,
i had to travel this last few walks
so i decided to give it a shot

the french mystery
the italian history,
the tower of pisa,
the pop with Isaiah
the city of venice
and the 5 villages
were all to be seen
this turned me keen..

and now as i walk,
with memories of my talk
in italian and in french
of paris and its stench
of pisa and its chiesa
am pleased that i could make
these memories to take

as i walk this last few walks,
i have with me,
a lot to cheer,
nothing to fear,
something for my dad,
and myself for my mom.
i am going home,
oh yea I am going home.

MVVM explained again!

I just started to work on WPF after quite a long break (8 month). And I wanted to recap my WPF knowledge and use MVVM in a plugin like scenario.

Download from here...
(Download link:

I have prepared a very basic plugin like app which makes use of MVVM with Commands, DataBindings and DataTemplates.

The AnimalsLibrary is a Plugin base which is referenced by every plugin.

The OuterUserAnimals is a Plugin which creates a new animal type. It also defines its own way of displaying its animals using a data template.

The TestListBoxTemplate is our main app which displayes the standard animals and loads other animals from plugin dll.

For now you may finc the path od plugin dll hard coded so you would have to change that to match your needs (as per you save loaction of the zip).

This example shows how to create a ViewModel which can be bound to a view. How to create and load DataTemplates from a referenced Dll (animals lib). And how to creat…

Precompiled Or Inline Regular Expressions

Precompiled Or Inline Regular ExpressionsWhat to Do Consider using Precompiled Or Inline Regular Expressions in the scenarios where the same set of regular expressions are used quite often in the applications. Precompiled Regular Expressions can be created using RegexOptions.Compiled switch while defining the regular expression.Inline Regular Expressions can be created using Regex.CompileToAssembly method.Why Interpreted Regular Expressions have the least start-up time, but has performance issues at runtime. If the regular expression is used rarely in the application, use Interpreted Regular Expressions.Precompiled Regular Expressions take little more time at start-up, but gives better performance at runtime. Use Precompiled Regular Expressions for the regular expressions which are used most often in the application for better runtime performance. The precompiled regular expressions give 30 % better runtime performance then interpreted regular expressions.Inline Regular Expressions creat…

My blog is getting audience from all around the world... :)


A free roller coaster ride...

Sometimes low and sometimes high,
my life these days is on a roller coaster ride.
yes indeed, its a roller coaster ride.
some friends I had,
some of them were my guide,
some of whom i kept fighting with,
and some of whom I always abide,
some kept laughing at me,
some made me smile,
and some of them were dying
to see me die.
sometime low and some times high,
my life indeed,
is on a roller coaster ride.
So many promises I have made,
not to commit yet another mistake,
making mistakes is never missed,
the only mistake being kept aside,
sometime low and some times high,
my life these days is on a roller coaster ride.
the unluckiest day recently arrived,
that means the luckiest would soon arrive,
as i believe it's a roller coaster ride,
if it has a low, it must have a high,
I am enjoying my life
as its a free free free,
roller coaster ride.
sometimes low, sometimes high,
my life indeed,
is on a roller coaster ride.

WOW... Business with Maths included

Who said derivatives of class 12th were junk...
Read this discussion about Swaptions (option on Swaps) to know how traders talks in terms of bus-maths

Job description with a style

Requirements (and we mean it!)
Techie Cred: CS or similar degree so you can talk to our enginerds about Python, map reduce jobs, and naive Bayesian algorithms without a translator.Design Chops: While Yelp PMs hold technical degrees, we're also passionate about design and have either schooling or significant experience building beautiful sites or apps. You should, too. Passion about the Space: You love the world of social networking, local search and consumer websites.Non-Nerd Empathy: You're interested in FriendFeed, Twitter, etc. as much as the next nerd, but you also recognize that you're designing for a non-techie audience.A Conditional Love for Yelp: Like a BFF or a tee ball coach, you should love us but also be able to tell us what we're doing wrong. You'll need to be able to dish out the criticism here and take it, too.A Need for Speed: Daily release cycle? Bring it!
check out for details this Job Description on Stack Overflow.

( or follow this link…