Hashing in .NET (cryptography related battle tactics)
Those who think I'm going to talk about stuff related to hashish or hash brown are totally not right. (By the way I do like hash brown as well as this great Japanese liquor ;) ) I will be talking... .
View ArticleThe basics of secure data exchange under TCP
Doing data exchange in plain text is very convenient and easy to implement but what can you do to prevent eavesdropping, tampering, and message forgery of the data you send back and forth? Here's... .
View Article"Using" magic or working with type aliases
Generics in C# allow us specify and construct rather complex types. For instance, we can create a dictionary that maps Id number with the name: Dictionary<int, string> idNameMapping;We can... .
View ArticleHandling Windows Operating System Version Mess
Operating System (OS) like any other software should have a version. So do new OSes from Microsoft. Sometimes OS version is crucial for the installation software development process. Some products... .
View ArticleBit Flags: The Simple Way
Time from time we face the need or (for some of us) an opprotunity to mess with the bit fields. As we all know bytes consist of bits. Bit can have two values "0" and "1". Using this knowledge we can... .
View ArticleSearching for Similar Words. Similarity Metric
How one can find out if two or more words are similar? I do not mean semantically similar (synonyms aren't taken into consideration), but visually similar. Consider, these two words, "sample1" and... .
View ArticleImage Watermarking
We all know that when image is posted on the internet it no longer belongs to you. It can be arguable, but nevertheless, any user with browser can simply save it on HDD and you can do nothing about... .
View ArticleWindows Vista Defragmentation Tools
Windows Vista by default uses NTFS file system. Sooner or later files on it will start to fragment. Fragmentation can lead to significant disk I/O performance decrease. Common way how to handle... .
View ArticleDiscovering System Endianess
When doing network programming we send bytes to and from peers. These bytes sometimes constitute complex protocols. Let us assume we have simple message exchange protocol with some header and some... .
View ArticleCheck If Local Port Is Available For TCP Socket
From time to time we need to check if specified port is not occupied. It can be some sort of setup action where we install server product and want to assure that tcp listener will start without any... .
View ArticleComplex Keys In Generic Dictionary
Let us start with the quiz about generic dictionary. Dictionary simpleDict = new Dictionary(StringComparer.OrdinalIgnoreCase); simpleDict["name1"] = "value"; simpleDict["Name1"] = "value2";What value... .
View ArticleHowto: C++ Class Conversion Operator in .CPP file
In case someone did not know how to do this. It took me some time to figure out the right syntax for writing conversion operator implementation in the CPP file. Here is the definition of the... .
View ArticlePerformance Issues When Comparing .NET Strings
Every time when you want to use string.Compare("str1", "str2", true) for case insensitive string comparison - think twice. To illustrate my point I am bringing this example: int iters =... .
View ArticleLocal Computer Connection Failure When Using ActiveSync
Not so long ago I have encountered strange problem with Windows Mobile device connectivity when using ActiveSync. Here is long story cut short and the solution I came up with. Server software... .
View ArticleString Compare Performance in D
A while ago I was measuring performance of string comparison in .NET. Today I played with string type in D programming language and decided to make similar tests. D is relatively new language... .
View ArticleMSSQL DATEDIFF Equivalent in MySQL
Recently I was porting T-SQL (MSSQL) code into SQL dialect used by MySQL. Process went smoothly until I have stuck with dates. Especially intervals between two dates. In T-SQL datediff function is... .
View ArticleMono: C# compiler bug with property inheritance
The bug appeared quite unexpectedly. In Visual Studio code sample below compiled fine. But doing the same with Mono C# compiler results in error: Compiler Error CS0546: 'Derived2.Accessor.set':... .
View ArticleRefactoring code with lambda expressions
Without much ado lets go straight to the code that needs to be refactored: bool SomeMethod(long param) { // // some prefix code // try { //do specific job here return... .
View ArticleThe Big Bang Theory sitcom scientific background
Usually I do not write about TV. But the serial in the subject is one of my favorite. Recently I've found blog of the guy who does scientific background for that sitcom. There are a lot of... .
View ArticleAesManaged class Key and KeySize properties issue
Today when working with AesManaged class I've encountered very strange behavior. If you have a code like this - you're in trouble: AesManaged aes = new AesManaged(); aes.Key = key; aes.KeySize =... .
View Article