1. Javascript Unit Tests on Team Foundation Service with Chutzpah

    I was helping my peer developer to setup TFS Build to run Jasmine tests. Thanks to Visual Studio & TFS teams it’s really easy to do since TFS 2012! (I configured TFS Build to run Machine.Specification couple of years ago) We were using the Javascript Unit Tests on Team Foundation Service with Chutzpah guide. It’s very nice and straightforward article. The only thing I don’t like about it is that it needs to set Copy to Output Directory on each test file. Instead of that we added the following Post-build script, so we don’t need to set Copy to Output Directory on each test file.

    for /R $(ProjectDir) %%G IN (*.test.js) DO copy "%%G" $(TargetDir)
    Hope it helps! …


  2. Dependency Injection in .NET. Seemann Mark.

    Recently I had a chat with a peer developer about IT books. I recommended him a great Seemann Mark’s book Dependency Injection in .NET. After that I realized that I never blogged about it! I’d say that in my opinion this is an Must Read book for .NET software developers. At first I was a bit surprised that it’s a 500+ pages book about one pattern, but it’s really worth it. First chapters are an amazing explanation of the Dependency Injection and Inversion of Control patterns. Last chapters dives in details of some popular DI containers. Unfortunately it doesn’t contain a chapter about Ninject which is my favorite DI container, but there are tons of information about it on the Internet. Service Locator is anti-pattern? I was very excited that he lists Service Locator as a DI anti-pattern! We were using Service Locator on a big WPF application couple of years ago. After some time I released that it’s not an ideal choice. Seemann Mark stated the following issues with Service Locator pattern:

    • The module drags along a redundant Dependency
    • It isn't apparent that DI is being used
    I’d like to just add that it’s way easier to read the code if you can see all the dependencies just by looking at the class constructor. Also it’s easier to test such code because you don’t need to configure Service Locator to use Mocks. All you need is just pass the objects you want. In some cases it would be real implementation, in others it would be mock, test double, etc. So even if you aren’t .NET developer I still suppose it makes sense to read first chapters of this amazing book. Highly recommend! …


  3. Mono 3.2.7 is working on a Raspberry Pi running Raspbian (hard float)!

    We were planning to port our application into Mono to give it a try on a Raspberry Pi for a quite a while. What’s interesting now, then we finally started to do this, Alex Rønne Petersen added a hard float support to Mono! I was able to build his armhf branch directly on my Raspberry Pi. So now I’m all set to port our application! Thanks to Alex! Thanks to the Mono team! :) …


  4. Stop your console app the nice way

    This would be obvious for someone. Posting it just in case :)

        class Program
        {
            private static readonly AutoResetEvent AutoResetEvent = new AutoResetEvent(false);
     
            static void Main(string[] args)
            {
                Console.CancelKeyPress += OnCancelKeyPress;
     
                //TODO: do work here
                AutoResetEvent.WaitOne();
                //TODO: shutdown here
            }
     
            private static void OnCancelKeyPress(object sender, ConsoleCancelEventArgs e)
            {
                e.Cancel = true;
                AutoResetEvent.Set();
            }
        }
    


  5. Durandal: TypeScript modules support

    I’m working on a prototype of HTML5 Single Page Application (SPA). I’m happy to use plumbing provided by Durandal. It’s really exciting SPA framework.  Unfortunately it doesn’t support TypeScript modules. According to Rob Eisenberg it won’t be fixed for now (quote below)

    I'd rather not make a change in the core based on the current state of TypeScript. Rather, I'd prefer a plugin that re-configures durandal for this case. But, it will get fixed in TypeScript before v1.0 I confirmed that by checking their roadmap. Also Luke Hoban responded to me via codeplex to say they have every intent to fix it https://github.com/BlueSpire/Durandal/pull/13
    So if we are going to start to use TypeScript with Durandal… we need some workaround. So here we go. First we need to apply below lines into router.js. It will add basic TypeScript modules support. Second step is to enable master\detail scenario by adding below lines into system.js Would be happy to get some feedback on this. …


  6. Typed XML programming

    I want to tell you about very useful project LINQ to XSD

    The LINQ to XSD technology provides .NET developers with support for typed XML programming. LINQ to XSD contributes to the LINQ project (.NET Language Integrated Query); in particular, LINQ to XSD enhances the existing LINQ to XML technology.
    Please consider the following code:
    services services = services.Load(@"c:\services.xml");
    string name = services.service.First(x => x.FullTypeName == "xx").Namespace;
    
    As you probably understand it reads XML underneath. But you deal with LINQ query and don’t worry about parsing XML. …


  7. TFS 2012 migrated from TFS 2010: Project Creation fails

    As I mentioned previously we migrated to the TFS 2012 + SharePoint 2013. It’s worth to mention that TFS 2012 is just great! It’s so handy to use new dashboards and task planning stuff. We just Love it Smile But today we had to create new project… and it did work for us. TF301777: Team Project Creation Failed New Team Project Wizard encountered the following error and could not continue. Error The Project Creation Wizard encountered an error while creating reports to the SQL Server Reporting Services on http://servername/ReportServer/ReportService2005.asmx. After some Goodling I found Jeremy Jameson blog post on the similar issue. Although our cause was a bit simpler - all the TFS reports were in Reporting Server. So I just had to ran below SQL statements:

    USE master
    GO
    GRANT EXECUTE ON master.dbo.xp_sqlagent_notify TO  [NT SERVICE\ReportServer]
    GO
    GRANT EXECUTE ON master.dbo.xp_sqlagent_enum_jobs TO  [NT SERVICE\ReportServer]
    GO
    GRANT EXECUTE ON master.dbo.xp_sqlagent_is_starting TO  [NT SERVICE\ReportServer]
    GO
    USE msdb
    GO
    -- Permissions for SQL Agent SP's
    GRANT EXECUTE ON msdb.dbo.sp_help_category TO  [NT SERVICE\ReportServer]
    GO
    GRANT EXECUTE ON msdb.dbo.sp_add_category TO  [NT SERVICE\ReportServer]
    


  8. Schemaless Data Structure

    I planned to get familiar with some of the schemaless databases for a long time. And eventually got time to this a couple of days ago. And it was real surprise for me to see post on this topic on the Martin Fowler’s blog next day since I blogged about my first MongoDB experience. Anyway I highly recommend you to review this great Schemaless Data Structures presentation. …


  9. MongoDB at a glance

    Just finished reading of the MongoDB: The Definitive Guide book. You know it was really exciting. The book is a great introduction to the MongoDB and to the all it’s features. Also there are several nice examples those emphasize the advantages of the document-oriented databases. As for the MongoDB itself, I hope to try it on one of the upcoming projects, cause I suppose document-oriented model will work just great for it. …


  10. Machine.Specifications under TFS 2012

    About year ago we started to use Machine.Specifications (screencast) on one of our projects. It was really nice to have executable specifications and well organized tests. The only issue was is that TFS 2010 Build wasn’t able to run Machine.Specifications. Finally I’ve added some T4 templates to create MSTest wrappers for MSpec code. So we were able to run our tests and see the coverage on the CI server. What’s amazing TFS 2012 support test runner extensions. Hence now we can easily configure our CI server to run Machine.Specifications and show us the code coverage! The step by step guide for NUnit available at http://blog.accentient.com/2012/04/30/RunningNUnitInATFS11BuildOn64BitServer.aspx. For the Machine.Specifications it’s pretty much the same. The only change is that you’ll need to install MSpec Test Adapter instead of NUnit. Also please make sure you selected Visual Studio Test Runner in the build configuration. …