Monthly Archive for February, 2010

Productivity: What Causes You Friction?

As I am waiting for Reflector to load and my browser to unfreeze, I thought maybe if I write down all the things that cause me friction when attempting to be productive, I may just feel a little less frustrated by it all.

So here it goes:

  1. Lotus Notes takes up to 20 seconds to redraw itself when returning from my VM
  2. SameTime can also take this long
  3. SharePoint Development Requirements - Lots of RAM and Windows Server OS
  4. SharePoint GAC Deployment - Recycling of App Pools gets old
  5. Getting distracted writing this blog post after Reflector finished loading 5 minutes ago
  6. Visual Studio Add Reference Dialog (can’t wait to get my whole team over to VS 2010 to cross this one off the list)
  7. Misleading WCF Add Service Reference Error Messages
  8. Did I mention Lotus Notes
  9. Web Meetings and Teleconferencing
  10. Two-factor authentication with a 5 minute timeout (Explanation: I am working for a defense contractor)

On the other hand, there are certain things that just plain allow me to be productive:

  1. My Wife Sarah
  2. GMail
  3. Google Reader
  4. Google Chat
  5. Visual Studio Intellisense
  6. FireBug
  7. Notepad++
  8. My Colleague Winston’s MindTree application
  9. Pencil and Paper (not the name of some app, I mean physical pencil and paper)
  10. Whiteboards

So what is causing you friction?

Extension Method of the Day: OrderBy with a Descending Flag

The title should say it all. Not sure why this didn’t make it into the System.Linq.Enumerable class, but this seems like a no-brainer. You need to sort a collection, but whether you sort ascending or descending is determined by a boolean argument instead of having to call a different method for each scenario. Add this to your collection utilities class immediately:

        /// <summary>
        /// Sorts the elements of a sequence according to a key.
        /// </summary>
        /// <exception cref="System.ArgumentNullException">source or keySelector is null.</exception>
        /// <typeparam name="TSource">The type of the elements of source.</typeparam>
        /// <typeparam name="TKey">The type of the key returned by keySelector.</typeparam>
        /// <param name="source">A sequence of values to order.</param>
        /// <param name="keySelector">A function to extract a key from an element.</param>
        /// <param name="descending">if set to <c>true</c>, sorts the elements in descending order; otherwise in ascending order.</param>
        /// <returns>An System.Linq.IOrderedEnumerable<TElement> whose elements are sorted according to a key.</returns>
        public static IOrderedEnumerable<TSource> OrderBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, bool descending)
        {
            if (descending)
                return source.OrderByDescending(keySelector);
 
            return source.OrderBy(keySelector);
        }