1. primaryGroupToken via C# from Active Directory (AD)

    I needed to change Primary Group of the Active Directory user programmatically (via C#). I found a good example in PowerShell. But it wasn’t obvious for me on how to convert the following code fragment into C#:

    $NewGroup = [ADSI]"LDAP://CN=Domain Guests,CN=Users,$DomainNC"
    $NewGroup.GetInfoEx(@("primaryGroupToken"), 0)
    $NewGroupToken = $NewGroup.Get("primaryGroupToken")
    
    So here is it, just in case it isn’t obvious for you as well ;)
    group.Invoke("GetInfoEx", new object[] { new object[] { "primaryGroupToken" }, 0 });
    object primaryGroupToken = group.Invoke("Get", new object[] { "primaryGroupToken" });
    


  2. Command Query Responsibility Segregation (CQRS) pattern

    I’ve just read excellent introduction to the Command Query Responsibility Segregation (CQRS) pattern. And you know, it seems really worthy to have in a toolbox.
    Actually just to be ready to use it I’ll need to research many related patterns such as Reporting Database, Event Sourcing, etc..
    So check it yourself - read this great CQRS introduction to see how many useful patterns and practices those are related to CQRS you don’t know yet ;) …


  3. MSpec and TFS Build Service (MSMSpec)

    If you are going to use MSpec in your next .NET project you could face the following issues:

    1. Visual Studio won’t be able to execute MSpec specifications. (MSpec has it’s own test engine)
    2. TFS Build Service is able to run only MSTest.
    I found several articles on that problem in search engine. The best solution I found was MSMSpec. I’m very appreciate the work HeartattacK had done since it really helped me! MSMSpec is a T4 template which creates MSTests based on your MSpec classes. So it provides us ability to run MSpec specs in Visual Studio and in TFS Build Service, calculate Code Coverage and Test Impact using MS tools. Here’s my approach to get it working:
    1. I added MSMSpec.tt to the solution items. And added its as a link to each MSpec project.
    2. I made TestExecutionHelper class internal. It was public initially, so if one MSpec project is referencing another, public TestExecutionHelper will result in a conflict. (since both assemblies are declaring the same class). MSMSpec author suggests another workaround but it doesn’t fit my need since I use shared MSMSpec.tt.
    3. I added 108 to the suppress warnings list in all MSpec projects. (to suppress “_Setup hides inherited member. Use the new keyword if hiding was intended” warning)
    4. Finally I fixed Cleanups execution order (Parent class Cleanup should be called after Child class Cleanup):
    1. //var cleanupInfos = FilterByType<Cleanup>(fieldInfos);
    2. var cleanupInfos = FilterByType<Cleanup>(fieldInfos).Reverse();
    Thant’s it. Hope this helps someone! …


  4. Team City: Windows Authentication

    There is detailed article on how to configure different authentication modes in Team City. But it lacks some information… Let consider the following example:

    1. You setup Team City
    2. Configured Project in it
    3. All went fine and now you need to configure user access
    4. So you switched Team City to Windows Authentication
    5. Now you can login with you Domain credentials, but you can’t give administrator rights to any user since you don’t have administrator yet
    So I found the following workaround:
    1. Login using Default Authentication Mode as Administrator in the Browser #1
    2. Switch Authentication Mode to Windows Authentication
    3. Login in as a Windows Domain User in the Browser #2
    4. In the Browser #1 open Users and Groups
    5. You will see newly created user account for Windows Domain User logged in using Browser #2
    6. You can select this account and give it administrative rights


  5. Automated Build Usage Example

    A problem

    Do you have a manager on a project? Does (s)he use Visual Studio to review new versions? For me the answer was Yes for the both above questions on the last project I was involved on. It’s a real pain to start Visual Studio just to build an run application, isn’t it? I think so, since to be honest it will take a while…
    • Wait Visual Studio to be started
    • Get latest source code
    • Wait until Visual Studio will load a project
    • And finally we need to build a project.


  6. Peopleware: Productive Projects and Teams

    Peopleware is a really amazing book. IMHO it isn’t just for managers or management people, but to the all people engaged in collaboration. So please consider to read it since I’m sure it will provide a lot of joy for you! Some great quotation.

    • The manager's function is not to make people work, but to make it possible for people to work.
    • There are a million ways to lose a work day, but not even a single way to get one back.
    • Quality—If Time Permits
    Among other things book states that productivity heavily depends on the working environment. The main negative factor is Interruptions and Noise. So companies should stop saving money on the office space. Since in that case they will pay hidden cost on the productivity drop. So it’s much better to provide nice (required?) working environment to the employees to make them happy and receive productivity boost. As about Signal & Noise issue. The authors stated that Phone (I’m sure it’s related to the Skype calls as well) usage should be avoided in the most cases. If you really need an immediate answer to continue your work, then phone should be your choice. In other case they recommend to use e-mail. All we need to be able to rely on e-mail is just to come to the agreement that e-mail will be checked with reasonable frequency.
    People must  learn  that it's  okay sometimes not to answer their phones, and they just learn that their time—not just the quantity but its quality—is important.


  7. Erlang and web development

    First off all what is Erlang? Here’s description from the http://www.erlang.org/

    Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang's runtime system has built-in support for concurrency, distribution and fault tolerance
    First time I heard about Erlang was way back into 2007. At that time I thought about it as a great choice for development of the server applications such as game servers, instant messaging, etc. Recently I was wondering if are there any Erlang frameworks for web development exists. And as you probably expected there are Many frameworks. I made some research of the Chicago Boss. And you know it’s just awesome! One of the greatest features is Zero downtime code upgrades in production. I’m sure Chicago Boss doesn’t so mature as for example ASP.NET. But you know ASP.NET is a general solution. You can build any kind of web application using it. It could be regular HTML pages or highly interactive single-page application or just web service. I suppose Erlang (and Chicago Boss) are more specialized. For example if I plan to build web site with regular HTML pages I probably will rely on ASP.NET (or PHP). But for single-page applications with requirements on high availability I will consider Erlang (Chicago Boss) + HTML5 (jQuery, Knockout) …


  8. Tempo – tiny templating engine (JavaScript)

    Tempo is a neat JSON templating engine with No dependencies. And it’s just 8KB of the minified JavaScript code. However if we will decide to use JQuery (for example to make AJAX requests in a convenient way) probably we could just use mature jQuery Templates. Anyway I’m totally sure Tempo could be a great choice for some kind of projects. …


  9. Knockout.js - MVVM for the client-side code

    If you didn’t have a chance to review Knockoutjs library written by Steve Sanderson, please Do that Smile It’s just amazing! Furthermore it has great interactive tutorials so you’ll be able to learn the basics in a very convenient and fun way! By the way Steve shared which open-source components he used in learn.knockoutjs.com. …


  10. 12 Steps to Better Code

    Just came over the amazing article The Joel Test: 12 Steps to Better Code written way back in 2000, but it's still 100% true! Actually IMHO we could improve the article slightly (today after more than 10 years since original article was published)

    • It’s worth to add there something like – “Do you use any Test First Development technique?
    • Also “Do you have a spec?” could become something like “Do you use Acceptance Test Driven Development (ATDD)?”
    Interesting thing is that I read that article several years ago and it was very fun to read it now to compare my perception. …