Resharper keyboard shortcuts not working in VS2015

by Admin 18. March 2016 11:00

I had an issue earlier with Resharper shortcuts not working in Visual Studio 2015.

I had to follow to use these steps to make Resharper work again

1. Tools > Options > Keyboard > Click on the Reset button (top right) and click ok.

2. Tools > Options > Resharper > Options > Click on Apply Scheme and click Save.

Now close and re-open your visual studio. Hope the Reharper shortcuts are back to life again!

Ctrl + T :)

Tags:

Git stuff

by Admin 15. March 2016 12:50

Using Visual Studio to add a .gitignore file

Inside of Visual Studio open the Team Explorer window. If you don’t already have it open use the quick launch in the upper right hand side of the window to search for it. If it is not already on the Home page click the house icon in the top of the Team Explorer window.

TeamExplorerHome

Click the settings option.

TeamExplorerSettings

Then click Repository Settings.

TeamExplorerRepositorySettings

Now click the add link next to the Ignore File description. This will add the .gitignore file will all the defaults set for things that should be ignored. You could add the file manually, but then you would not get the nice set of default values. If you do decide to add the file manually this repo contains all the defaults that should be ignored for a project using .NET/Visual Studio.

Now that the file exists check it in.

Stop tracking files that should be ignored

To stop tracking the files in the ignore file open a command prompt and navigate to the directory that contains your solution file (.sln) and run the following commands.

git rm -r --cached . 
git add .
git commit -am "Remove ignored files"

That seemed to do the trick for me.

 


Setting Identity in GIT
$ git config --global user.name "UserName"
$ git config --global user.email "venkat@VenkatRangala.com"

To unblock the proxy

$ git config --global http.proxy "http://xx.xx.xx.xx:8080/"
$ git config --global https.proxy "http://xx.xx.xx.xx:8080/"


gitignore file creation in Windows
$ touch .gitignore


Create a Branch in GIT
$ git branch <BranchName>

To switch to the branch name
$ git checkout <BranchName>    [Note: If you cant see the branch name, try doing a git fetch]

Create Branch & checkout

git checkout -b "<BranchName>"


Add a file from command in GIT
$ touch <filename>
Eg: $ touch styles.css
A new styles.css file gets added to the git repository


$ git checkout master
Will switch you to the main branch


$ git mergetool
uses a tool like tortisegit or winmerge to perform merge a little more effeciently

 

Best way to merge a git branch into master

My work on test branch is complete and I am ready to merge it back to master

git checkout master

git pull origin master

git merge test

git push origin master

 

Git Compare branches

For those of you on Windows using TortoiseGit, you can get a somewhat visual comparison through this rather obscure feature:
    Navigate to the folder you want to compare
    Hold down shift and right-click it
    Go to TortoiseGit -> Browse Reference
    Use ctrl to select two branches to compare
    Right-click your selection and click "Compare selected refs"

Source: http://wikgren.fi/compare-diff-branches-in-tortoise-git-or-how-to-preview-changes-before-doing-a-merge/

Useful Links

http://juristr.com/blog/2013/04/git-explained/

https://dzone.com/articles/git-visual-studio-and-net

https://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c

 

Change Git password 

https://cmatskas.com/how-to-update-your-git-credentials-on-windows/

Tags:

Publishing to an Azure Web App with Continuous Deployment

by Admin 22. January 2016 07:28

Publishing to an Azure Web App with Continuous Deployment

http://docs.asp.net/en/latest/publishing/azure-continuous-deployment.html

Tags:

Interview questions

by Admin 5. November 2015 11:32

Diff DI & IOC

The main goal of Inversion of control and Dependency Injection is to remove dependencies of an application. This makes the system more decoupled and maintainable.

IOC is a concept where the flow of application is inverted

Inversion of control :- It’s a generic term and implemented in several ways (events, delegates, DI etc).

Dependency injection :- DI is a subtype of IOC and is implemented by constructor injection, setter injection or method injection.

https://www.codeproject.com/Articles/592372/Dependency-Injection-DI-vs-Inversion-of-Control-IO

Service Locator?

 

OUT & REF parameters

Ref and out parameters are used to pass an argument within a method. 

Ref

The ref keyword is used to pass an argument as a reference. This means that when value of that parameter is changed in the method, it gets reflected in the calling method. An argument that is passed using a ref keyword must be initialized in the calling method before it is passed to the called method.

Out

The out keyword is also used to pass an argument like ref keyword, but the argument can be passed without assigning any value to it. An argument that is passed using an out keyword must be initialized in the called method before it returns back to calling method. 

 

Constant is known as “const” keyword in C# which is also known immutable values which are known at compile time and do not change their values at run time like in any function or constructor for the life of application till the application is running.

Readonly is known as “readonly” keyword in C# which is also known immutable values and are known at compile and run time and do not change their values at run time like in any function for the life of application till the application is running. You can change their value by constructor when we call constructor with “new” keyword.

 

String is immutable (Performance wise string is slow because its’ create a new instance to override or change the previous value.)

