MQTT C#

Basically all you need can be found here. Tested and it worked with mosquitto

https://github.com/chkr1011/MQTTnet/wiki/Client

here is working sample to send message:

var client = new MqttFactory().CreateMqttClient();
var options = new MqttClientOptionsBuilder()
.WithClientId($"HomeMessenger1")
.WithTcpServer("192.168.1.10", 1883)
.WithCredentials("bud", "%spencer%")
//.WithTls()
.WithCleanSession()
.Build();

 System.Threading.CancellationToken cancellationToken;
        await client.ConnectAsync(options, cancellationToken);

        var message = new MqttApplicationMessageBuilder()
            .WithTopic("Home/gate")
            .WithPayload("H")
            .WithExactlyOnceQoS()
            .WithRetainFlag()
            .Build();
        await client.PublishAsync(message, cancellationToken);    

develop Notepad++ plugins (in c#).

Notepad++ is awesome and you should be too, by developing plugins for it. To do so:
1) Go to notepad++ website, resource section (at least it was called it so back in 2020).
2) Find section about developing plugins, and options for other languages, select your language of choice.
3) Find “visual studio project template” zip archive, download it and copy it under your documents/Visual Studio 20xx/Project Templates
4) Open VS, create new project and search for “Notepad++” project template, it will create you nice “Hello plugin” sample.
Note: It might not showup. If everything fails, just search for example projects on same plugin page and use it as a template for your project.

useful sample to cover most needs

IntPtr currentScint = PluginBase.GetCurrentScintilla();
ScintillaGateway scintillaGateway = new ScintillaGateway(currentScint);

int numLines = scintillaGateway.GetLineCount(); 
StringBuilder endResult = new StringBuilder();
for (int lineIndex = 0; lineIndex < numLines; lineIndex += 1)
{                   
   string sourceData = scintillaGateway.GetLine(lineIndex);
   endResult.AppendLine(DoMyTransform(sourceData));
}
scintillaGateway.SetText(endResult.ToString());

Posting with Windows Auth

Problem:
Asp.net core controller method:

[HttpPost]
[Route(“/api/startwf”)]
public async void StartWorkflow([FromBody] WFInitiationDataModel model)

Use powershell to test it:

$data = @{
    "sysName" = "LTPS"        
}

$payload = ConvertTo-Json $data

$url = "http://localhost:5000/api/startwf"
Write-Host "POST:$url"


$response = $payload | Invoke-WebRequest -uri $url -Method Post -UseDefaultCredentials -ContentType "application/json" -TimeoutSec 21600

Unity physics

If you want to use physics engine for your object (gravity, forces), make sure to add Rigidbody compoment. To interact with other physics objects attach collider object.
Rigitbody properties:
Mass – helps to figure out winner of collision
Drag – how quickly it will come to rest.
Angular Drag – rotation friction (opposite torque)
Use Gravity – impacted by general gravity or not. (Edit->ProjectSettings->Physics)
Is Kinematic – will rigidbody react to physics. Physics objects that affects others, but are not affected themselves. Translate updates collision data when object is moved. Static objects cause all objects to be reevaluated.
Interpolate – solve jittering if it was created by moving rigidbody. Interpolate smoothes transform based on previous frame. Extrapolate – smoothes based on predicted next frame.
Collision Detection – type of detection. Continuous for fast moving objects that are interacting with static geometry. Continuous Dynamic – fast moving and interacting with other dynamic objects.
Constraints – possible to lock axes for position or rotation.
https://unity3d.com/learn/tutorials/topics/physics/rigidbodies

AddForce(Vector3 direction & magnitude, [ForceMode mode]) – move object by adding forces;
mode:
Acceleration – continuous changes not affected by mass,
Force(default) – for continuous changes affected by mass,
Impulse – instant change affected by mass,
VelocityChange – instant change not affected by mass.
Forces ar dampened by rigidbody drag property.

AddTorque(Vector3 torque, [ForceMode mode]) is similiar for rotations

p.s transform.forward – shortcut to z axis of localspace of object.
Physics materials describes surface of object for friction and how object material affects it – like tenis ball vs. bowling ball

Blender models in unity shows as documents

For some weird reason, after opening unity project, suddenly blender models were shown as documents not models. Existing scene objects reports to be missing. Solutions:
1) Try reseting model in unity (this helped for me)

2) Reimport the resources (right click on asset > import all).
3) Still nothing? reinstall blender with admin rights, try step 1 again.