December 29, 2008

http://weblogs.asp.net/mhawley/archive/2004/05/11/129824.aspx

http://weblogs.asp.net/mhawley/archive/2004/05/11/129824.aspx

Productivity Tips

As we are moving to a new year, we tend to look for productivity tips which help to improve our productivity. But how many people actually keep continuing? Well, it’s easy to start but hard to continue. I have tried different kind of GTD (Getting things done).

There are plenty of ways where you can manage your Things to do list. A good start would be GTD. But for me I would like to keep things simple. Some of the simple but effective productivity tips which may help you in new year :

· Maintain a simple todo list ( Gmail Tasks)

· Break tasks into small workable items.

· If a task takes 2 min to complete, do it at the same time and do not procrastinating

· Have a weekly review and clear up all the tasks.

Even If its sound so simple, it’s hard to continue. Good luck and have a productive new year!!

Some useful readings :

http://www.lifeoptimizer.org/2007/05/09/top-5-productivity-tips-most-people-know-but-do-not-do/

http://www.davidco.com/

December 23, 2008

Merry X'mas and Happy New year

Well, its been a hectic past two months but slowly settling down. Due to the fact that me and my wife was struggling to settle down in a foreign country and its harder than we initially thought. Hopefully things will settle down in a few weeks, if not in months :-) . I wish all of you a wonderful and prosperous new year 2009 and Merry Christmas.

November 26, 2008

ASP.NET Charts

Recently I've worked with some cool charts for a dashboard project. Dundas and Fusion charts are the best I've seen so far. But guess what, Microsoft has released a FREE chart control for ASP.NET 3.5 I which has similir look and feel to Dundas charts ;-) Havn't tried it yet but I'm excited, mostly becoz its FREE... :-)

August 27, 2008

Generic List removing duplicates

static List removeDuplicates(List inputList)
{
Dictionary uniqueStore = new Dictionary();
List finalList = new List();

foreach (string currValue in inputList)
{
if (!uniqueStore.ContainsKey(currValue))
{
uniqueStore.Add(currValue, 0);
finalList.Add(currValue);
}
}
return finalList;

}


July 4, 2008

Url Rewriting in IIS 7

One thing I like in IIS 7 is the way it supports Url rewriting. Earlier versions of IIS (6,5) does not support ASP.NET HttpModules for urls without a file extenstion. i.e. http://localhost/Products. Even if its doesn't we can hackaround and use it with IIS Error pages.

When there is no file extension in the url, IIS directly processing it with its own ISAPI filter rather than processing it through the ASP.NET handler. But with IIS 7, all we have to do is to add the HttpModule into the IIS web app. All the requests are process through the HttpModule. So if we request http://localhost/Products, it will go through the HttpModule, which we can easily integrate our url rewriting.

June 6, 2008

Coding Styles

Recently our team prepared a coding guideline document to follow in our day to day coding. As always it leads to loads of debates, things like variable naming, method naming and so forth. What I personally like is to keep things very simple. i.e. string name vs string strName, I prefer string name. Consistency in coding is very important, what it mean is we have to follow the same coding style until the project end. Have look at Microsoft's StyleCop

March 26, 2008

OpenSocial

Google's common API for Social Web Sites. With standard JavaScript and HTML, developers can create apps that access a social network's friends and update feeds. Read More >>

February 19, 2008

ASP.NET Futures

I downloaded and installed ASP.NET futures. Got some very useful controls with that. Check out the History control. Ajax update panel has a problem with the browser back/forward buttons. History control solves that problem by adding entry points to the control, and retrieve it back.

download futures : http://www.asp.net/downloads/futures/

January 10, 2008

.Net 3.5 Extensions Part 2

In my previous post I have talk about "what is a method extension" and "how we can use that in our development". Let’s move into more detail.

Extension has change the way we design our applications. With previous versions of .net, which didn’t supports features like multiple inheritances, but with extensions we can design our applications to meet all those functionality. So here what I’m going to show is how we can program to interfaces using method extensions.

To start with we will take simple interface class scenario. We use interface to implement multiple features to a given class. Below is example of implementing multiple inheritances on a single class using interfaces.

public interface IFlyable {

void Fly();

}

Public interface IRunnable {

void Run();

}

Public interface ISwimming {

Void Swim();

Void BreatheInWater();

}

Public class Bird: IFlyable, IRunnable, ISwimming {

Public class Animal() {

}

Public void Fly() {

//Implement flying logic

}

Public void Run() {

//Implement Running Logic

}

Public void Swim() {

//Implement Swim Logic

}

Public void BreatheInWater() {

//Implement Breathe in water logic

}

}

What if there is a another class which needs to implement the same Swim logic in ISwimming, infact lets say all the classes which implement ISwimming has the same swim logic, but BreatheInWater logic is differs. How do we achieve this?

Public class Fish: ISwimming {

Public void Swim() {

//Implement same swim logic

}

Public void BreatheInWater() {

//Implement different Breathe in water logic

}

}

We could achieve this using some of the design patterns, but here I just wanted to show how easily we can do this using method extensions. Since Swim has the same logic in every class we can see as it’s a perfect method to use as an extensions. So we can implement the Swim logic in one place. To do that we need to remove the Swim method from ISwimming interface and place that in out method extension class as below.

public static void Swim(this ISwimming swim) {

//Implment the same swim logic

}

Note that we have this keyword before the ISwimming interface. This tells the compiler that ISwimming type has Swim method extension. So after implement the method extensions for the ISwimming interface we could modify the code as below.

public interface IFlyable {

void Fly();

}

Public interface IRunnable {

void Run();

}

Public interface ISwimming {

Void BreatheInWater();

}

Public class Bird: IFlyable, IRunnable, ISwimming {

Public class Animal() {

}

Public void Fly() {

//Implement flying logic

}

Public void Run() {

//Implement Running Logic

}

Public void BreatheInWater() {

//Implement Breathe in water logic

}

}

Public class Fish: ISwimming {

Public void BreatheInWater() {

//Implement different Breathe in water logic

}

}

Please note that we have removed the Swim method from the interface as well as from all the implementation classes. We only wrote the Swim method in our extensions class. This makes our code cleaner and easier to write. So when ever we create an object which implements ISwimming interface we get Swim method as an extension.






So here I covered how we can easily use Method extensions in our interfaces. Hope this helps!