String builder is mutable (Performance wise StringBuilder is very fast because it will use same instance of StringBuilder object to perform any operation like insert value in existing string.)

http://www.c-sharpcorner.com/UploadFile/8ef97c/C-Sharp-net-interview-questions-and-answers/

Tags:

Upload and Edit Excel file

by Admin 29. July 2015 13:54

 

        [HttpPost("UploadFiles"), DisableRequestSizeLimit]

        [AllowAnonymous]

        public IActionResult UploadFiles() //Blob Storage

        {

            try

            {

                var files = Request.Form.Files;

                const string folderName = "ExcelUploads";

 

                var pathToSave = Path.Combine(Directory.GetCurrentDirectory(), folderName);

 

                if (files.Any(f => f.Length == 0))

                {

                    return BadRequest();

                }

 

                foreach (var file in files)

                {

                    var fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');

                    var fullPath = Path.Combine(pathToSave, fileName);

                    var dbPath = Path.Combine(folderName, fileName);

 

                    using var stream = new FileStream(fullPath, FileMode.Create);

                    file.CopyTo(stream);

                }

 

                return Ok("File uploaded successfully.");

            }

            catch (Exception ex)

            {

                return StatusCode(500, "Internal server error");

            }

        }

 

        [HttpGet("ReadFiles")]

        [AllowAnonymous]

        public IActionResult ReadFiles()

        {

            const string folderName = "ExcelUploads";

            var folderPath = Path.Combine(Directory.GetCurrentDirectory(), folderName);

 

            var fileEntries = Directory.GetFiles(folderPath);

 

            foreach (var fileName in fileEntries)

            {

                if (fileName.Length > 0)//ProcessFiles

                {

                    ReadExcelByName(fileName);

                }

            }

            return Ok();

        }

 

        /// <summary>

        /// Read the rows and update the column data

        /// </summary>

        /// <param name="fileName"></param>

        /// <returns></returns>

        public static string ReadExcelByName(string fileName)

        {

            IWorkbook workbook;

            ISheet sheet;

            //IRow row;

            ICell cell;

            string sheetName = "CO_Data_input_sheet";

            using FileStream rstr = new FileStream(fileName, FileMode.Open, FileAccess.Read);

            workbook = new XSSFWorkbook(rstr);

            sheet = workbook.GetSheet(sheetName);

            IRow headerRow = sheet.GetRow(0);

            int cellCount = headerRow.LastCellNum;

 

            for (int i = (sheet.FirstRowNum + 1); i <= sheet.LastRowNum; i++)

            {

                IRow row = sheet.GetRow(i);

                if (row == null) continue;

                if (row.Cells.All(d => d.CellType == CellType.Blank)) continue;

                for (int j = row.FirstCellNum; j < cellCount; j++)

                {

                    if (row.GetCell(j) != null)

                    {

                        if (!string.IsNullOrEmpty(row.GetCell(j).ToString()) & ((!string.IsNullOrWhiteSpace(row.GetCell(j).ToString()))))

                        {

                            var temp1 = new CellReference(row.GetCell(j));

                            var reference = temp1.FormatAsString();

                            if (reference.StartsWith("D"))

                            {

                                using FileStream wstr = new FileStream(fileName, FileMode.Create, FileAccess.Write);

                                cell = row.GetCell(j);

                                cell.SetCellValue(DateTime.Now.ToShortDateString());

                                workbook.Write(wstr);

                                wstr.Close();

                            }

                            if (reference.StartsWith("E"))

                            {

                                using FileStream wstr = new FileStream(fileName, FileMode.Create, FileAccess.Write);

                                cell = row.GetCell(j);

                                cell.SetCellValue("Dev");

                                workbook.Write(wstr);

                                wstr.Close();

                            }

                        }

                    }

                }

            }

            rstr.Close();

            

            return null;

        }

 
 

ExcelFileUploadController.cs (9.60 kb)

Tags:

Git commonly used commands

by Admin 5. April 2015 01:51

Basic Git commands

Go to the master branch to pull the latest changes from there

git checkout master

Download the latest changes in the project

This is for you to work on an up-to-date copy (it is important to do every time you work on a project), while you setup tracking branches.

git pull REMOTE NAME-OF-BRANCH -u

(REMOTE: origin) (NAME-OF-BRANCH: could be "master" or an existing branch)

Create a branch

Spaces won't be recognized, so you need to use a hyphen or underscore.

git checkout -b NAME-OF-BRANCH

Work on a branch that has already been created

git checkout NAME-OF-BRANCH
Note: If you cant see the branch name, try doing a git fetch

View the changes you've made

It's important to be aware of what's happening and what's the status of your changes.

git status

Add changes to commit

You'll see your changes in red when you type "git status".

git add CHANGES IN RED git commit -m "DESCRIBE THE INTENTION OF THE COMMIT"

Send changes to gitlab.com

git push REMOTE NAME-OF-BRANCH

Delete all changes in the Git repository, but leave unstaged things

git checkout .

Delete all changes in the Git repository, including untracked files

git clean -f

Merge created branch with master branch

