On Windows, you need to install nvm-windows
Category: Tips and tricks
Runing and debugging containerized applications in Visual Studio
Make sure you add the docker compose project file (.dcproj) into your solution, then you can run the whole application with one click with debug capabilities.
Setting it up with other development environments is another matter.
Docker desktop using all the RAM
Some applications will use as much resources as possible, like Elasticsearch.
If you are running Docker for development and it uses up all your resources because of such application, you can configure the Docker backend to limit the amount of resources it can use.
If your Docker desktop is using WSL2 as backend, create a .wslconfig file in your user home folder in Windows with the following content
[wsl2]
memory=6GB
processors=4
Then, restart the WSL backend in Powershell
Restart-Service LxssManager
This will also restart Docker Desktop.
This will limit the resources Docker will use to only 6GB RAM and 4 core processors, leaving resources for your other applications and development tools.
Cannot start Virtualbox VMs
Checklists
- Turn off Windows Feature: Containers
- Virtual Machine Platform
- Hyper-V
- Windows Hypervisor Platform
- Check if Virtualization is enabled in Bios, and disable it.
Be aware that things may stop working as there are updates.
Download older versions of Visual Studio Code
In case you need to work with old code that was not updated.
2019 version: https://code.visualstudio.com/updates/v1_33
Mouse integration does not work with Android VMWare machine through browser console
In the web UI of VMware, click console, then choose “Download VMware remote console”. You may have to sign up for a VMWare account to download.
This is a native remote client, the web remote console sometimes has issues with mouse integration with different guest OSes.
How to get raw query generated by Elasticsearch NEST library for debugging purpose
Source: https://stackoverflow.com/questions/28939022/get-raw-query-from-nest-client/50023531#50023531
For NEST / Elasticsearch.NET v6.0.2, use the ApiCall property of the IResponse object. You can write a handy extension method like this:
public static string ToJson(this IResponse response)
{
return Encoding.UTF8.GetString(response.ApiCall.RequestBodyInBytes);
}
Or, if you want to log all requests made to Elastic, you can intercept responses with the connection object:
var node = new Uri("https://localhost:9200");
var pool = new SingleNodeConnectionPool(node);
var connectionSettings = new ConnectionSettings(pool, new HttpConnection());
connectionSettings.OnRequestCompleted(call =>
{
Debug.Write(Encoding.UTF8.GetString(call.RequestBodyInBytes));
});
You need to call on the ES client connection setting object to allow reading request JSON. This is best done on DEBUG mode.
connectionSettings.DisableDirectStreaming(true)
Filtering by multiple conditions with nested queries in Elasticsearch
All bool queries are evaluated on a single document.
So if you have an index like this
Products= {
Fields: { Name: string; Value: int; }[];
}
And you want to find products with field “Price” between 10 and 20, and field “Discount” between 0 and 5, you can use the following query
bool: {
must: [
{nested: { //nested query to find products with price from 10 to 20},
{nested: { //nested query to find products with Discount from 0 to 5}
]
}
It looks quite hard to follow.
Generate an Ionic v3 app using later version of Ionic CLI
Use this command
ionic start ProjectName blank --type=ionic-angular
Inspect cordova Ionic Angular apps from latest version of Chrome
In the address bar, enter chrome://inspect
They changed how to do this.