• Home
  • Interview Questions ↓
    • ASP.NET CORE
    • ASP.NET WebForm
    • ASP.NET MVC
    • SQL
    • ANGULAR
  • Tech Feed
  • About ↓
    • About ♥
    • Services
    • Partner Site ®
    • Privacy Policy
  • Corona Updates
  • Write To Us

BINKOD

Bring up. Develop in oneself. Be in touch with the latest technologies.

When Google Chrome adds a suggestion as soon as you type the first few letters, it intends to be helpful. But, some users might find this annoying since it might add the wrong information. The suggested information might make you lose sight of what you were typing, and you would rather turn it off. Keep reading to see how easy it is to turn it off.

How to Turn off Autocomplete searches and URLs on Chrome

1. To stop Chrome from auto-filling the URL, you’ll need to click on the three dots at the top right. Go to Settings



2. On the next page, click on the Sync and Google services.




3. Scroll down a bit until you come across the Autocomplete searches and URLs option. Toggle off the option to the right.


You can look for what you need without unwanted suggestions by turning off the suggested search results. You’ll only see what you type without anything distracting you. Share your thoughts in the comments below, and don’t forget to share the article with others on social media.


 Autocomplete is a very useful Sublime Text feature. The program uses your input to create a database of word combinations and strings that you frequently use. When it detects you are about to use a string you used before, Sublime Text displays the corresponding autocomplete suggestions. But sometimes, autocomplete suggestions may not be available in Sublime Text. This guide brings you four potential solutions to help you solve this problem.

Tweaks To Fix AutoComplete Not Working Issue

1. Set autocomplete to 'True'

First of all, make sure the autocomplete feature is enabled. 

Go to Preferences > Settings. The “auto_complete”: true parameter needs to be visible in your settings.

If you have a syntax-specific settings file with the auto_complete value set to false, this may explain why the feature is not working. Do check your custom CSS syntax file if you have one.

2. Change the file type to HTML

Another possible explanation as to why the Sublime Text autocomplete feature is not working involves your file type settings.

If your file type is set to plain text, you need to change it to HTML in order to restore the autocomplete functionality.

3. Tweak your auto_complete_selector settings

Alternatively, you can also try to add the following string to Preferences > Settings – User file: “auto_complete_selector”: “source, text”,

Another users utilized the following string to re-enable autocomplete in Sublime Text: “auto_complete_selector”: “text, comment, string, meta.tag – punctuation.definition.tag.begin, source – comment – string.quoted.double.block – string.quoted.single.block – string.unquoted.heredoc”

4. Manually display autocomplete suggestions

Another workaround is to manually display the autocomplete suggestions by pressing CTRL + Space to show the completion popup.

And these are the methods to restore the autocomplete functionality in Sublime Text.

 The Autocomplete feature in Microsoft Visual Studio is a great feature but can be an annoyance at times. You can turn it off using following options:

Option 1 – Turn Off Once

When the autocomplete window appears, press the “Escape” key to close it.