You need to be in the created branch.

git checkout NAME-OF-BRANCH git merge master

Delete the most recent commit, keeping the work you've done:

git reset --soft HEAD~1

Delete the most recent commit, destroying the work you've done:

git reset --hard HEAD~1


Revert all local changes in Git managed project to previous state?

Here the current bash script for doing it

#!/bin/sh
git reset --hard
git clean -f -d
git checkout -- HEAD

Run from root directory of your working copy

View changes from a particular commit hash

> git whatchanged <commithash>

Eg: git whatchanged 7137bd79d787ffe80f86dab3a9f415c23c274673

 

Tags:

HTML5 validation in Angular

by Admin 4. December 2014 00:05

Angular leverages HTML5 validation attributes and new HTML5 form elements. If we want Angular to handle validation we need to first stop HTML5 to do validation.
To do this specify “novalidate” attribute on the form tag.
<form name="frm1" novalidate>
-----
-----
</form>

So now the HTML will not fire any validations, instead it will be route to the Angular engine to take actions.
In other words when end user fills data in the HTML UI , validation events are routed to Angular framework, depending on scenario Angular sets a field called as “$Valid”. So if the validations are fine it sets it to “True” or else its sets it to “False”.

Tags:

Angular Autocomplete

by Admin 28. October 2014 03:53

<div ng-app='MyModule'>
    <div ng-controller='DefaultCtrl'>
        <input auto-complete ui-items="names" ng-model="selected">
        selected = {{selected}}
    </div>
</div>

DefaultCtrl

function DefaultCtrl($scope) {
    $scope.names = ["Aiden","Jackson","Ethan","Liam","Mason","Noah","Lucas","Jacob","Jayden","Jack","Logan","Ryan","Caleb",
"Benjamin","William","Michael","Alexander","Elijah","Matthew","Dylan","James","Owen","Connor","Brayden",
"Carter","Landon","Joshua","Luke","Daniel","Gabriel","Nicholas","Nathan","Oliver"];
}

angular.module('MyModule', []).directive('autoComplete', function($timeout) {
    return function(scope, iElement, iAttrs) {
            iElement.autocomplete({
                source: scope[iAttrs.uiItems],
                select: function() {
                    $timeout(function() {
                      iElement.trigger('input');
                    }, 0);
                }
            });
    };
});

References:

 

https://material.angularjs.org/latest/demo/chips

https://ghiden.github.io/angucomplete-alt/#example1

http://ngmodules.org/modules/ngAutocomplete

Tags:

Search for a string in all the tables in SQL SERVER 2012

by Admin 14. June 2014 00:22

 

CREATE PROC SearchAllTables

(

@SearchStr nvarchar(100)

)

AS

BEGIN

 

    CREATE TABLE #Results (ColumnName nvarchar(370), ColumnValue nvarchar(3630))

 

    SET NOCOUNT ON

 

    DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)

    SET  @TableName = ''

    SET @SearchStr2 = QUOTENAME('%' + @SearchStr + '%','''')

 

    WHILE @TableName IS NOT NULL

 

    BEGIN

        SET @ColumnName = ''

        SET @TableName = 

        (

            SELECT MIN(QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME))

            FROM     INFORMATION_SCHEMA.TABLES

            WHERE         TABLE_TYPE = 'BASE TABLE'

                AND    QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) > @TableName

                AND    OBJECTPROPERTY(

                        OBJECT_ID(

                            QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME)

                             ), 'IsMSShipped'

                               ) = 0

        )

 

        WHILE (@TableName IS NOT NULL) AND (@ColumnName IS NOT NULL)

 

        BEGIN

            SET @ColumnName =

            (

                SELECT MIN(QUOTENAME(COLUMN_NAME))

                FROM     INFORMATION_SCHEMA.COLUMNS

                WHERE         TABLE_SCHEMA    = PARSENAME(@TableName, 2)

                    AND    TABLE_NAME    = PARSENAME(@TableName, 1)

                    AND    DATA_TYPE IN ('char', 'varchar', 'nchar', 'nvarchar', 'int', 'decimal')

                    AND    QUOTENAME(COLUMN_NAME) > @ColumnName

            )

 

            IF @ColumnName IS NOT NULL

 

            BEGIN

                INSERT INTO #Results

                EXEC

                (

                    'SELECT ''' + @TableName + '.' + @ColumnName + ''', LEFT(' + @ColumnName + ', 3630) 

                    FROM ' + @TableName + 'WITH (NOLOCK) ' +

                    ' WHERE ' + @ColumnName + ' LIKE ' + @SearchStr2

                )

            END

        END    

    END

 

    SELECT ColumnName, ColumnValue FROM #Results

END

Tags:

May 2019 Tenants maintenance

by Admin 22. May 2014 11:29

 

Tags:

The launch of the uk replica watches new timepiece series undoubtedly symbolizes the replica watches history of the brand, and the classic hublot replica watches design explains the mission of the replica watches uk brand's precision watchmaking.

TextBox

Tag cloud

    RecentPosts