Unitverse C# Unit Test Generator (VS2022) – Visual Studio Marketplace

The Unitverse extension generates tests for classes written in C#. The extension covers basic tests automatically (for example, checking for correct property initialization), and creates placeholder tests for methods. Unitverse aims to produce tests that compile
marketplace.visualstudio.com/items?itemName=MattWhitfield.UnitverseVS2022

Structure Your React Apps Like It’s 2030

Every React Developer meets one issue during his or her journey. This is how you construct an amazing app architecture. This blog post will teach you how to structure your directories correctly and avoid some common mistakes that most of us make when architecting react applications.
blog.devgenius.io/structure-your-react-apps-like-its-2030-aef02097cb3

Common Design Patterns in C#

Design patterns are reusable solutions to common problems that arise in software design. They are templates for solving design problems that have proven to be effective in various situations. They provide a common vocabulary and a shared understanding of best practices for developers, making it easier for them to communicate and collaborate on complex design problems.
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 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