display – Can’t activate 1280 * 720 scaling on my 2K external monitor but 1280 * 800 works

I’m using a Lenovo 1440p display on my MBP through a DP to TB3 cable. The UI looks way too small on the native resolution so I’d like to achieve a 2x scaling to 1280 * 720. However, it seems I just can’t enable 1280 * 720 for some reason, but 1280 * 800 works (although with the black bars on the side because it’s 16:10 on a 16:9 monitor.)enter image description here

In SwitchResX, I can see the 1280*720 HiDPi option but notice that the “scaled” checkbox is unchecked while it should be checked, and selecting it doesn’t do anything.

Can anyone spot the problem here?

applications – Is there any way to simulate an external input device (Mouse / Keyboard)?

i’m working on a project where i’m going to link 2 devices together, one desktop and one android, desktop is going to send mouse coords / keystrokes to the android device and it will simulate mouse moves / keystrokes. Is there any way to do it? Searched on google but no dice.
pseudocode:

mouse mouse1;
while(True) 
{
    mouse1 = host.mouse.getevents.mousecoords();
    this.simulatedmouse.Coords = mouse1.Getcoords();
}

SQL Server & SSDT : Error modeling database during Publish after adding CREATE AGGREGATE / EXTERNAL NAME

I am using SSDT to create a database containing CLR user defined aggregates.

The aggregates are intended to sit in different schema. That is not possible with CLR objects inside SSDT, without using a post-deployment script to move the objects after deployment.

What I am attempting to do is:

  • Create the CLR aggregates in a single schema (the “CLR” schema) using the “Default schema” option
  • Use a CREATE AGGREGATE wrapper in the desired schema to call the CLR aggregate

For example, I have a CLR aggregate like:

(Serializable)
(Microsoft.SqlServer.Server.SqlUserDefinedAggregate(Format.UserDefined, MaxByteSize = -1))
public struct StatsEntropy : IBinarySerialize
{
 ... etc
}

This get compiled and becomes CLR.StatsEntropy in the database. The database is called AnalysisFunctions, so it has an assembly also called AnalysisFunctions. This is no problem.

I then create a wrapper in the Stats schema like so:

CREATE AGGREGATE (Stats).(Entropy)
(
    @Values FLOAT
)
RETURNS FLOAT
EXTERNAL NAME AnalysisFunctions.StatsEntropy

This works without error when I build via debug. I have my debug connection set to a named instance of SQL Server. If I press F5, it compiles and deploys without any problem. The code is now usable on the server, including the wrapper.

But, if I attempt to publish to a server using Publish, it does not work. Instead it fails with:

Errors occurred while modeling the target database. Deployment cannot continue.

There are no further error messages either in the Data Tools Operations panel or error list. ssdttrace shows no useful information:

ssdttrace event log

This only happens when the database already exists on the server. If I drop the database, it can deploy successfully. I can deploy successfully via debug even if the database already exists, it is only via Publish that the problem occurs. I did not start getting this problem until I added the aggregate wrappers.

Previously I was also getting errors indicating that the assembly AnalysisFunctions had an unresolved reference due to the use of EXTERNAL NAME – again working via debug, not via publish. But now that error has mysteriously vanished.

I am using Visual Studio 2017 15.9.21 and SSDT 15.1.62002.01090, deploying to SQL Server 2019.

Does anyone have any idea what this error might be, or how I can debug it?

unity – Apply external effects to player movement

In a 2D downhill game with the following, custom movement code, how do I apply external effects to the player’s movement?

For example, when the player hits an obstacle, I want them to get bounced off the obstacle and briefly stop before they are able to continue moving. How do I best integrate those types of external effects into my movement code in a way that is scalable?

