Saturday, July 18, 2009

One Year of "A Beautiful Day"

My journey with Silverlight started about 1 year before I started this blog. My first "Professional Program" was in Silverlight and after that I went deep into other parts of web development forgetting Silverlight for a while. With Silverlight 2 beta, I again started looking at Silverlight and I started "Loving it".

In the Journey I have meet many people smarter than I and tried to learn from them. I meet many people who has become my good friends.

What I always lacking was "Design mind set". When I meet Ramya I found she got the exact part that I am missing to make a good application. You already have seen her making a simple but elegant animation example.

Here are some statistics of the blog through one year... (I use Google analytics for this blog)











Thanks all for encouraging to continue this blog and I hope we will enjoy the future journey with Silerlight even more...

Tuesday, July 14, 2009

How Hard Is It To Get Somebody Install Silverlight

Let me share a small conversation to my friend Melissa that just Happened. She is 100% non technical (Never heard of Silverlight) and just bought a new PC. Here is how I convince her to install Silverlight to her PC......


tanmoy says: hey
tanmoy says: did u install silverlight in ur computer
melissa says: ?
melissa says: no
tanmoy says: then do it.
tanmoy says: i m giving u the link
tanmoy says: http://www.microsoft.com/silverlight/
tanmoy says: it will ask u to install it
melissa says: I'm not downloading it
tanmoy says: y not. its from Microsoft so u can be sure its safe
melissa says: I don't need it
tanmoy says: u need it
melissa says: Why do I need it
tanmoy says: there are lots of site using silverlight
melissa says: So
tanmoy says: so if u install it u can see those sites, play games
tanmoy says: listen to music ,watch videos and all
melissa says: I can do all of that without it
tanmoy says: but its something I am working on
melissa says: Yeah
melissa says: Then its not that good to have lol
tanmoy says: yes it is
melissa says: No it's not lol
tanmoy says: why dont u do it....
melissa says: Why should I do it
tanmoy says: cause it only take 1 min to be done
melissa says: I just don't want ten million of things downloaded on this computer
tanmoy says: and it doesnt slow down ur comp
tanmoy says: its not that
tanmoy says: its very small thing. around 4 MB only
melissa says: k
melissa says: lol
melissa says: Fine ill do it

Finally.....
So now I do understand why people says might be as much as 40% of uses go away from a site that needs Silverlight without installing it.

BTW according to RIA Statistics Silverlight has gained around 30% of user base already. Impressive ha !

Monday, July 13, 2009

Understanding Animation

From childhood we all are fascinated by one thing- movement of static objects or Animation. I feel the best part in Silverlight is its ability to animate things and fascinate its users. Animation always doesn't mean make a man run or breaking a table. Simple page transitions in a site or changes in the button when you hover over it , also comes under animation. So lets see how beautiful this animation can be. First we will animate a simple ball (an ellipse in technical terms!) using blend and then in the next part we will do the same animation from the code behind. So lets begin with it.

First rule in animation which I follow is to picturize it in your mind. So here is the picturization:
Lets think of a ball moving and falling in to a basket.

Here is the application in action





  1. For the representation of the ball we would need something that looks like a ball. The closest would be an ellipse.


  2. Now, think of the movement of the ball. The ball should bounce and roll over.So we would have to create a ground for it and keep this in mind. for the ground we can think of rectangle with a skew.


  3. Next, we would have to think about the basket where we would be putting the ball. That can be again 2 ellipses with a skew(i mean a twisted ellipse). To give it an actual basket's feel we will take three such ellipses.


We would add few paths to make it look like a net.We have completed our picturization and now that it really looks like a basket ball court, let's begin with the animation!


We can create storyboard and give timelines to it, so as to achive the movement of the ball.Here I have given the ball only two types of transformation i.e rotate transform and translate transform.

Rotate transfrom would give the ball its rolling over kind of effect, whereas, translate transform(TranslateTransform.Y, TranslateTransform.X) would give it the up and down motion or translation in x and y directions.To adjust the timeline, you just have the drag the white point! It is so easy!! Let us see the final animation!


Here is the complete source code for it.


In the next post you will see this animation done entirely in code.So keep watching this space!

Wednesday, July 1, 2009

Some of the books in my collection

Most of the things I know are from internet blogs and community and from practical experience of me or other people.

Still I like reading books and for in depth knowledge it is something you can not skip. Here I am sharing some of the books I have (I am reading them too) and some of the books I wants to buy soon.

I have already

1. Code Complete 2nd Edition.
2. Joel on Software.
3. More Joel on Software.
4. LINQ in action
5. Silverlight 2 in action.
6. C# 3.0 in a Nutshell.
7. C# in depth.
8. CLR via C#
9. JavaScript the good parts.


I want to buy

1. Mastering Regular Expression.
2. The Pragmatic Programmer.
3. JQuery in Action.
4. Data Driven Services with Silverlight 2.
5. Dont make me think.

I have already read some parts of Code Complete, Mastering Regular Expression from library and I can tell you these two books are great.

As you might seen I only have one book on Silverlight. I could not start this book yet. I will let you know more about the books when I finish them.

Please share your favorite books too.

Wednesday, June 24, 2009

Silverlight and LINQ

I got a thread in Silverlight forum that asks how to select a row in a DataGrid?

Now here is the ans using a simple LINQ query.

MyClass item = MyDataGrid.ItemsSource.Cast().Where((_, pos) => pos == row_number).SingleOrDefault();

Now we have the data grid named MyDataGrid and we have already populated it with a collection of MyClass. We are using extension methods of C# 3.0 to help us select a row where row number is known.

In the lambda expression

(_, pos) => pos == row_number

we do not care about the first parameter so I have replaced it with '_'. (Remember '_' is a valid C# identifier).

LINQ has a great power to make your code compact and less error prone. Still I see many people using lengthy (Wrong?) way of doing simple things like selecting from a list where the list value satisfy a certain condition. Many people still things LINQ as an Syntactic Sugar of SQL queries. You can obviously use LINQ to SQL for interacting with database but LINQ is not only that.

LINQ comes in handy while parsing XML too.

Other benefits are like Sorting, advance selection and searching.

Tuesday, May 12, 2009

Silverlight kid is here.......

Hi All,
I was never interested in coding but the moment my mentor Mr. Deepak Sharma asked me to learn silverlight, I fell in love with it. The first thing which I ever made in my life was a christmas card in silverlight 1.0, and fortunately everybody liked it. From then onwards there was no looking back.I continued to experiment with it. Silverlight has cast a spell on me and Tanmoy has always increased my interest in it .And now when Tanmoy asked me to contribute in this blog, I was thrilled.I would try to keep this spirit of silverlight alive in me and would try to enlighten others with the knowledge I acquire in this journey.
Thanks to Tanmoy!

Introducing Ramya...Another Silverlight Geek

Hi,
to make this blog more effective I requested Ramya to join this blog. She has started her programming career with Silverlight and proved excellence in a very short time. Its a great thing that from now we two will be reviewing our posts and can keep posting while the other one is busy. It will increase the quality and number of posts.

Silverlight rocks as she does.

Lets welcome her....

~Tanmoy