Set a keyboard shortcut in Options -> Environment -> Keyboard
Search for the command: SolutionExplorer.SyncWithActiveDocument.
Se images below:
Unitverse C# Unit Test Generator (VS2022) – Visual Studio Marketplace
marketplace.visualstudio.com/items?itemName=MattWhitfield.UnitverseVS2022
Structure Your React Apps Like It’s 2030
blog.devgenius.io/structure-your-react-apps-like-its-2030-aef02097cb3
Common Design Patterns in C#
maherz.medium.com/10-essential-patterns-for-c-and-net-development-e9b881b9a6ba
Meld – Visual diff and merge tool (free/open-source)
Meld Visual diff and merge tool Meld helps you compare files, directories, and version controlled projects. It provides two- and three-way comparison of both files and directories, and has support for many popular version control systems. Meld helps you review code changes and understand patches. It might even help you to figure out what’s going on in that merge you keep avoiding.
Source: Meld
.NET Core API endpoint model validation
Example of simple method in an API controller for showing invalid posted model state.
[HttpPost("create")] public ActionResult<MyModel> Create([FromBody] MyModel model) { ValidateIncomingModel(); return myBusiness.Create(model); } private void ValidateIncomingModel() { if (!ControllerContext.ModelState.IsValid) { var errors = ControllerContext.ModelState.Keys .SelectMany(key => ControllerContext.ModelState[key].Errors .Select(x => key + ": " + x.ErrorMessage)); var message = string.Join("\n", errors); throw new Exception($"Not valid incoming model\n {message}"); } }
What is NgRx and why is it used in Angular apps?
Good intro to NgRx:
NgRx implements the Flux-Pattern. At a high level, it helps you unify all events and derive a common state in your Angular app. With NgRx, you store a single state and use actions to express state changes. It is ideal for apps with many user interactions and multiple data sources.
What problems does NgRx solve?
At a high-level, it mainly solves mainly the two main scenarios:
- Sharing data between different components
- A global state for the reuse of data
Sharing Data between different components
In a complex web application, you have different sections. Imagine the following scenario: In a web shop, you have an item list and your shopping cart. These two sections of the web shop are different component trees, probably in different Angular modules. In the item list, the user clicks on a particular item “Add to my cart”. After the click, the item appears in the shopping cart.
Read more:
https://www.workingsoftware.dev/what-is-ngrx-and-why-is-it-used-in-angular/
How to delete all node_modules files fast and simple for a repo
Run the following in the repo root folder: (deletes all node_modules folders and its content recursively):
npx rimraf ./**/node_modules
(Npx command is available from NPM version 5.2)
This might take som time since node_module usually contains a lot of files.
Load/stress testing .NET API with Apache JMeter
In this article, you’re going to dive into the universe of Apache JMeter, one of the most used agnostic load test tools in the software development community by testing it against a REST application created in ASP.NET.
How to set memory limit for ElasticSearch in Windows
Running elasticsearch on my local development machine takes up half of system memory by default. Here is instructions on how to change max memory size.
Prerequisites:
* Windows 10
* This instruction is for Elasticsearch version 7.16.2 but probably works on other versions as well
* Running elasticsearch.bat (in development mode not as a service)
Goto folder:
“C:\elasticsearch\elasticsearch-7.16.2\config\jvm.options.d\”
Create file:
“jvm.options” (normal text file, utf-8)
Setting for maximum of 4GB memory allocation:
-Xms4g -Xmx4g
Change both “4” values into other value if desired.
Restart elasticservice.bat
Instructions if running elasticsearch as a service on Windows:
You can set the memory limit for Elastic Search on Windows Server by following command:
[Elasticsearch Path]\bin>elasticsearch-service.bat manager
Note: Run command prompt as administrator
It will open manager as shown here: Image: ElasticSearch service properties
Now go to the ‘Java’ tab and change settings based on your requirement.
Note: Make sure, you changed it under ‘JavaOptions’ textbox and also for separate parameters. For example, to set 1GB initial memory pool and maximum memory pool, you can set ‘1024’ MB for both.
From: https://stackoverflow.com/questions/28798845/how-to-set-memory-limit-to-elasticsearch-in-windows