Showing posts from February, 2010

Mercurial tutorial by ‘Joel Spolsky’


.Net WPF Tutorials

Good set of tutorials about WPF (Windows Presentation Foundation) This is a good start Learn WPF in two Weeks

How to always browse in Incognito mode with Google Chrome


SQL Server run query from command line

C:\>sqlcmd -SLOCALHOST\SQLEXPRESS -Q " Select 'Hello World' "

C# Sample Cache with timeout

public enum CacheEventType { ADD, REMOVE } public class Cache<K, V> { public const int CheckInterval = 1000; private int _timeoutSeconds; private SortedList<Timeout, K> timeouts = new SortedList<Timeout, K>(); private Dictionary<K, V> items = new Dictionary<K, V>(); private Timer timer; private object locker = new object (); public delegate void CacheEventHandler( object source, CacheEvent<K, V> e); public event CacheEventHandler changed; public Cache( int timeoutSeconds) : this (timeoutSeconds,CheckInterval){} public Cache( int timeoutSeconds, int checkInterval) { this ._timeoutSeconds = timeoutSeconds; timer = new Timer(PurgeCache, " Cache ", checkInterval, checkInterval); //purge cache } private void PurgeCache( object data) { lock (locker) { for ( int i = timeouts.Count - 1; i >= 0; i--) { if (timeouts.Keys[i].IsExpired())

C# Converting array or List to string

public void Test() { List< string > list = new List< string >(); dogs.Add(" One "); dogs.Add(" Two "); dogs.Add(" Three "); Console.WriteLine( string .Join(" , ", list.ToArray())); }