Option 2 – Disable Completely

  1. Visual Studio, select “Tools” > “Options“.
  2. Select “Text Editor” in the left pane.
  3. Select the language you are using (C#, C++, Basic, etc.).
  4. For C# and Basic, choose “IntelliSense“. For C or C++, choose “Advanced“, then scroll to the “IntelliSense” section.
  5. For C# and Basic, check the “Show completion list after a character is typed” to disable it. For C/C++, you will have a few options, such as “Disable Auto Updating“, “Disable Squiggles“, and “Disable #include “Auto Complete“. Set any of these to “True” to turn them off.


 Sometime you messed up with Microsoft Visual Studio IDE settings and you want to reset all of them to default settings, so here are the steps to reset all settings:

1. From within Visual Studio, select the “Tools” menu, then choose “Import and Export Settings…“.




2. Select “Reset all settings“, then select “Next“.



3. If you wish to save your existing settings, select “Yes, save my current settings“. Otherwise select “No, just reset settings, overwriting my current settings“. Select “Next” once you have chosen.




4. Choose the default collection of settings you wish to reset to. In most cases, you’ll want to choose “General“. Select “Finish” once you have chosen, and you’re done!







You can pass any type of data as parameters to a stored procedure. A stored procedure is a SQL code that you can execute over and over again. The stored procedure can act based on the parameter value(s) that is passed. 

It's easy to pass integer or string type of data but the question is "how can we pass a list of parameters to a stored procedure?". So the answer is "Table-Valued Parameters aka TVPs".  

A table-valued parameter is a parameter with a table type. Using this parameter, you can send multiple rows of data to a stored procedure or a parameterized SQL command in the form of a table. Transact-SQL can be used to access the column values of the table-valued parameters. Table-valued parameters are declared by using user-defined table types. You can use table-valued parameters to send multiple rows of data to a Transact-SQL statement or a routine, such as a stored procedure or function, without creating a temporary table or many parameters.

Passing Table-Valued Parameters to a stored procedure in the following steps:

  1. Create a User-defined table type that corresponds to the table that you want to populate.
  2. Pass the User-defined table to the stored procedure as a parameter
  3. Inside the stored procedure, select the data from the passed parameter and insert it into the table that you want to populate.

1. User-defined table types

User-defined table types are the predefined tables that the schema definition is created by the users and helps to store temporary data. User-defined table types support primary keys, unique constraints and default values, etc. Here is an example :

CREATE TYPE ChapterType AS TABLE (

  Id   INT, 

  Name VARCHAR(128)

)

When we execute the above query, we can see the created user-defined table type under the User-Defined Table Types folder in SQL Server Management Studio (SSMS).

2. Using Table-Valued Parameters in Stored Procedures

Table-Valued Parameters reference their types from the user-defined table so they inherit the schema of the table. The multiple parameter values can pass as an input to the stored and then they can be handled by the stored procedure.

In this first example, we will insert multiple rows into a table with the help of Table-Valued Parameters. Firstly, we will create a table whose name is Lesson.

CREATE TABLE Chapters ( 

    Id    INT PRIMARY KEY, 

    Name  VARCHAR(50)

)

Now let’s create a stored procedure that accepts the ChapterType variable as a parameter. Inside the stored procedure, we will SELECT all the records from this variable and insert them into the Chapter table. Here is an example:

CREATE PROCEDURE  uspAddChapters

@ChapterList ChapterType READONLY

AS

BEGIN

    INSERT INTO Chapters

    SELECT * FROM @ChapterList

END

Note: The Table-Valued Parameter must be declared as read-only. The reason for this usage method is that we cannot make any manipulation (INSERT, UPDATE, DELETE) on the TVP in the routine body.

3. Executing Stored Procedure with Table-Valued Parameters

The final step is to create a variable of the ChapterType, fill it with some data and pass it to the stored procedure. Here is an example:

DECLARE @ChapterType ChapterType

INSERT INTO @ChapterType VALUES (1, 'Chapter One')

INSERT INTO @ChapterType VALUES (2, 'Chapter Two')

INSERT INTO @ChapterType VALUES (3, 'Chapter Three')

INSERT INTO @ChapterType VALUES (4, 'Chapter Four')

EXECUTE  uspAddChapters @ChapterType

Then the table variable is passed as a parameter to the Stored Procedure and the Stored Procedure is executed which finally inserts the records into the Chapters Table.


 JSON (JavaScript Object Notation) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects. 

Douglas Crockford originally specified the JSON format in the early 2000s.


Comments in JSON

Comments were intentionally excluded from JSON. 

In 2012, Douglas Crockford described his design decision thus: 

"I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability." 

The JSON is data only, and if you include a comment, then it will be data too. You could have a designated data element called "_comment" (or something) that should be ignored by apps that use the JSON data. You would probably be better having the comment in the processes that generate/receives the JSON, as they are supposed to know what the JSON data will be in advance, or at least the structure of it.

For example:

{

    "_comment": "comment text goes here...",

    "user": {

          "title": "Mr.",

          "firstname": "ravi",

          "lastname": "bhushan",

          "address": {

                 "city": "xyz",

          }

    }

}


JSON does not support comments. It was also never intended to be used for configuration files where comments would be needed. 

In few simple words, fetch gets the latest data, but not the code changes and not going to mess with your current local branch code, but pull get the code changes and merge it your local branch.


git fetch

It will download all refs and objects and any new branches to your local Repository. It updates your local copy of the repository but does not modify any files in the working directory. It simply makes sure that the cached info it has about the repository you fetched is up-to-date.

You fetch when you want to see any updates on the remote, but you don't want to immediately integrate any such changes into the current branch.


git pull

It will apply the changes from remote to the current branch in local. A git pull is what you would do to bring a local branch up-to-date with its remote version, while also updating your other remote-tracking branches. 

When you use pull, Git tries to automatically merge. It is context-sensitive, so Git will merge any pulled commits into the branch you are currently working on. pull automatically merges the commits without letting you review them first. If you don’t carefully manage your branches, you may run into frequent conflicts.

Want to know, how to delete a Git branch locally and remotely. Click below link

https://www.binkod.in/2021/08/deleting-git-branch-locally-and-remotely.html


 It is simple to delete a Git branch. We can delete a Git branch locally and remotely with simple git commands. 

It is common to have different branches. There is a great way to work on different features and fixes. Repos often have a master branch for the main codebase and developers create other branches to work on different features. Once work is completed on a feature, it is often recommended to delete the branch.


Deleting a branch Locally:

git branch -d <branch>

e.g.   git branch -d task/story_1

The -d option is an alias for --delete, which only deletes the branch if it has already been fully merged in its upstream branch. 


Deleting a branch Remotely:

git push <remote> --delete <branch>

e.g.   git push origin --delete task/story_1

The branch is now deleted remotely



 If you’re using Elementor, you should exclude its preview mode by using the value \?(p=.|elementor-preview=|.preview=true) in your exclusion rule.

Here are the steps to create a simple ‘Custom Filter’.

  1. To create a filter, navigate to your Analytics Admin page.
  2. Select the relevant Account, Property, and View
  3. Under the View column, click on ‘Filters’
  4. Click ‘Add Filter’
  5. Give the filter a descriptive name, e.g. ‘Exclude My Internal Traffic’
  6. Select the Filter Type ‘Custom’
  7. Set the type to ‘Exclude’
  8. Set the Filter Field to ‘Request URI’
  9. Paste in the value \?(p=.*|preview=true)
  10. Save the filter



Here are some more filter examples:

\?(p=.|elementor-preview=|.preview=true)

\?(p=.|.*elementor-preview=|.*preview=true|.*elementor-block=)



In Angular 11, to configure or enable HMR is a bit easy now, efforts you need to configure the HMR has been reduced drastically. Now we've CLI command for that as well. In version 11 we’ve updated the CLI to allow enabling HMR when starting an application with ng serve.

Hot Module Replacement (HMR) 

Hot Module Replacement is a mechanism that allows modules to be replaced without a full browser refresh.

Now you can simply use the ng serve command with an hmr tag to enable HMR:

ng serve --hmr

After the local server starts the console will display a message confirming that HMR is active, HMR will be enabled for the dev server.

Go through https://webpack.js.org/guides/hot-module-replacement for more details on working with HMR for webpack.

Now during development, the latest changes will be instantly updated into the running application. All without requiring a full page refresh. By using the HMR technique the application development becomes faster as fewer resources are loaded after saving the changes in the project.


 In this article, we will talk about Fluent Validation and it’s implementation in ASP.NET Core Applications. We will discuss the preferred alternative to Data Annotations and implement it in an ASP.Net core API. Traditionally, most validation in .NET is done using Data Annotations. There are a few issues with the old approach:

  • Our model can get “bloated”
  • Extensibility is limited
  • Testing isn’t the nicest experience

To address some of these concerns, instead, we’re going to utilize a .NET library called FluentValidation to perform validation for our classes.

FluentValidation?

FluentValidation is a validation library for .NET used for building strongly type validation rules for your business objects. Fluent validations uses lambda expressions to build validation rules. FluentValidation supports integration with ASP.NET Core 2.1 or 3.1 (3.1 recommended). 

To enable MVC integration, you’ll need to add a reference to the FluentValidation.AspNetCore assembly by installing the appropriate NuGet package. From the command line, you can install the package by the following command:

> dotnet add package FluentValidation.AspNetCore

Configuring FluentValidation: Once installed, you’ll need to configure FluentValidation in your app’s Startup class by calling the AddFluentValidation extension method inside the ConfigureServices method.

public void ConfigureServices(IServiceCollection services)
{
services.AddControllers()
.AddFluentValidation(s =>
{
s.RegisterValidatorsFromAssemblyContaining<Startup>();
s.RunDefaultMvcValidationAfterFluentValidationExecutes = false;
});
}

 In order to discover your validators, they must be registered with the services collection. 

       services.AddTransient<IValidator<TestModel>, TestModelValidator>();

For registering Validator, there are three ways -

  • Registering each validator in Service with AddTransient (above example).
  • Registering using “RegisterValidatorsFromAssemblyContaining” method registers all validators derived from AbstractValidator class within the assembly containing the specified type.
  • Registering using “RegisterValidatorsFromAssembly” method.
Using the validator in a controller: 
    Example TestModelValidator is defined to validate a class called TestModel. Once you’ve configured FluentValidation, ASP.NET will then automatically validate incoming requests using the validator mappings configured in your startup.

public class TestModel {
	public int Id { get; set; }
	public string Name { get; set; }
	public int Age { get; set; }
}

public class TestModelValidator : AbstractValidator<TestModel> {
	public TestModelValidator() {
		RuleFor(x => x.Id).NotNull();
		RuleFor(x => x.Name).Length(0, 10);
		RuleFor(x => x.Age).InclusiveBetween(18, 60);
	}
}
Now when you post the form, MVC’s model-binding infrastructure will validate the TestModel object with the TestModelValidator, and add the validation results to ModelState.
public class ExampleController : Controller {
	public ActionResult Create() {
		return View();
	}

	[HttpPost]
	public IActionResult Create(TestModel model) {
             // re-render the view when validation failed.
if(! ModelState.IsValid) { return View("Create", person); } return RedirectToAction("Index"); } }

Manual validation: 

There can be a case where you need to validate an object manually within your application using Fluent Validation.

IValidator<TestModel> _validator = new ObjAValidation(); 

var result = validator.Validate(objTestModel);

In Unit tests, you can setup the Validate method of IValidator with Moq in following way:

Mock<IValidator<TestModel>> _mockValidator = new Mock<IValidator<TestModel>>();
_mockValidator.Setup(x => x.Validate(new TestModel()));

FluentValidation provides a great alternative to Data Annotations in order to validate our models. FluentValidation integration and validation rules are easy to read, easy to use and easy to test.

After installing XAMPP and try to start the Apache server in the XAMPP Control Panel, sometimes you face error like Apache shutdown unexpectedly. The issue is caused because of other services like WordPress, IIS server or sometimes skype used the same port i.e 80 or 443 on the machine you are using.

Try following below steps to resolve the issue:

Step 1 - From the XAMPP Control Panel, under Apache, click the Config button, and select the Apache (httpd.conf).

Inside the httpd.conf file, a line that says:

Listen 80

And change the 80 into any number/port you want eg. port 8080.

Listen 8080

Now check httpd.conf file for another line that says:

ServerName localhost:80

Change 80 to 8080.

ServerName localhost:8080


Step 2 - From the XAMPP Control Panel, under Apache, click the Config button again, but this time select the Apache (httpd-ssl.conf). Inside the httpd-ssl.conf file, find line that says

Listen 443

And change the 443 into any number/port you want eg. 4433 as the new port number.

Listen 4433

Still from the httpd-ssl.conf file, find another line that says

<VirtualHost _default_:443>

ServerName localhost:443

And change 443 to 4433.

<VirtualHost _default_:4433>

ServerName localhost:4433


Remember to save the httpd.conf and httpd-ssl.conf files after performing some changes. Then restart the Apache service.

Hope this will resolve your issue.

 Sometime there may be cases when we need to know the current branch we are working with. There are a number of ways to get the name of the current branch.

Most cronical way to displays the full refspec:

git symbolic-ref HEAD

To show only the branch name (Git v1.8 and later):

git symbolic-ref --short HEAD

On Git v1.7+ you can also use the following command:

git rev-parse --abbrev-ref HEAD

or with Git 2.22 and above:

git branch --show-current



 GitHub uses the email address set in your local Git configuration to associate commits pushed from the command line with your GitHub account. You can change the email address that is associated with your Git commits. git config command is used to change the user.email associated with commits. The new email address you set will be visible in any future commits you push to GitHub, changing the email associated with your Git commits using git config will only affect future commits and will not change the email used for past commits.

Changing your Git email for every repository (globally):

1) Open Git Bash or Terminal. 