private void UpdatePlayerVelocity()
{
    // Calculate the player's vertical movement speed
    float speedY = maxSpeed.y * Time.fixedDeltaTime;

    // Calculate the player's horizontal movement speed
    float speedX = inputDirectionX * maxSpeed.x * Time.fixedDeltaTime;

    // Set the player's new velocity
    rb.velocity = new Vector2(speedX, speedY);
}

My player-obstacle collision is handled in the obstacle class, and I am using an action to notify the player about the collision. So I have the ability to have a corresponding method in the player class that get’s called when the collision occurs:

public void OnPlayerCollidedWithObstacle(Vector2 collisionNormal)
{
    // TODO:
    // Integrate the following into the above movement code ???
    // 1. Bounce the player off the obstacle
    // 2. Briefly stop the player from moving
    // 3. Continue moving when the player has tapped the screen
}

As a first step, I am thinking to wrap my default movement code in a bool check, so that it doesn’t get run when the collision movement code is run.

However, I was hoping for a better, more scalable way?

PS: I would like to keep my movement code custom, so no Unity physics / AddForce / etc.


Update – Here is my attempt:

The following works. However, I am wondering if there is a cleaner / more systematic / more scalable way to handle this?

private void UpdatePlayerVelocity()
{
    // If no player-obstacle collision
    // and player has tapped to start/continue moving
    if (obstacleCollisionTimer <= 0 && playerHasTapped)
    {
        // Calculate the player's vertical movement speed
        float speedY = maxSpeed.y * Time.fixedDeltaTime;

        // Calculate the player's horizontal movement speed
        float speedX = inputDirectionX * maxSpeed.x * Time.fixedDeltaTime;

        // Set the player's velocity
        rb.velocity = new Vector2(speedX, speedY);
    }
    // If player-obstacle collision resolved,
    // but player has not yet tapped to continue moving
    else if (obstacleCollisionTimer <= 0 && !playerHasTapped)
    {
        // Don't move
        rb.velocity = Vector2.zero;
    }
    // If currenty resolving player-obstacle collsion by bouncing player off
    else
    {
        rb.velocity = new Vector2(-collisionNormal.x, -collisionNormal.y);

        obstacleCollisionTimer -= Time.fixedDeltaTime;
    }
}

