Notes about programming C#, asp.net, mvc, webapi, angularjs, jquery, angular 2, SQL Server

  • Rebuild all indexes in Azure SQL

    DECLARE @TableName varchar(255)

    DECLARE TableCursor CURSOR FOR

    SELECT table_name FROM information_schema.tables

    WHERE table_type = 'base table'

    OPEN TableCursor

    FETCH NEXT FROM TableCursor … more

  • C# .net parse CSV double quotes

    Tags: C#, .NET, CSV

    private List ParseCSV(string csv)

    {

    List results = new List();

    var stream = new MemoryStream(Encoding.UTF8.GetBytes(csv));

    using (TextFieldParser parser = new TextFieldParser( … more

  • ASP.NET Identity Framework Autofac

    builder.RegisterType().AsSelf().InstancePerRequest()

    //...

    builder.RegisterType().AsSelf().InstancePerRequest();

    builder.RegisterType().AsSelf().InstancePerRequest();

    builder.Register(c => new … more

  • CRON examples

    ExpressionMeaning

    0 0 12 * * ?

    Fire at 12pm (noon) every day

    0 15 10 ? * *

    Fire at 10:15am every day

    0 15 10 * * ?

    Fire at 10:15am every day

    0 15 10 * * ? *

    Fire at 10:15 … more

  • Update windows Path

    set PATH=%PATH%;"C:\Windows\Microsoft.NET\Framework\v4.0.30319" more

  • Remote access to local web app

    netsh interface portproxy add v4tov4 listenport=800 connectaddress=127.0.0.1 connectport=82 protocol=tcp

    more

  • ASP.NET Identity add new user and role

    var user = new ApplicationUser { Email = "email@gmail.com", UserName = "email@gmail.com" };

    var result = await UserManager.CreateAsync(user, "PwD!23");

    await RoleManager.CreateAsync(new Microsoft. … more