The Busy Person’s Guide to Reducing Stress

Original link: http://ift.tt/P8K91a

Stress is one of the biggest causes of health problems in many peoples’ lives: it can cause heart disease, depression, anxiety attacks, sleep problems, auto-immune diseases, weight problems and more.

Leo’s advices are:

  1. Be completely in one task
  2. See your ideals, & let go of control
  3. Accept people & smile
  4. Take a brief walk
  5. Do short mindfulness practices

Awesome talks about software

https://github.com/JanVanRyswyck/awesome-talks

Early feedback from your code. Run your tests at build time with Xunit

Developing large applications  having a quality check, now days is a must. Such as quality check can be done in multiple ways: unit testing, automation testing, integration testing, others.The following example will show you a simple way of triggering of unit tests at build time using Xunit.

 

What’s cool about this approach ? It’s handy.

Xunit already has integration with Visual Studio, you can also install Xunit.Net runner extension which allows you to run tests within Test Explorer, but with this approach the unit tests will be triggered after the build is done.

 

Step 1: Create a class library project

Step 2: In Package Manager Console run the following two commands with the default project set to the newly created project:

PM> Install-Package xunit

PM> Install-Package xunit.runners

Step 3: Add reference on the project to xunit.runner.msbuild.dll. This DLL is the root of your solution in …\packages\xunit.runners.1.9.2\tools\ subdirectory.

image

Step 4: Right click, unload project and then right click again and click on edit csproj

Step 5: Add the following snippet at the end of the file just before </Project> element. Note: Assembly file name (UnitTests.dll) is the output file of the project created at Step 1 – please change that.

image

  <UsingTask AssemblyFile="bin\debug\xunit.runner.msbuild.dll" TaskName="Xunit.Runner.MSBuild.xunit" />
  <Target Name="AfterBuild">
    <xunit Assembly="bin\debug\UnitTests.dll" />
  </Target>

Step 6: Add a that will fail test using Xunit framework.

namespace UnitTests
{
    using Xunit;

    public class FutureTests
    {
        [Fact]
        public void DummyTest()
        {
            Assert.Equal(1, 2);
        }
    }
}

Step 7: Rebuild the solution and you should get a build error. Fix the test and rebuild again.

image

How to disable globally applied StyleCop rules

If you have a set of StyleCop rules that you want to disable for a specific solution in Visual Studio, follow the steps:

1. Create a file with the name Settings.StyleCop in the solution root folder (same place where the .sln file is)

2. Insert the following xml snippet in the file:

<StyleCopSettings Version="105">
  <GlobalSettings>
    <BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
  </GlobalSettings>
</StyleCopSettings>

Productivity boost with ASP.NET MVC, Code First and SQLCe

It’s easy to start from a working example.

I’ve created on GitHub a starter project that make use of ASP.NET MVC, Entity Framework 5 and SQL Compact Framework which gives you all the wirings needed to start build a data oriented application.

Business project contains a Model namespace in which you can put your application domain objects along with the BusinessContext object which describes your data context, exposing the entities and explicitly invoking the connection string which in mentioned in class constructor.

BusinessContextInitializer is make use of DropCreateDatabaseIfModelChanges strategy, so any change on the Model will trigger a database recreation (useful for development).

In the Web project the web.config file contains an connection string called BusinessContext that wires up a SQL Compact database but it can be changed to a SQL Server connection.

 

<add name=”BusinessContext”
providerName=”System.Data.SqlServerCe.4.0″
connectionString=”Data Source=|DataDirectory|\Data\data.sdf”/>

GitHub repo link: https://github.com/mitasoft/template-mvc-codefirst-sqlce