public void OnPlayerCollidedWithObstacle(Vector2 collisionNormal)
{
    // Collision normal will be used to bounce the player off the obstacle
    this.collisionNormal = collisionNormal;

    // Duration of the "bounce off" movement
    obstacleCollisionTimer = 0.2f;

    // The player needs to tap for movement to start again
    playerHasTapped = false;            
}
```

macos – D6000 Dock with OS X Catalina 2 external monitors

I have two 27 inch monitors connected to a D6000 dock which connects to a Thunderbolt 3 port on a Mac though it is USB C from the d6000. The Mac is a 2020 Mac book pro. The D6000 is supposed to support OS X.

But the two external monitors mirror each other, I want them to extend

the 2020 Mac book pro is supposed to support two external monitors

New 13-inch MacBook Pro comes with 6K monitor support, Dolby Atmos playback, more

but the two monitors just mirror each other and don’t extend.

the mirroring check box is not checked

mobile – Best practice handling external jwt in a server

I’m currently building a mobile app using the Spotify Web Api.

The thing is, I need the mobile app to only get the authorization code and then send it to the server since the server will call the Spotify web api when needed.

So the server is responsible for getting the access token and refresh token and refresh them as needed.

Here’s a diagram of what I’m thinking:

enter image description here

Reading the Spotify Documentation I’ve seen that they also recommend using PKCE when building mobile apps. But I’m not sure how this would work in my case. I would need to generate the code_verifier in the mobile app but also send it to my server.

I guess my question would be, does my flow make sense? Is it ok to store the user’s access_tokens and refresh_tokens in my DB and use them as needed?

partition – Encrypt external drive without format, no finder option

I have a LaCie Rugged 4TB drive that I want to encrypt. It’s partitioned in two, 3,8TB “Rugged” (Mac OS Extended Journaled) and 200GB “Transfer” (ExFAT). I want to encrypt the “Rugged” partition.

Quick backstory, I formatted the partition using Mac OS Extended (Journaled, Encrypted), copied everything from another drive (that this new one is replacing) and was happy as 🙂 However, I accidentally started decrypting it when I set up TM, so I’ve spent the last 3 days waiting for it to decrypt :/
Now I want to re-encrypt the drive again, without formatting (as I don’t have access to the previous drive anymore), but I don’t have a Finder option to encrypt when right-clicking the partition.
I’ve read that this can be caused by using the wrong type of partition map, however in Disk Util the parent LaCie drive shows Partition Map: GUID.

Is there another way to encrypt the partition without formatting?

c# – Is it wise to use SemaphoreSlim to run external process in async way?

I have the following source code which is supposed to start a process for you in an async way (i.e. letting you add a cancel token):

using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;

namespace ProcessAsync
{
    class Program
    {
        static async Task Main(string() args)
        {
            var cts = new CancellationTokenSource();

            cts.CancelAfter(3000);
            (string response, int exitCode) p = await SendCommandAsync(cts.Token);

            Debug.WriteLine(p.exitCode);
            Debug.WriteLine(p.response);
        }

        public static async Task<(string response, int exitCode)> SendCommandAsync(CancellationToken cancel)
        {
            using var signal = new SemaphoreSlim(0, 1);
            using var process = new Process()
            {
                StartInfo = { FileName = @"C:WINDOWSsystem32ping.exe", Arguments = "-n 500 8.8.8.8", RedirectStandardOutput = true },
                EnableRaisingEvents = true
            };
            process.Exited += (object sender, EventArgs e) => signal.Release();
            process.Start();

            try
            {
                await signal.WaitAsync(cancel).ConfigureAwait(false);
            }
            catch (OperationCanceledException ex)
            {
                if (!process.HasExited)
                {
                    throw new TaskCanceledException("Waiting for process exiting was canceled.", ex, cancel);
                }
            }

            string output = await process.StandardOutput.ReadToEndAsync().ConfigureAwait(false);

            return (output exitCode: process.ExitCode);
        }

    }
}

I have written the code to get some feedback on the use of SemaphoreSlim. I suspect it’s not ideal but I would love to hear your arguments.

This is not a production code it is not necessary to point out, for example, that @"C:WINDOWSsystem32ping.exe" should be a parameter.

Triple boot Macbook (Arch Linux and Ubuntu) from an external SSD

I have a 2015 MacBook Air and plan to triple boot MacOS, Arch Linux and Ubuntu by installing Arch and Ubuntu onto my SSD. I have looked at this thread and read about installing rEFInd onto the SSD so that the default macOS bootloader is left unchanged. I have also read through this article and plan to do something similar.

From the article I have read that you must install Windows first before installing Ubuntu. I completely understand how to install Ubuntu after installing Windows.

The part that I am confused about is how to do this but install Arch Linux instead of Windows. If possible I would like full list of steps of how to install Arch Linux on the SSD.

Thanks in advance!

TL;DR: Trying to triple boot Arch and Ubuntu from an external SSD using this article but I am unsure how to install Arch Linux first instead of Windows.

Note: I am fine using other methods of triple-booting Arch and Ubuntu as long as it doesn’t make changes to my mac.

MacBook Info

Model: 2015 MBA

macOS Version: Catalina (10.15.3)

vpn – OpenVPN: test security from external point of view

How would I test an OpenVPN environment from external, kind of black box pentest.
I have the public server-IP (port 1194, udp, tun).

I have found NO online ressources on how to do that, or whether some tools are available (e.g. for IPsec there is the ike-scan tools), nmap has no scripts for that, metasploit has no plugins, kali has no tools (only OpenVAS looks like it has a module, didnt try that yet).

Is there any way to test or analyse the security of OpenVPN from an external point of view?