Load your Visual Studio IDE faster

This might be a very small trick for all us and some of us may already know this. But who doesn’t know, they can save enough time while working with Visual Studio IDE.

As we used to spend a lot of time in our office/workstation while working with IDE. Normally we are also connected with the Internet. Whenever we install Vistual Studio to our system, then by default, when we open the IDE,  following screen is loaded.

Default As we can see, it includes some news section(marked in Red) that gets download via internet and some other stuff, like Recent Projects. Normally, only stuff that we use Recent Projects. Rest suff are some news that gets loaded online. Which normally makes the loding of IDE very slower, and even sometime after clicking on VS icon we have to wait for a while.

So we can change this behavior as most of the time, we don’t go through these in our daily life. Normally we used to open the IDE several times in a day during our normal cycle Home – Office – Home.

So for changing this behaviour, we have to go Tools->Options, then we’ll see the following screen,

Step 1Now check the checkbox “Show all Settings“, if not checked. Then go to Environment->startup and we’ll see the following screen.

 

 

Step 2Now from the first dropdown , we can select the option Show empty enviornment and unselect the Download content every checkbox.

Here we have several other options which we can configure based on our requirement, but above one is faster.

Now our IDE will open as

UpadtedIt may not look very colorful but Now you’ll feel the Visual Studio IDE loading much faster. Which saves your time and make you feel good.

 

 

 

Note: I have Visual Studio 2008 for the blog post purpose, we can do the same with Visual Studio 2005 also.

So enjoy your Visual Studio!!!

Happy Coding,

Brij

Concurrent Collections with .NET4.0

Earlier we used Collections, they were never ThreadSafe. Generics introduced in .NET 2.0 are TypeSafe but not ThreadSafe.

Generics are Typesafe means whenever you are going to declare any generic type, you need to specify the type that is going to be held by the List. And whenever you are going to retrieve any item from list you will get the actual type item, not an Object like we get from Arraylist.

But Generics are not ThredSafe, it’s a programmer’s responsibility. Means let’s say if you have an list collecting some objects. That list is shared amongst several threads, the it may work hazardous if two threads try to access the List at the same point of time, like adding/removing/iterating  items from the same list at the same time.

Thread safety can be implemented with the help of locking the collection and other similar ways. But locking the entire list for the sake of adding/removing an item could be a big performance hit for an application based on the circumstances.

.NET 4.0 provides new classes for the concurrency as Concurrent collections. These are

  • ConcurrentDictionary< Key , Value> Thread safe dictionary in key value pairs.
  • ConcurrentQueue<T> Thread safe FIFO datastructure.
  • ConcurrentStact<T> Thread safe LIFO datastructure.
  • ConcurrentBag<T> Thread safe implementation of an unordered collection.
  • BlockingCollection<T> Provides a Classical Producer Consumer pattern.

Above all classes are available in the namespace System.Collections.Concurrent .

These collections allow us to share the data amongst several thread without any worry.

Concurrent Collections are the key of Parallel programming, that is introduced in .NET 4.0

So let’s discuss the very commonly used list ConcurrentDictionary

  • A thread safe add/remove from dictionary.
  • Very user friendly methods that make it unnecessary for code to check if a key exists before add/remove.
  • AddOrUpdate : Adds a new entry if doesn’t exist else updates existing one
  • GetOrAdd : Retrieves an item if exists, else first adds it then retrieve it
  • TryAdd, TrygetValue,TryUpdate, TryRemove : Allows to do the specified operation like Add/Get/Update/Remove and if it fails the does the alternative action.

Benefits of the above Concurrent collections:

  • Now programmer doesn’t need to take care on threadsafety.
  • Uses light weight synchronization like SpinWait, SpinLock etc that use spinning before putting threads to wait – for short wait periods, spinning is less expensive than wait which involves kernel transition.
  • Means faster add/remove/iterate in multithreading environment without writing the code for it.
  • Some other classes like ConcurrentQueue & ConcurrentStack don’t rely on Interlocked operations instead of locks which make them faster.

There is lot more to discuss on this. But keeping it short and simple, let’s finish it we’ll discuss other things coming subsequent posts.

Thanks to all my readers and supporters

For me, it couldn’t have been a better start for a Year. I felt really blessed, when I received the mail by Chris ( Founder, The Code Project) that I am in the List of CodeProject MVPs 2011.

Again After 2 days, I received the mail, that I received a Mail by Sean(CodeProject), that my article Client Templating with jQuery is selected as Best ASP.NET article of November 2010. What a brilliant start.

And ironically, during these days, I was enjoying the Holidays in Manali with my wife Renu.

What a Year start !! Really felt honored and blessed. I want to heartiest thanks all my readers and supporters. I also want to thanks of some of my friends  Abhijit, Kunal , thatRaja, Abhshek, Srinandan,  Sudeep and lot more.. for their continuous support. Also want thanks some other CPians Pete O Hanlon, Alan Beasley, Petr Pechovic and many others, who provided their candid feedback that helped me in better writing.

Again Thanks to all of you.

One Blog Article selected as “Artcle of the day” at Microsoft Official website (www.asp.net)

It is really a great pleasure for me that one of my Blog article got a place at Microsoft Official website (www.asp.net).My Article  is selected as “Article of the day” at http://www.asp.net.

In this Article, I have discussed one of the really enticing features of jQuery, that is Client Templating.

You can view complete Blog Post  here.

Thanks to all my Readers.

Just wanted to share, earlier also one of my article got selected at asp.net community. You can view that article here

You can find the complete listing of my article of My articles section in right pane.

Cheers,

Brij