2) Set an email address in Git. You can use any email address.:

$ git config --global user.email "your-name@zzz.zzz"

3) Confirm that you have set the Git username correctly:

$ git config --global user.email

> your-name@zzz.zzz

4) Add the email address to your GitHub account by setting your commit email address on GitHub, so that your commits are attributed to you and appear in your contributions graph.


Changing your Git username for a single repository:

1) Open Git Bash and Terminal.

2) Change the current working directory to the local repository where you want to configure the email address that is associated with your Git commits.

3) Set an email address in Git. You can use any email address.:

$ git config user.email "your-name@zzz.zzz"

4) Confirm that you have set the Git email address correctly:

$ git config user.email

> your-name@zzz.zzz

5) Add the email address to your GitHub account by setting your commit email address on GitHub, so that your commits are attributed to you and appear in your contributions graph.

 Git uses a username to associate commits with an identity. You can change the name that is associated with your Git commits. git config command is used to change the user.name & email associated with commits. The new name you set will be visible in any future commits you push to GitHub, changing the name associated with your Git commits using git config will only affect future commits and will not change the name used for past commits.

Changing your Git username for every repository (globally):

1) Open Git Bash or Terminal. 

2) Set a Git username:

$ git config --global user.name "your-name"

3) Confirm that you have set the Git username correctly:

$ git config --global user.name

> your-name


Changing your Git username for a single repository:

1) Open Git Bash and Terminal.

2) Change the current working directory to the local repository where you want to configure the name that is associated with your Git commits.

3) Set a Git username:

$ git config user.name "your-name"

4) Confirm that you have set the Git username correctly:

$ git config user.name

> your-name

Older Posts Home
Angular Angular 11 ASP.NET Core Asp.Net Core deployement Asp.Net Framework Asp.Net MVC C# C# 8 Chrome Chrome Browser Custom Error mode in Web.Config file - C# ASP.Net Excluding Internal Traffic Facts that all ASP.NET vNext developers need to know Fluent Validations Git Git Commands git fetch git pull GitHub Google AdSense Google Analytics Google Chrome HTTP Error 500.23 - Internal Server Error JSON Latest News MS SQL Server SQL Nested Queries | SQL Sub Queries SQL Server SQL Server DBA Roles and Responsibilities SQL TRIM Functions - LTRIM and RTRIM Sublime Text Sublime Text Autocomplete Sublime Text Editor Table-Valued Parameters Tech Feed Temporary Tables in SQL Server - Local & Global Top ASP.NET Interview Questions and Answers Use of Case Expression in SQL Server with Example Use of SELECT statement in SQL Server Using SQL Server Cursors - General concepts Visual Studio 2017 Visual Studio 2019 Visual Studio 2022 Visual Studio Settings Windows Windows 10 WordPress

Hot Topics

  • ASP.NET Core (7)
  • Asp.Net Core deployement (4)
  • Asp.Net Framework (6)
  • Asp.Net MVC (3)
  • MS SQL Server (9)
  • SQL Server DBA Roles and Responsibilities (1)
  • Tech Feed (7)
  • Top ASP.NET Interview Questions and Answers (1)
  • Using SQL Server Cursors - General concepts (1)
BINKOD. Powered by Blogger.
Copyright © 2015-2020 BINKOD.
BINKOD | BINKOD.INFO@GMAIL.COMbinkod