pondelok 9. januára 2012

Share files between projects in solution VS

Sometimes you need to share e.g. config files between projects in one solution.
It's very simple:
- Click Add Existing Item and choose "Add as Link"

And don't worry, it is using relative paths.

Rolling log4net logs by Date

Simple example (max. 180 days backwards):

<appender name="AuditFileAppender" type="log4net.Appender.RollingFileAppender">
    <file value="d:\audit_logs\log.txt_" />
    <appendToFile value="true" />
    <rollingStyle value="Date" />
    <param name="maxSizeRollBackups" value="180" />
    <param name="StaticLogFileName" value="false"/>
    <param name="DatePattern" value="dd-MM-yyyy"/>
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%message%newline" />
    </layout>
  </appender>

Unit Test Atributes in commom testing frameworks

I'm rewriting some my old test classes, writed in NUnit to the "new" MS Test.
I was looking for the alternative of TestFixtureTearDown

and Whoa la, I found this very usefull table:


NUnit 2.x MbUnit 2.4 MSTest xUnit.net
[Test] [Test] [TestMethod] [Fact]
[TestFixture] [TestFixture] [TestClass] n/a
[ExpectedException] [ExpectedException] [ExpectedException] Assert.Throws or Record.Exception
[SetUp] [SetUp] [TestInitialize] Constructor
[TearDown] [TearDown] [TestCleanup] IDisposable.Dispose
[TestFixtureSetUp] [TestFixtureSetUp] [ClassInitialize] IUseFixture<T>
[TestFixtureTearDown] [TestFixtureTearDown] [ClassCleanup] IUseFixture<T>
[Ignore] [Ignore] [Ignore] [Fact(Skip="reason")]
n/a [Timeout] [Timeout] [Fact(Timeout=n)]
[Property] n/a [TestProperty] [Trait]
n/a [Row], [RowTest] [DataSource] [Theory], [XxxData]






































































































































utorok 3. januára 2012

How to make generic dictionary case insensitive

Dictionary<string, object> values =
new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);

Very simple!

Ako zistiť aktívne konekcie na SQL Server 2008

V Microsoft SQL Server Management Studiu kliknúť na "Activity monitor" - Procesess.
Poskúmajte aj iné záložky, nájdete tam kopu užitočných informácií.

How to find active session on SQL Server 2008






In the  Microsoft SQL Server Management Studio click on "Activity monitor" - tab Procesess. In the context menu is possible to kill session/process.
Also look on others tabs, you can find many useful informations.



Windows Server 2008 R2 licencing for Virtual and Physical environment

 Windows Server 2008 R2 Standard – A customer licensed with Windows Server 2008 R2 Standard may run one instance of the server software in the physical operating system environment (POSE) and one instance of the server software in a virtual operating system environment (VOSE).  If the customer is running the instance in the VOSE then the instance running in the POSE can only be used to manage the instance of the OS running in the VOSE.

    Windows Server 2008 R2 Enterprise – A customer licensed with Windows Server 2008 R2 Enterprise may run one instance of the server software in the physical operating system environment (POSE) and up to four instances of the server software in the virtual operating system environment (VOSE).  If the customer is running 4 instances in the VOSE then the instance running in the POSE can only be used to manage the 4 instances of the OS running in the VOSE.

    Windows Server 2008 R2 for Datacenter – A customer licensed with Windows Server 2008 R2 Datacenter may run one instance of the server software in the physical operating system environment (POSE) and an unlimited number of instances of the server software in the virtual operating system environment (VOSE).

    Windows Server 2008 R2 for Itanium-based Systems – A customer licensed with Windows Server 2008 R2 for Itanium-based Systems may run one instance of the server software in the physical operating system environment (POSE) and an unlimited number of instances of the server software in the virtual operating system environment (VOSE).

    Windows Web Server 2008 R2 – Windows Web Server 2008 R2 is licensed to a server in the physical operating system environment (POSE).  You can also run as a guest in the virtual operating system environment (VOSE).

    Windows Server 2008 R2 Foundation – Windows Server 2008 R2 Foundation is licensed to a server in the physical operating system environment (POSE).