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.

Thursday, March 22, 2007

Export SQL query results with BCP


Following command exports query results with the bcp into the specified text file. It could be used to get, for example, NTEXT fields that are longer than 4000 and cutted out in SQL query analyzer:
>>bcp "select * from MyTable" queryout C:\result.txt -c -S SERVERNAME -U USERNAME -P PASSWORD

Weakest chain amplification principle


What I going to say is actually obvious- but somehow I never thought that the common sense proverb saying "the chain is as weak as its weakest link" is wrong. Really, when you hear it you may visually imagine a chain with a weak link which tears when disruptive force applied to it is much weaker than force needed to disrupt the rest of chain links.
So, what's wrong? The wrong thing is that this proverb usually not being applied to the physical chains. It applies to the chain of circumstances, probabilities or responsibilities.
In fact the chain is much weaker than its weakest link. Really, let's say we are talking about a transportation system in some city. If there is a chance of 50% that your autobus will late and a chance of 50% that your train will late there is a chance of only 25% that you will arrive at time. So, if you're looking at set or related factors where each of them has low failure probability the overall failure probability is much higher. I call it "weakest chain amplification principle".
I think this fact has interesting consequences in a lot of fields. For example in sociology: next time you hear about a 'weak chain' in politic, public sector, police, health system or whatever else you should realize that the overall situation is much worse than this 'weak chain' issue. If some politician is a bit not professional, another one does something a bit not completely legal and another one is a bit dumb all together they form a government that is not a bit weak, but really weak.
Of course - all above applies only when elements or factors are strongly related, i.e. when they are actually bound into 'chain'. And this, in turn, has some interesting implication in creation of complex systems, e.g. in software development. The thing is that, taking a SW development as an example - we may note that any big software complex has its own weak chain (bugs, design mis-considerations, etc), even in its final stage. Then - why at all those big programs are able to work? Considering all said above - it should be impossible to create a stable SW product in principle. How they work then? Well, they work since usually, after some polishing - bugs became kind of sparsely spread around and not related to each other. Theyhappen in certain conditions and with relatively low probability. And then the weakest chain amplification principle doesn't apply to them.

p.s.

Small note there is an obvious connection between above considerations and 'explicit boundaries' and 'autonomous evolution' principles in SOA.

Wednesday, March 14, 2007

Sunday, March 11, 2007

Is saying that C# is 'better' than VB.NET is a mauvais ton?




One of my favourite childhood books was book of a semi-forgotten today Russian author - L. Kassil. Misfortunately he didn't stand in competition with McDonald's of today literature world a'la Harry Potter.

Now, you would ask - how it relates to the C#? - Here is the story: heroes of the book were arguing who's stronger - marine or soldier? Whale or an elephant? … - well, you got an idea.

Now an interesting article in SDK Dev' Team blog paradoxically resembled me all of it - marine, soldier and whale :)

In this article SDK developers present a coverage of various themes done for C# and VB.NET in Vista SDK samples:

.NET 3.0 Samples # of Unique C# Coverage VB Coverage
WCF 146 100% 72%
WF 60 100% 95%
WPF 434 98% 58%
Cross Technology 23 96% 9%
.NET Framework 2.0 138 95% 80%
Totals 801 98% 66%

Do you notice that C# coverage is a bit better?

That's why I going to stand on the mauvais ton side and say that C# is better than VB.NET.
Yes, yes, everything could be implemented in language constructions of both languages. But:
1) There is more important development in C# than in VB.NET (e.g. Enterprise Libraries).
2) I think that for historical reasons - most of the people writing in VB.NET are peoples who did a transaction from some sort of visual basic development. And VB projects in the pre .net era were kind of less 'hardcore' than, say, C++ projects, whose developers probably evolved into the C# rather than into the VB.NET.
Except, how else you may explain that market offers higher wages for C# pplz (than to VB.NET)?

Wednesday, March 07, 2007

How to use w.bloggar after switching to Google Account on blogspot.com


Here is a detailed explanation on how to use w.bloggar for posting to blogspot after switching to Google Account.
Just to add that host to be referenced is still beta.blogspot.com