George Mamaladze

.NET C# tips, tricks, tweaks. Effective use of data structures and algorithms. Clean code.
posts - 11 , comments - 24 , trackbacks - 0

C# Language

Tiny UML Sequence Diagram Markup Language for Agile Developer Documentation
I hate overdocumented software components and frameworks. There are top 3 reasons for that: Only the code tells the truth(programmer.97things.o... The good component expresses it’s intended way of usage through good structure, expressive naming. Ideally it is designed the way which does not allow wrong usage. Any documentation tends to became outdated. Reading such a documentation can be misleading and frustrating. And finally, to be honest, who ......

Posted On Thursday, May 3, 2012 6:34 PM | Comments (0) | Filed Under [ C# Language ]

Just launched another open source project QrCode.Net at qrcodenet.codeplex.com
Download binaries and application – 32K Source code – 99K Background Recently I was looking for a .NET implementation of QR code generator. Most of components either use online services to generate and/or recognize QR code or the implementation was not “good enough” for my purposes. The most popular and very powerful Java implementation comes from google’s open source project code.google.com/p/zxing called ZXing (Zebra Crossing => Z=Zebra + X=Cross + ing). There I found a one-to-one c# port of ......

Posted On Thursday, September 22, 2011 6:13 AM | Comments (2) | Filed Under [ C# Language ]

Parallel Programing, PLINQ and Globalization
I’m going to start with a simple code snippet which sorts an array of strings using LINQ. 1 IEnumerable<string> line = new[] {"Z","A","Ä"}; 2 var result = line.OrderBy(letter => letter); 3 Console.WriteLine("{0}", string.Join(" ", result)); The result might look like this: A Ä Z … or not. It depends on the thread culture the sorting is running in. The string order is culture aware (unlike char order which is culture invariant), so if we switch for instance on one of the Norwegian cultures ......

Posted On Tuesday, August 9, 2011 6:15 AM | Comments (0) | Filed Under [ C# Language ]

Edulinq an excellent LINQ+TDD guide
Recently I stumbled across a question on stackowerflow.com about Edulinq. Its a series of blog posts turned at the end into a free eBook. Downloaded to my eBook reader and had a lot of fun in subway. There where not to much to discover inside of LINQ for me, but it could help a novice to understand the LINQ “magic” and use it efficiently. Another very important point for me was the test driven approach. You could take this book as a guide for test driven design and development. Reading this book ......

Posted On Monday, August 8, 2011 10:03 PM | Comments (2) | Filed Under [ C# Language ]

"Cancel me if you can" or PLINQ cancelability & responsiveness in WinForms
Download Source Code Challenge Just had the first chance to apply PLINQ (Parallel LINQ) to the real task. When I am playing around with some new technology everything works fine, the real understanding comes along with challenges in a real use case. Currently I am working on application which processes large amount of text data gathering statistics on word occurrences (see: Source Code Word Cloud). Here what the simplified core of my code is doing. Enumerate through all files with *.txt extension. ......

Posted On Tuesday, August 2, 2011 10:37 AM | Comments (3) | Filed Under [ C# Language ]

The story of QuadTree perforamnce optimization
Download QuadTreeOptimization.zip c# project Background Today I'd like to share with you interesting experiences I made last several evenings when working on one of my open source hobby projects - Source Code Cloud Generator http://sourcecodecloud.code... One of the tasks was arranging of nonintersecting rectangles on a 2D surface in certain pattern. For quick 2D collision detection (rectangle intersection) I decided to use QuadTree data structure [see: http://en.wikipedia.org/wik... ......

Posted On Wednesday, July 20, 2011 10:05 AM | Comments (2) | Filed Under [ C# Language ]

Why .NET LinkedList does not support Concat and Split operations?
Why .NET LinkedList does not support Concat and Split operations? Download SimpleLinkedList source code Concat O(1) or O(n) ? The .NET LinkedList is a circular doubly linked list, where each node holds a reference to its previous and next nodes. The last node’s next is the head node and the head node’s previous is the last one. Linked lists are attractive because of O(1) insertion and removal operations. Instead of shifting elements in array you just chain nodes in appropriate order and that’s it. ......

Posted On Monday, July 18, 2011 12:55 AM | Comments (2) | Filed Under [ C# Language ]

yield – Just yet another sexy c# keyword?
yield (see NSDN c# reference) operator came I guess with .NET 2.0 and I my feeling is that it’s not as wide used as it could (or should) be. I am not going to talk here about necessarity and advantages of using iterator pattern when accessing custom sequences (just google it). Let’s look at it from the clean code point of view. Let's see if it really helps us to keep our code understandable, reusable and testable. Let’s say we want to iterate a tree and do something with it’s nodes, for instance ......

Posted On Saturday, February 5, 2011 3:04 AM | Comments (4) | Filed Under [ C# Language ]

Implementing the Equals Method in .NET and … Linear Algebra
As an informatics student you learn hundreds of mathematical definitions and theorems and all of them seem to be useless programming. Here the evidence from the “real programmer life” to demonstrate you that’s not true. I was asked to analyze some very strange behaving class. The Contains(object obj) method was not working correctly on after populating the list with instances of this class. The problem was a mess implementation of bool Equals(Object obj) overloaded methods. There was no logical or ......

Posted On Saturday, November 27, 2010 11:21 PM | Comments (0) | Filed Under [ C# Language ]

C# Tweaks - Why to use the sealed keyword on classes
C# Tweaks - Why to use the sealed keyword on classes The sealed keyword is one of the very seldom used modifiers in C#. Probably most of you know what it is for, but only several developers ever used it. See C# Programmers Guide if you are not sure you remember what the keyword is good for: http://msdn.microsoft.com/e... Why shell I use it? Most popular, but not really most important motivation is the performance - JIT compiler can produce more efficient code by calling ......

Posted On Monday, February 1, 2010 5:26 AM | Comments (9) | Filed Under [ C# Language ]

Full C# Language Archive

Powered by: