Showing posts with label Utility. Show all posts
Showing posts with label Utility. Show all posts

Tuesday, February 17, 2009

Sort Team System query results by multiple fields



You can sort Team System query results by by multiple fields at once by holding the Shift button, while clicking on the desired headers. You can click a header twice in order to change the sort direction.



Tuesday, May 22, 2007

Fix DNKA 'invalid request' problem

It seems that every second post in DNKA discussion group shouts something like 'Getting "invalid request" on DNKA page. Not working!"
(If you don't know what DNKA is and how it could be usefull - read this post).
Well, the bad news is that the latest DNKA version (0.49.7) does not works with the newest GDS versions 5.x.x. The good news is that you still may get the last version of GDS that works with DNKA.
Here is how:
  1. Uninstall newer version of GDS if you have it installed.

  2.    
  3. Download GDS v 4.2006.627 from here and install it.

  4.    
  5. Optionally you may change place where your index files would reside - it's specified at HKEY_CURRENT_USER\Software\Google\Google Desktop => data_dir

  6.    
  7. Install DNKA v 0.42 from here. Go to its installation directory and backup the ws2_32.dll file.

  8.    
  9. Install DNKA v 0.49 from here above v 0.42. Replace the ws2_32.dll file with one you've saved aside during previous installation.

  10.    
  11. (All DNKA releases could be found here).

  12.    
  13. Enjoy!


Wednesday, April 11, 2007

Generics collection serializer


Here is small utility class to serialize/deserialize generics collection... My usage of it is passing of multiple parameters to a web service at once.



using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Xml.Serialization;
public class CollectionSerializer<TKey, TValue>
{
public static void Serialize(TextWriter writer, IDictionary<TKey, TValue> dictionary)
{
List<ListEntry<TKey, TValue>> entries = new List<ListEntry<TKey, TValue>>(dictionary.Count);
foreach (TKey key in dictionary.Keys)
{
entries.Add(new ListEntry<TKey, TValue>(key, dictionary[key]));
}

XmlSerializer serializer = new XmlSerializer(typeof(List<ListEntry<TKey, TValue>>));
serializer.Serialize(writer, entries);
}

public static void Deserialize(TextReader reader, IDictionary dictionary)
{
dictionary.Clear();
XmlSerializer serializer = new XmlSerializer(typeof(List<ListEntry<TKey, TValue>>));
List<ListEntry<TKey, TValue>> list = (List<ListEntry<TKey, TValue>>)serializer.Deserialize(reader);

foreach( ListEntry<TKey, TValue> entry in list )
{
dictionary[entry.Key] = entry.Value;
}
}

public class ListEntry<TKeyEntry, TValueEntry>
{
public ListEntry()
{}

public ListEntry(TKeyEntry key, TValueEntry value)
{
Key = key;
Value = value;
}

public TKeyEntry Key;
public TValueEntry Value;
}
}
Please note that standard Tuple type can't be used instead of custom ListEntry as it can't be serialized.