问:
Multiple objects to single endpoint with asp.net
I'm building a Restful API with asp.net core. I have an endpoint that are used to authenticate users. I have two kinds of Users where one is an Admin and one is "FilmStudio". I succesfully managed to authenticte the User (Admin) but i also need to be able to authenticate the FilmStudio with username and password. Is there anyway I can do this with a single endpoint?

This is my endpoint form the UsersController:

```<code>        [AllowAnonymous]
        [HttpPost("Authenticate")]
        public IActionResult Authenticate([FromBody] UserDto model)
        {

            var user = _userRepo.Authenticate(model.UserName, model.Password);

            if (user !=null)
            {

                if (user == null)
                {
                    return BadRequest("The username or password is incorrect.");
                }

                return Ok(new
                {
                    Id = user.UserId,
                    Username = user.UserName,
                    Role = user.Role,
                    Token = user.Token
                });

            }
            else
            {
                var filmStudioDto = new FilmStudioDto();
                var studio = _studioRepo.Authenticate(model.Name, model.Password);
                if (studio == null)
                {
                    return BadRequest("The username or password is incorrect.");
                }

                return Ok(new
                {
                    Id = studio.StudioId,
                    Username = studio.Name,
                    City = studio.City,
                    Role = studio.Role,
                    Token = studio.Token
                });
            }
        }

    }
</code>```

When im giving the username and password for the admin user it works. However when im trying to enter the username and passwod for FilmStudio I allways get the error messsage that says: "The username or password is incorrect."

答:
```<code>[AllowAnonymous]
    [HttpPost("Authenticate")]
    public IActionResult Authenticate([FromBody] UserDto model)
    {
        if (model.UserName != null) // Check if UserName is null or not
        {
            var user = _userRepo.Authenticate(model.UserName, model.Password);
            if (user == null)
            {
                return BadRequest("The username or password is incorrect.");
            }

            return Ok(new
            {
                Id = user.UserId,
                Username = user.UserName,
                Role = user.Role,
                Token = user.Token
            });
        }
        else
        {
            var studio = _studioRepo.Authenticate(model.StudioName, model.StudioPassword);
            if (studio == null)
            {
                return BadRequest("The username or password is incorrect.");
            }

            return Ok(new
            {
                Id = studio.StudioId,
                Username = studio.Name,
                City = studio.City,
                Role = studio.Role,
                Token = studio.Token
            });
        }
    }
}
</code>```

Body:
I'm building a Restful API with asp.net core. I have an endpoint that are used to authenticate users. I have two kinds of Users where one is an Admin and one is "FilmStudio". I succesfully managed to authenticte the User (Admin) but i also need to be able to authenticate the FilmStudio with username and password. Is there anyway I can do this with a single endpoint?

This is my endpoint form the UsersController:

        [AllowAnonymous]
        [HttpPost("Authenticate")]
        public IActionResult Authenticate([FromBody] UserDto model)
        {

            var user = _userRepo.Authenticate(model.UserName, model.Password);

            if (user !=null)
            {

                if (user == null)
                {
                    return BadRequest("The username or password is incorrect.");
                }

                return Ok(new
                {
                    Id = user.UserId,
                    Username = user.UserName,
                    Role = user.Role,
                    Token = user.Token
                });

            }
            else
            {
                var filmStudioDto = new FilmStudioDto();
                var studio = _studioRepo.Authenticate(model.Name, model.Password);
                if (studio == null)
                {
                    return BadRequest("The username or password is incorrect.");
                }

                return Ok(new
                {
                    Id = studio.StudioId,
                    Username = studio.Name,
                    City = studio.City,
                    Role = studio.Role,
                    Token = studio.Token
                });
            }
        }

    }

When im giving the username and password for the admin user it works. However when im trying to enter the username and passwod for FilmStudio I allways get the error messsage that says: "The username or password is incorrect."


来源: stackexchange

问:
How to get the correct time difference in seconds in Python?
I am writing a python script to check the time on a remote system using SNMP. I have used the modules subprocess, pytz, datetime and time in this script.

The expected working of this code is, it will get the current time of remote system using subprocess and compare it with the actual time obtained by using the modules pytz, datetime and time. The problem is when I take the time difference using this script, it is not getting me the correct time difference in seconds. Can anyone help me with this?

```<code># Finding remote time
snmp_remote_ts = subprocess.run(["/usr/bin/snmpwalk", "-r", "3", "-c", "{}".format(snmp_community), "-v", "{}".format(snmp_ver), "{}:{}".format(remote_host,snmp_port), "{}".format(OID_hrSystemDate)], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
remote_time = snmp_remote_ts.stdout.decode().split()[-1].replace(","," ").split(".")[0]
remote_ts = int(time.mktime(datetime.datetime.strptime(remote_time, "%Y-%m-%d %H:%M:%S").timetuple()))

# Finding actual time of provided timezone
actual_time_now = int(datetime.datetime.now(timezone(remote_tz)).timestamp())

# Finding time difference
time_diff = actual_time_now - remote_ts
</code>```

The output of snmp_remote_ts will be like this:

```<code>>>> snmp_remote_ts.stdout.decode()
'HOST-RESOURCES-MIB::hrSystemDate.0 = STRING: 2022-2-6,13:59:40.0,+5:30\n'
>>>
</code>```

答:
I have solved the issue by rewriting the code as per below:

```<code># Finding remote time
snmp_remote_ts = subprocess.run(["/usr/bin/snmpwalk", "-r", "3", "-c", "{}".format(snmp_community), "-v", "{}".format(snmp_ver), "{}:{}".format(remote_host,snmp_port), "{}".format(OID_hrSystemDate)], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
remote_time = snmp_remote_ts.stdout.decode().split()[-1].replace(","," ").split(".")[0]
remote_ts = datetime.datetime.strptime(remote_time, "%Y-%m-%d %H:%M:%S")

# Finding actual time of provided timezone
actual_time_now = datetime.datetime.now(timezone(remote_tz)).replace(tzinfo=None,microsecond=0)

# Finding time difference
time_diff = actual_time_now - remote_ts
time_diff_seconds = time_diff.seconds
</code>```

Thanks for the help guys!

ContentLicense: CC BY-SA 4.0

Body:
I am writing a python script to check the time on a remote system using SNMP. I have used the modules subprocess, pytz, datetime and time in this script.

The expected working of this code is, it will get the current time of remote system using subprocess and compare it with the actual time obtained by using the modules pytz, datetime and time. The problem is when I take the time difference using this script, it is not getting me the correct time difference in seconds. Can anyone help me with this?

# Finding remote time
snmp_remote_ts = subprocess.run(["/usr/bin/snmpwalk", "-r", "3", "-c", "{}".format(snmp_community), "-v", "{}".format(snmp_ver), "{}:{}".format(remote_host,snmp_port), "{}".format(OID_hrSystemDate)], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
remote_time = snmp_remote_ts.stdout.decode().split()[-1].replace(","," ").split(".")[0]
remote_ts = int(time.mktime(datetime.datetime.strptime(remote_time, "%Y-%m-%d %H:%M:%S").timetuple()))

# Finding actual time of provided timezone
actual_time_now = int(datetime.datetime.now(timezone(remote_tz)).timestamp())

# Finding time difference
time_diff = actual_time_now - remote_ts

The output of snmp_remote_ts will be like this:

>>> snmp_remote_ts.stdout.decode()
'HOST-RESOURCES-MIB::hrSystemDate.0 = STRING: 2022-2-6,13:59:40.0,+5:30\n'
>>>

Body:
I have solved the issue by rewriting the code as per below:

# Finding remote time
snmp_remote_ts = subprocess.run(["/usr/bin/snmpwalk", "-r", "3", "-c", "{}".format(snmp_community), "-v", "{}".format(snmp_ver), "{}:{}".format(remote_host,snmp_port), "{}".format(OID_hrSystemDate)], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
remote_time = snmp_remote_ts.stdout.decode().split()[-1].replace(","," ").split(".")[0]
remote_ts = datetime.datetime.strptime(remote_time, "%Y-%m-%d %H:%M:%S")

# Finding actual time of provided timezone
actual_time_now = datetime.datetime.now(timezone(remote_tz)).replace(tzinfo=None,microsecond=0)

# Finding time difference
time_diff = actual_time_now - remote_ts
time_diff_seconds = time_diff.seconds

Thanks for the help guys!


问:
delphi alexandria linux error ld-linux.exe: error: cannot find -lgcc_s
I install wsl on windows 10 and install Ubuntu 20.04 LTS and open linux terminal and run this commands :
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt install joe wget p7zip-full curl openssh-server build-essential zlib1g-dev libcurl4-gnutls-dev libncurses5
sudo apt-get install zlib1g-dev

then i Unpack the LinuxPAServer22.0.tar.gz and run it and Creating a Connection Profile in delphi and Adding the Installed SDK to Delphi.

i create consol application in Delphi
Delphi in "Linking" show 138 error :

```[DCC Error] E2597 C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\ld-linux.exe: error: cannot find -lgcc_s
  C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\ld-linux.exe: error: cannot find -lc
  C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\ld-linux.exe: error: cannot find -ldl
  C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\ld-linux.exe: error: cannot find -lpthread
  C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\ld-linux.exe: error: cannot find -lm
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::__malloc(NativeUInt): error: undefined reference to 'malloc'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::__free(void*): error: undefined reference to 'free'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::pthread_once(int&, void (*)()): error: undefined reference to 'pthread_once'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::pthread_key_create(unsigned int&, void (*)(void*)): error: undefined reference to 'pthread_key_create'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::dladdr(NativeUInt, dl_info&): error: undefined reference to 'dladdr'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::dlopen(char*, int): error: undefined reference to 'dlopen'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::dlclose(NativeUInt): error: undefined reference to 'dlclose'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::dlsym(NativeUInt, char*): error: undefined reference to 'dlsym'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::TlsGetValue(unsigned int): error: undefined reference to 'pthread_getspecific'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::TlsSetValue(unsigned int, void*): error: undefined reference to 'pthread_setspecific'
  SysInit.pas:1183: error: undefined reference to '_Unwind_Resume'
  System.pas:18011: error: undefined reference to '_Unwind_Resume'
  System.pas:684: error: undefined reference to 'memcpy'
  System.pas:17929: error: undefined reference to '_Unwind_Resume'
  System.pas:688: error: undefined reference to 'memcpy'
  System.pas:18519: error: undefined reference to '_Unwind_Resume'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::getenv(char*): error: undefined reference to 'getenv'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__malloc(NativeUInt): error: undefined reference to 'malloc'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::calloc(NativeUInt, NativeUInt): error: undefined reference to 'calloc'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::realloc(void*, NativeUInt): error: undefined reference to 'realloc'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__free(void*): error: undefined reference to 'free'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__exit(int): error: undefined reference to 'exit'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::memmove(void*, void const*, NativeUInt): error: undefined reference to 'memmove'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::memset(void*, int, NativeUInt): error: undefined reference to 'memset'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::strlen(char*): error: undefined reference to 'strlen'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__raise(int): error: undefined reference to 'raise'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::pthread_self(): error: undefined reference to 'pthread_self'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::sched_yield(): error: undefined reference to 'sched_yield'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::dladdr(NativeUInt, dl_info&): error: undefined reference to 'dladdr'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::dlopen(char*, int): error: undefined reference to 'dlopen'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::dlclose(NativeUInt): error: undefined reference to 'dlclose'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::dlsym(NativeUInt, char*): error: undefined reference to 'dlsym'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::dlerror(): error: undefined reference to 'dlerror'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::open(char*, int): error: undefined reference to 'open'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__chdir(char*): error: undefined reference to 'chdir'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__close(int): error: undefined reference to 'close'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::fchdir(int): error: undefined reference to 'fchdir'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::ftruncate(int, long): error: undefined reference to 'ftruncate'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::getcwd(char*, NativeUInt): error: undefined reference to 'getcwd'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::lseek(int, long, int): error: undefined reference to 'lseek'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__read(int, void*, NativeUInt): error: undefined reference to 'read'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::readlink(char*, char*, NativeUInt): error: undefined reference to 'readlink'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::sysconf(int): error: undefined reference to 'sysconf'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::usleep(unsigned int): error: undefined reference to 'usleep'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__write(int, void*, NativeUInt): error: undefined reference to 'write'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::iconv(void*, char**, NativeUInt*, char**, NativeUInt*): error: undefined reference to 'iconv'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::iconv_open(char*, char*): error: undefined reference to 'iconv_open'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::iconv_close(void*): error: undefined reference to 'iconv_close'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::stat(char*, _stat&): error: undefined reference to 'stat'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::mmap(void*, NativeUInt, int, int, int, long): error: undefined reference to 'mmap'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::munmap(void*, NativeUInt): error: undefined reference to 'munmap'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__error(): error: undefined reference to '__errno_location'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::wcscoll_l(int const*, int const*, void*): error: undefined reference to 'wcscoll_l'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::towupper_l(unsigned int, void*): error: undefined reference to 'towupper_l'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::setlocale(int, char const*): error: undefined reference to 'setlocale'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::newlocale(int, char const*, void*): error: undefined reference to 'newlocale'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::times(tms&): error: undefined reference to 'times'
  ex.inc:84: error: undefined reference to 'memcpy'
  ex.inc:171: error: undefined reference to 'memcpy'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::fegetexceptflag(unsigned short*, unsigned int): error: undefined reference to 'fegetexceptflag'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::fesetexceptflag(unsigned short*, unsigned int): error: undefined reference to 'fesetexceptflag'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::fegetround(): error: undefined reference to 'fegetround'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::fesetround(unsigned int): error: undefined reference to 'fesetround'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::fedisableexcept(unsigned int): error: undefined reference to 'fedisableexcept'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::libm_cosl(long double): error: undefined reference to 'cosl'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::libm_sinl(long double): error: undefined reference to 'sinl'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::libm_atanl(long double): error: undefined reference to 'atanl'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::libm_sqrtl(long double): error: undefined reference to 'sqrtl'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::llrintl(long double): error: undefined reference to 'llrintl'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::_Unwind_RaiseException(_Unwind_Exception&): error: undefined reference to '_Unwind_RaiseException'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::_Unwind_GetRegionStart(_Unwind_Context*): error: undefined reference to '_Unwind_GetRegionStart'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::_Unwind_GetLanguageSpecificData(_Unwind_Context*): error: undefined reference to '_Unwind_GetLanguageSpecificData'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::_Unwind_GetGR(_Unwind_Context*, int): error: undefined reference to '_Unwind_GetGR'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::_Unwind_SetGR(_Unwind_Context*, int, NativeUInt): error: undefined reference to '_Unwind_SetGR'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::_Unwind_GetIP(_Unwind_Context*): error: undefined reference to '_Unwind_GetIP'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::_Unwind_SetIP(_Unwind_Context*, NativeUInt): error: undefined reference to '_Unwind_SetIP'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Dlfcn.o:Posix.Dlfcn:function Posix::Dlfcn::dladdr(NativeUInt, dl_info&): error: undefined reference to 'dladdr'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Dlfcn.o:Posix.Dlfcn:function Posix::Dlfcn::dlopen(char*, int): error: undefined reference to 'dlopen'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Dlfcn.o:Posix.Dlfcn:function Posix::Dlfcn::dlclose(NativeUInt): error: undefined reference to 'dlclose'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Dlfcn.o:Posix.Dlfcn:function Posix::Dlfcn::dlsym(NativeUInt, char*): error: undefined reference to 'dlsym'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Fcntl.o:Posix.Fcntl:function Posix::Fcntl::__open(char*, int): error: undefined reference to 'open'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Fcntl.o:Posix.Fcntl:function Posix::Fcntl::fcntl(int, int): error: undefined reference to 'fcntl'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.SysStat.o:Posix.SysStat:function Posix::Sysstat::fstat(int, _stat&): error: undefined reference to 'fstat'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.SysStat.o:Posix.SysStat:function Posix::Sysstat::lstat(char*, _stat&): error: undefined reference to 'lstat'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.SysStat.o:Posix.SysStat:function Posix::Sysstat::stat(char*, _stat&): error: undefined reference to 'stat'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Signal.o:Posix.Signal:function Posix::Signal::sigaction(int, sigaction_t*, sigaction_t*): error: undefined reference to 'sigaction'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Signal.o:Posix.Signal:function Posix::Signal::sigaddset(sigset_t&, int): error: undefined reference to 'sigaddset'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Signal.o:Posix.Signal:function Posix::Signal::kill(int, int): error: undefined reference to 'kill'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Time.o:Posix.Time:function Posix::Time::clock_gettime(int, timespec*): error: undefined reference to 'clock_gettime'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Time.o:Posix.Time:function Posix::Time::localtime_r(long&, tm&): error: undefined reference to 'localtime_r'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.SysTime.o:Posix.SysTime:function Posix::Systime::gettimeofday(timeval&, void*): error: undefined reference to 'gettimeofday'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Locale.o:Posix.Locale:function Posix::Locale::localeconv(): error: undefined reference to 'localeconv'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Locale.o:Posix.Locale:function Posix::Locale::newlocale(int, char const*, void*): error: undefined reference to 'newlocale'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Locale.o:Posix.Locale:function Posix::Locale::freelocale(void*): error: undefined reference to 'freelocale'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Locale.o:Posix.Locale:function Posix::Locale::duplocale(void*): error: undefined reference to 'duplocale'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Locale.o:Posix.Locale:function Posix::Locale::uselocale(void*): error: undefined reference to 'uselocale'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Iconv.o:Posix.Iconv:function Posix::Iconv::iconv_open(char*, char*): error: undefined reference to 'iconv_open'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Iconv.o:Posix.Iconv:function Posix::Iconv::iconv_close(void*): error: undefined reference to 'iconv_close'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Dirent.o:Posix.Dirent:function Posix::Dirent::closedir(__dirstream*): error: undefined reference to 'closedir'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Dirent.o:Posix.Dirent:function Posix::Dirent::opendir(char*): error: undefined reference to 'opendir'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Dirent.o:Posix.Dirent:function Posix::Dirent::readdir_r(__dirstream*, dirent*, dirent*&): error: undefined reference to 'readdir_r'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Errno.o:Posix.Errno:function Posix::Errno::__error(): error: undefined reference to '__errno_location'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Fnmatch.o:Posix.Fnmatch:function Posix::Fnmatch::fnmatch(char*, char*, int): error: undefined reference to 'fnmatch'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Langinfo.o:Posix.Langinfo:function Posix::Langinfo::nl_langinfo(int): error: undefined reference to 'nl_langinfo'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Langinfo.o:Posix.Langinfo:function Posix::Langinfo::nl_langinfo_l(int, void*): error: undefined reference to 'nl_langinfo_l'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Pthread.o:Posix.Pthread:function Posix::Pthread::pthread_self(): error: undefined reference to 'pthread_self'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.String_.o:Posix.String_:function Posix::String_::memcmp(void const*, void const*, NativeUInt): error: undefined reference to 'memcmp'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.String_.o:Posix.String_:function Posix::String_::strcmp(char*, char*): error: undefined reference to 'strcmp'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.String_.o:Posix.String_:function Posix::String_::strerror_r_GNU(int, char*, NativeUInt): error: undefined reference to 'strerror_r'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Unistd.o:Posix.Unistd:function Posix::Unistd::euidaccess(char*, int): error: undefined reference to 'access'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Unistd.o:Posix.Unistd:function Posix::Unistd::__close(int): error: undefined reference to 'close'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Unistd.o:Posix.Unistd:function Posix::Unistd::getpid(): error: undefined reference to 'getpid'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Unistd.o:Posix.Unistd:function Posix::Unistd::__read(int, void*, NativeUInt): error: undefined reference to 'read'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Unistd.o:Posix.Unistd:function Posix::Unistd::__write(int, void*, NativeUInt): error: undefined reference to 'write'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Semaphore.o:Posix.Semaphore:function Posix::Semaphore::sem_destroy(sem_t&): error: undefined reference to 'sem_destroy'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Semaphore.o:Posix.Semaphore:function Posix::Semaphore::sem_getvalue(sem_t&, int&): error: undefined reference to 'sem_getvalue'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Semaphore.o:Posix.Semaphore:function Posix::Semaphore::sem_init(sem_t&, int, unsigned int): error: undefined reference to 'sem_init'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Semaphore.o:Posix.Semaphore:function Posix::Semaphore::sem_post(sem_t&): error: undefined reference to 'sem_post'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Semaphore.o:Posix.Semaphore:function Posix::Semaphore::sem_trywait(sem_t&): error: undefined reference to 'sem_trywait'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Semaphore.o:Posix.Semaphore:function Posix::Semaphore::sem_wait(sem_t&): error: undefined reference to 'sem_wait'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Semaphore.o:Posix.Semaphore:function Posix::Semaphore::sem_timedwait(sem_t&, timespec&): error: undefined reference to 'sem_timedwait'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.SysUtsname.o:Posix.SysUtsname:function Posix::Sysutsname::uname(utsname&): error: undefined reference to 'uname'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Wchar.o:Posix.Wchar:function Posix::Wchar::wcscoll_l(int const*, int const*, void*): error: undefined reference to 'wcscoll_l'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Wchar.o:Posix.Wchar:function Posix::Wchar::wcscasecmp_l(int const*, int const*, void*): error: undefined reference to 'wcscasecmp_l'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Wctype.o:Posix.Wctype:function Posix::Wctype::towupper(unsigned int): error: undefined reference to 'towupper'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Wctype.o:Posix.Wctype:function Posix::Wctype::towlower_l(unsigned int, void*): error: undefined reference to 'towlower_l'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Wctype.o:Posix.Wctype:function Posix::Wctype::towupper_l(unsigned int, void*): error: undefined reference to 'towupper_l'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.Internal.ExcUtils.o:System.Internal.ExcUtils:function System::Internal::Excutils::TlsGetValue(int): error: undefined reference to 'pthread_getspecific'
  System.SysUtils.pas:988: error: undefined reference to 'memset'
  System.SysUtils.pas:988: error: undefined reference to 'memset'
  System.SysUtils.pas:29787: error: undefined reference to 'memset'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.SysUtils.o:System.SysUtils:function System::Sysutils::gnu_get_libc_version(): error: undefined reference to 'gnu_get_libc_version'
```

答:
There was a non-English name in the defined path of the BDSPLATFORMSDKSDIR variable. I created a new folder and changed the path to that folder. The new folder used only English letters. This solved my problem.
Due to the use of onedrive Windows, the name mydocument was changed to a non-English name</p>

Body:
I install wsl on windows 10 and install Ubuntu 20.04 LTS and open linux terminal and run this commands :
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt install joe wget p7zip-full curl openssh-server build-essential zlib1g-dev libcurl4-gnutls-dev libncurses5
sudo apt-get install zlib1g-dev

then i Unpack the LinuxPAServer22.0.tar.gz and run it and Creating a Connection Profile in delphi and Adding the Installed SDK to Delphi.

i create consol application in Delphi
Delphi in "Linking" show 138 error :

[DCC Error] E2597 C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\ld-linux.exe: error: cannot find -lgcc_s
  C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\ld-linux.exe: error: cannot find -lc
  C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\ld-linux.exe: error: cannot find -ldl
  C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\ld-linux.exe: error: cannot find -lpthread
  C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\ld-linux.exe: error: cannot find -lm
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::__malloc(NativeUInt): error: undefined reference to 'malloc'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::__free(void*): error: undefined reference to 'free'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::pthread_once(int&, void (*)()): error: undefined reference to 'pthread_once'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::pthread_key_create(unsigned int&, void (*)(void*)): error: undefined reference to 'pthread_key_create'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::dladdr(NativeUInt, dl_info&): error: undefined reference to 'dladdr'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::dlopen(char*, int): error: undefined reference to 'dlopen'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::dlclose(NativeUInt): error: undefined reference to 'dlclose'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::dlsym(NativeUInt, char*): error: undefined reference to 'dlsym'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::TlsGetValue(unsigned int): error: undefined reference to 'pthread_getspecific'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\SysInit.o:SysInit:function Sysinit::TlsSetValue(unsigned int, void*): error: undefined reference to 'pthread_setspecific'
  SysInit.pas:1183: error: undefined reference to '_Unwind_Resume'
  System.pas:18011: error: undefined reference to '_Unwind_Resume'
  System.pas:684: error: undefined reference to 'memcpy'
  System.pas:17929: error: undefined reference to '_Unwind_Resume'
  System.pas:688: error: undefined reference to 'memcpy'
  System.pas:18519: error: undefined reference to '_Unwind_Resume'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::getenv(char*): error: undefined reference to 'getenv'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__malloc(NativeUInt): error: undefined reference to 'malloc'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::calloc(NativeUInt, NativeUInt): error: undefined reference to 'calloc'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::realloc(void*, NativeUInt): error: undefined reference to 'realloc'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__free(void*): error: undefined reference to 'free'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__exit(int): error: undefined reference to 'exit'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::memmove(void*, void const*, NativeUInt): error: undefined reference to 'memmove'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::memset(void*, int, NativeUInt): error: undefined reference to 'memset'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::strlen(char*): error: undefined reference to 'strlen'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__raise(int): error: undefined reference to 'raise'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::pthread_self(): error: undefined reference to 'pthread_self'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::sched_yield(): error: undefined reference to 'sched_yield'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::dladdr(NativeUInt, dl_info&): error: undefined reference to 'dladdr'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::dlopen(char*, int): error: undefined reference to 'dlopen'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::dlclose(NativeUInt): error: undefined reference to 'dlclose'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::dlsym(NativeUInt, char*): error: undefined reference to 'dlsym'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::dlerror(): error: undefined reference to 'dlerror'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::open(char*, int): error: undefined reference to 'open'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__chdir(char*): error: undefined reference to 'chdir'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__close(int): error: undefined reference to 'close'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::fchdir(int): error: undefined reference to 'fchdir'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::ftruncate(int, long): error: undefined reference to 'ftruncate'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::getcwd(char*, NativeUInt): error: undefined reference to 'getcwd'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::lseek(int, long, int): error: undefined reference to 'lseek'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__read(int, void*, NativeUInt): error: undefined reference to 'read'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::readlink(char*, char*, NativeUInt): error: undefined reference to 'readlink'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::sysconf(int): error: undefined reference to 'sysconf'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::usleep(unsigned int): error: undefined reference to 'usleep'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__write(int, void*, NativeUInt): error: undefined reference to 'write'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::iconv(void*, char**, NativeUInt*, char**, NativeUInt*): error: undefined reference to 'iconv'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::iconv_open(char*, char*): error: undefined reference to 'iconv_open'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::iconv_close(void*): error: undefined reference to 'iconv_close'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::stat(char*, _stat&): error: undefined reference to 'stat'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::mmap(void*, NativeUInt, int, int, int, long): error: undefined reference to 'mmap'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::munmap(void*, NativeUInt): error: undefined reference to 'munmap'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::__error(): error: undefined reference to '__errno_location'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::wcscoll_l(int const*, int const*, void*): error: undefined reference to 'wcscoll_l'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::towupper_l(unsigned int, void*): error: undefined reference to 'towupper_l'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::setlocale(int, char const*): error: undefined reference to 'setlocale'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::newlocale(int, char const*, void*): error: undefined reference to 'newlocale'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::times(tms&): error: undefined reference to 'times'
  ex.inc:84: error: undefined reference to 'memcpy'
  ex.inc:171: error: undefined reference to 'memcpy'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::fegetexceptflag(unsigned short*, unsigned int): error: undefined reference to 'fegetexceptflag'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::fesetexceptflag(unsigned short*, unsigned int): error: undefined reference to 'fesetexceptflag'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::fegetround(): error: undefined reference to 'fegetround'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::fesetround(unsigned int): error: undefined reference to 'fesetround'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::fedisableexcept(unsigned int): error: undefined reference to 'fedisableexcept'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::libm_cosl(long double): error: undefined reference to 'cosl'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::libm_sinl(long double): error: undefined reference to 'sinl'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::libm_atanl(long double): error: undefined reference to 'atanl'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::libm_sqrtl(long double): error: undefined reference to 'sqrtl'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::llrintl(long double): error: undefined reference to 'llrintl'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::_Unwind_RaiseException(_Unwind_Exception&): error: undefined reference to '_Unwind_RaiseException'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::_Unwind_GetRegionStart(_Unwind_Context*): error: undefined reference to '_Unwind_GetRegionStart'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::_Unwind_GetLanguageSpecificData(_Unwind_Context*): error: undefined reference to '_Unwind_GetLanguageSpecificData'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::_Unwind_GetGR(_Unwind_Context*, int): error: undefined reference to '_Unwind_GetGR'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::_Unwind_SetGR(_Unwind_Context*, int, NativeUInt): error: undefined reference to '_Unwind_SetGR'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::_Unwind_GetIP(_Unwind_Context*): error: undefined reference to '_Unwind_GetIP'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.o:System:function System::_Unwind_SetIP(_Unwind_Context*, NativeUInt): error: undefined reference to '_Unwind_SetIP'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Dlfcn.o:Posix.Dlfcn:function Posix::Dlfcn::dladdr(NativeUInt, dl_info&): error: undefined reference to 'dladdr'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Dlfcn.o:Posix.Dlfcn:function Posix::Dlfcn::dlopen(char*, int): error: undefined reference to 'dlopen'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Dlfcn.o:Posix.Dlfcn:function Posix::Dlfcn::dlclose(NativeUInt): error: undefined reference to 'dlclose'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Dlfcn.o:Posix.Dlfcn:function Posix::Dlfcn::dlsym(NativeUInt, char*): error: undefined reference to 'dlsym'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Fcntl.o:Posix.Fcntl:function Posix::Fcntl::__open(char*, int): error: undefined reference to 'open'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Fcntl.o:Posix.Fcntl:function Posix::Fcntl::fcntl(int, int): error: undefined reference to 'fcntl'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.SysStat.o:Posix.SysStat:function Posix::Sysstat::fstat(int, _stat&): error: undefined reference to 'fstat'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.SysStat.o:Posix.SysStat:function Posix::Sysstat::lstat(char*, _stat&): error: undefined reference to 'lstat'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.SysStat.o:Posix.SysStat:function Posix::Sysstat::stat(char*, _stat&): error: undefined reference to 'stat'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Signal.o:Posix.Signal:function Posix::Signal::sigaction(int, sigaction_t*, sigaction_t*): error: undefined reference to 'sigaction'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Signal.o:Posix.Signal:function Posix::Signal::sigaddset(sigset_t&, int): error: undefined reference to 'sigaddset'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Signal.o:Posix.Signal:function Posix::Signal::kill(int, int): error: undefined reference to 'kill'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Time.o:Posix.Time:function Posix::Time::clock_gettime(int, timespec*): error: undefined reference to 'clock_gettime'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Time.o:Posix.Time:function Posix::Time::localtime_r(long&, tm&): error: undefined reference to 'localtime_r'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.SysTime.o:Posix.SysTime:function Posix::Systime::gettimeofday(timeval&, void*): error: undefined reference to 'gettimeofday'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Locale.o:Posix.Locale:function Posix::Locale::localeconv(): error: undefined reference to 'localeconv'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Locale.o:Posix.Locale:function Posix::Locale::newlocale(int, char const*, void*): error: undefined reference to 'newlocale'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Locale.o:Posix.Locale:function Posix::Locale::freelocale(void*): error: undefined reference to 'freelocale'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Locale.o:Posix.Locale:function Posix::Locale::duplocale(void*): error: undefined reference to 'duplocale'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Locale.o:Posix.Locale:function Posix::Locale::uselocale(void*): error: undefined reference to 'uselocale'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Iconv.o:Posix.Iconv:function Posix::Iconv::iconv_open(char*, char*): error: undefined reference to 'iconv_open'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Iconv.o:Posix.Iconv:function Posix::Iconv::iconv_close(void*): error: undefined reference to 'iconv_close'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Dirent.o:Posix.Dirent:function Posix::Dirent::closedir(__dirstream*): error: undefined reference to 'closedir'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Dirent.o:Posix.Dirent:function Posix::Dirent::opendir(char*): error: undefined reference to 'opendir'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Dirent.o:Posix.Dirent:function Posix::Dirent::readdir_r(__dirstream*, dirent*, dirent*&): error: undefined reference to 'readdir_r'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Errno.o:Posix.Errno:function Posix::Errno::__error(): error: undefined reference to '__errno_location'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Fnmatch.o:Posix.Fnmatch:function Posix::Fnmatch::fnmatch(char*, char*, int): error: undefined reference to 'fnmatch'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Langinfo.o:Posix.Langinfo:function Posix::Langinfo::nl_langinfo(int): error: undefined reference to 'nl_langinfo'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Langinfo.o:Posix.Langinfo:function Posix::Langinfo::nl_langinfo_l(int, void*): error: undefined reference to 'nl_langinfo_l'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Pthread.o:Posix.Pthread:function Posix::Pthread::pthread_self(): error: undefined reference to 'pthread_self'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.String_.o:Posix.String_:function Posix::String_::memcmp(void const*, void const*, NativeUInt): error: undefined reference to 'memcmp'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.String_.o:Posix.String_:function Posix::String_::strcmp(char*, char*): error: undefined reference to 'strcmp'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.String_.o:Posix.String_:function Posix::String_::strerror_r_GNU(int, char*, NativeUInt): error: undefined reference to 'strerror_r'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Unistd.o:Posix.Unistd:function Posix::Unistd::euidaccess(char*, int): error: undefined reference to 'access'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Unistd.o:Posix.Unistd:function Posix::Unistd::__close(int): error: undefined reference to 'close'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Unistd.o:Posix.Unistd:function Posix::Unistd::getpid(): error: undefined reference to 'getpid'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Unistd.o:Posix.Unistd:function Posix::Unistd::__read(int, void*, NativeUInt): error: undefined reference to 'read'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Unistd.o:Posix.Unistd:function Posix::Unistd::__write(int, void*, NativeUInt): error: undefined reference to 'write'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Semaphore.o:Posix.Semaphore:function Posix::Semaphore::sem_destroy(sem_t&): error: undefined reference to 'sem_destroy'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Semaphore.o:Posix.Semaphore:function Posix::Semaphore::sem_getvalue(sem_t&, int&): error: undefined reference to 'sem_getvalue'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Semaphore.o:Posix.Semaphore:function Posix::Semaphore::sem_init(sem_t&, int, unsigned int): error: undefined reference to 'sem_init'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Semaphore.o:Posix.Semaphore:function Posix::Semaphore::sem_post(sem_t&): error: undefined reference to 'sem_post'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Semaphore.o:Posix.Semaphore:function Posix::Semaphore::sem_trywait(sem_t&): error: undefined reference to 'sem_trywait'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Semaphore.o:Posix.Semaphore:function Posix::Semaphore::sem_wait(sem_t&): error: undefined reference to 'sem_wait'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Semaphore.o:Posix.Semaphore:function Posix::Semaphore::sem_timedwait(sem_t&, timespec&): error: undefined reference to 'sem_timedwait'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.SysUtsname.o:Posix.SysUtsname:function Posix::Sysutsname::uname(utsname&): error: undefined reference to 'uname'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Wchar.o:Posix.Wchar:function Posix::Wchar::wcscoll_l(int const*, int const*, void*): error: undefined reference to 'wcscoll_l'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Wchar.o:Posix.Wchar:function Posix::Wchar::wcscasecmp_l(int const*, int const*, void*): error: undefined reference to 'wcscasecmp_l'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Wctype.o:Posix.Wctype:function Posix::Wctype::towupper(unsigned int): error: undefined reference to 'towupper'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Wctype.o:Posix.Wctype:function Posix::Wctype::towlower_l(unsigned int, void*): error: undefined reference to 'towlower_l'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\Posix.Wctype.o:Posix.Wctype:function Posix::Wctype::towupper_l(unsigned int, void*): error: undefined reference to 'towupper_l'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.Internal.ExcUtils.o:System.Internal.ExcUtils:function System::Internal::Excutils::TlsGetValue(int): error: undefined reference to 'pthread_getspecific'
  System.SysUtils.pas:988: error: undefined reference to 'memset'
  System.SysUtils.pas:988: error: undefined reference to 'memset'
  System.SysUtils.pas:29787: error: undefined reference to 'memset'
  c:\program files (x86)\embarcadero\studio\22.0\lib\Linux64\debug\System.SysUtils.o:System.SysUtils:function System::Sysutils::gnu_get_libc_version(): error: undefined reference to 'gnu_get_libc_version'


问:
How to write a removeError rest destructure function in typescript
I want to write a function which can remove a key with a certain name from an object (use case is in react where i want to set new error state when a field is focussed

This is how i write it in javascript

```<code>removeError = (fieldName) => {
    const { error } = this.state;
    if (error) {
      const { [fieldName]: ommited, ...rest } = error;
      this.setState({ error: rest });
    }
  };
</code>```

If i write it in typescript - how to write this line:

```<code>const { [fieldName]: ommited, ...rest } = error;
</code>```

答:
Typescript is a superset of javascript so any javascript code is valid in typescript, but you might need to declare types to remove warnings.

I'm suspecting you don't have the right type for your state, which is why you're getting some error, but it's hard to say without seeing that portion of your code.

Either way, by setting the right types, you should be able to make your code compile just fine, see this example:

```<code>type State = {error?: Record<string, string>};
let state: State = {};
const setState = (state: State) => undefined;

const removeError = (fieldName: string) => {
    const { error } = state;
    if (error) {
      const { [fieldName]: ommited, ...rest } = error;
      setState({ error: rest });
    }
  };
</code>```

See for yourself in the typescript playground.

note: I just mocked react state for the purpose of this code snippet.

Body:
I want to write a function which can remove a key with a certain name from an object (use case is in react where i want to set new error state when a field is focussed

This is how i write it in javascript

removeError = (fieldName) => {
    const { error } = this.state;
    if (error) {
      const { [fieldName]: ommited, ...rest } = error;
      this.setState({ error: rest });
    }
  };

If i write it in typescript - how to write this line:

const { [fieldName]: ommited, ...rest } = error;

Body:
Typescript is a superset of javascript so any javascript code is valid in typescript, but you might need to declare types to remove warnings.

I'm suspecting you don't have the right type for your state, which is why you're getting some error, but it's hard to say without seeing that portion of your code.

Either way, by setting the right types, you should be able to make your code compile just fine, see this example:

type State = {error?: Record<string, string>};
let state: State = {};
const setState = (state: State) => undefined;

const removeError = (fieldName: string) => {
    const { error } = state;
    if (error) {
      const { [fieldName]: ommited, ...rest } = error;
      setState({ error: rest });
    }
  };

See for yourself in the typescript playground.

note: I just mocked react state for the purpose of this code snippet.


问:
Stl container vector push_back with OpenMP multithreading
I want to push_back an object into a vector from different threads. The no. of threads depends on the machine.

```<code>#pragma omp parallel shared(Spaces, LookUpTable) private(LutDistribution, tid)
{
    tid = omp_get_thread_num();

    BestCoreSpaces.push_back( computeBestCoreSpace(tid, &Spaces, &LookUpTable, LutDistribution));
}
</code>```

The problem is, that I'm not sure if it's working. I don't get crashes. I'm using openMP. Is openMP queuing something?
Maybe its enough to reserve memory for the container with BestCoreSpaces.reserve(tid) or to assign the amount of elements with BestCoreSpaces.assign(tid, Space). Can somebody help me?

答:
You just get away with it - you have a race condition that might or might not manifest itself depending on the optimization level at compile time, the thread execution and/or the alignment of the stars.

You have to make the push_back() a critical section (i.e use a mutex). For example:

```<code>#pragma omp parallel shared(Spaces, LookUpTable, BestCoreSpaces) private(LutDistribution, tid)
{
  tid = omp_get_thread_num();
#pragma omp critical
  BestCoreSpaces.push_back(
    computeBestCoreSpace(tid, &Spaces, &LookUpTable, LutDistribution)
  );
}
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I want to push_back an object into a vector from different threads. The no. of threads depends on the machine.

#pragma omp parallel shared(Spaces, LookUpTable) private(LutDistribution, tid)
{
    tid = omp_get_thread_num();

    BestCoreSpaces.push_back( computeBestCoreSpace(tid, &Spaces, &LookUpTable, LutDistribution));
}

The problem is, that I'm not sure if it's working. I don't get crashes. I'm using openMP. Is openMP queuing something?
Maybe its enough to reserve memory for the container with BestCoreSpaces.reserve(tid) or to assign the amount of elements with BestCoreSpaces.assign(tid, Space). Can somebody help me?

Body:
You just get away with it - you have a race condition that might or might not manifest itself depending on the optimization level at compile time, the thread execution and/or the alignment of the stars.

You have to make the push_back() a critical section (i.e use a mutex). For example:

#pragma omp parallel shared(Spaces, LookUpTable, BestCoreSpaces) private(LutDistribution, tid)
{
  tid = omp_get_thread_num();
#pragma omp critical
  BestCoreSpaces.push_back(
    computeBestCoreSpace(tid, &Spaces, &LookUpTable, LutDistribution)
  );
}


问:
php - Fatal error: Uncaught ArgumentCountError: Too few arguments to function PostManager::__construct()
Hi guys I'm new to php and there is something weird I don't understand.
All the functions inside the class is working.

But now I want to get this information when I create new instance

I try to add __construct and use the same functions but it get the following error :

```<code>Fatal error: Uncaught ArgumentCountError: Too few arguments to function PostManager::__construct(), 0 passed and exactly 2 expected
</code>```

The thing is that if I try to echo/var_dump the values from the __construct its working. I did find around stackoverflow some results but nothing really helpful for my case or I just understood it wrong. I used both static:: and self:: but got the same results. please let me know if I need to add more info.

the files :

index.php :

```<code><?php
require "Curl.php";
require "Proccessor.php";
require "User.php";
require "PostManager.php";
$conn = require 'db.php';

// this is work $post = PostManager::getPostInfo($conn, 3);
   // **this is not work** $post = new PostManager($conn, 3);
</code>```

PostManager.php :

```<code><?php
class PostManager
{
    public $postId;
    public $conn;
    public function __construct($conn, $postId)
    {

        $this->postId = $postId;
        $this->conn = $conn;
       //here I get the error =>  static::getPostById($conn, $postId);

    }

    public static function getPostInfo($conn, $postId)
    {
        $post = static::getPostById($conn, $postId);
        $user = User::getByID($conn, $post->user_id);
        $comments = static::getCommentsByUserID($conn, $post->id);
        $post_info = (object) ["post" => $post, "user" => $user, "comments" => $comments];
        return $post_info;
    }

    public static function getPostById($conn, $id)
    {
        $sql = "SELECT post.*
              FROM post
              WHERE id = :id";
        $stmt = $conn->prepare($sql);
        $stmt->bindValue(':id', $id, PDO::PARAM_INT);
        $stmt->setFetchMode(PDO::FETCH_CLASS, 'PostManager');
        if ($stmt->execute()) {
            return $stmt->fetch();
        }
    }

    public static function getCommentsByUserID($conn, $postId)
    {
        $sql = "SELECT comment.*
      FROM comment
      WHERE post_id = :post_id";
        $stmt = $conn->prepare($sql);
        $stmt->bindValue(':post_id', $postId, PDO::PARAM_INT);
        $stmt->setFetchMode(PDO::FETCH_CLASS, 'PostManager');
        if ($stmt->execute()) {
            return $stmt->fetch();
        }
    }

}
</code>```

答:
Try this:

```<code>$stmt->setFetchMode(PDO::FETCH_CLASS, 'PostManager', array($conn, $postId));
</code>```

You forgot to pass the parameters here.

This is the signature you wanna use:

```<code>public PDOStatement::setFetchMode(int $mode = PDO::FETCH_CLASS, string $class, ?array $constructorArgs): bool
</code>```

As you can see if the Ctor has args then you need to pass them as another parameter

array $constructorArgs

Body:
Hi guys I'm new to php and there is something weird I don't understand.
All the functions inside the class is working.

But now I want to get this information when I create new instance

I try to add __construct and use the same functions but it get the following error :

Fatal error: Uncaught ArgumentCountError: Too few arguments to function PostManager::__construct(), 0 passed and exactly 2 expected

The thing is that if I try to echo/var_dump the values from the __construct its working. I did find around stackoverflow some results but nothing really helpful for my case or I just understood it wrong. I used both static:: and self:: but got the same results. please let me know if I need to add more info.

the files :

index.php :

<?php
require "Curl.php";
require "Proccessor.php";
require "User.php";
require "PostManager.php";
$conn = require 'db.php';

// this is work $post = PostManager::getPostInfo($conn, 3);
   // **this is not work** $post = new PostManager($conn, 3);

PostManager.php :

<?php
class PostManager
{
    public $postId;
    public $conn;
    public function __construct($conn, $postId)
    {

        $this->postId = $postId;
        $this->conn = $conn;
       //here I get the error =>  static::getPostById($conn, $postId);

    }

    public static function getPostInfo($conn, $postId)
    {
        $post = static::getPostById($conn, $postId);
        $user = User::getByID($conn, $post->user_id);
        $comments = static::getCommentsByUserID($conn, $post->id);
        $post_info = (object) ["post" => $post, "user" => $user, "comments" => $comments];
        return $post_info;
    }

    public static function getPostById($conn, $id)
    {
        $sql = "SELECT post.*
              FROM post
              WHERE id = :id";
        $stmt = $conn->prepare($sql);
        $stmt->bindValue(':id', $id, PDO::PARAM_INT);
        $stmt->setFetchMode(PDO::FETCH_CLASS, 'PostManager');
        if ($stmt->execute()) {
            return $stmt->fetch();
        }
    }

    public static function getCommentsByUserID($conn, $postId)
    {
        $sql = "SELECT comment.*
      FROM comment
      WHERE post_id = :post_id";
        $stmt = $conn->prepare($sql);
        $stmt->bindValue(':post_id', $postId, PDO::PARAM_INT);
        $stmt->setFetchMode(PDO::FETCH_CLASS, 'PostManager');
        if ($stmt->execute()) {
            return $stmt->fetch();
        }
    }

}

Body:
Try this:

$stmt->setFetchMode(PDO::FETCH_CLASS, 'PostManager', array($conn, $postId));

You forgot to pass the parameters here.

This is the signature you wanna use:

public PDOStatement::setFetchMode(int $mode = PDO::FETCH_CLASS, string $class, ?array $constructorArgs): bool

As you can see if the Ctor has args then you need to pass them as another parameter

array $constructorArgs


问:
how to inject custom dependencies into classes that extend ObjectType<T>, ObjectTypeExtension<T>, InputObjectType<T> or InputObjectTypeExctension<T>?
so I am trying to inject dependencies into classes that extend these types and I am getting runtime errors when I request a schema refresh saying that it cannot create my object. Heres what I am trying to do:

```<code>public class SomeResultType : ObjectType<SomeResult>
    {
        private readonly IMyDependency _md;
        public SomeResult(IMYDependency md)
        {
            _md= md;
        }
        protected override void Configure(IObjectTypeDescriptor<QuoteResult> descriptor)
        {
           md.domSomething(); // this dependency is meant to dynamically set the class and field descriptions based on database tables so we can remove schema description from out codebase.
        }
    }
</code>```

this is the error I get.
. Unable to create instance of type SomeResultType.

I recognize that hotchocolate documentation advises against injecting dependencies into these ObjectType extensions, but I feel my use case is acceptable. Please tell me if this is just outright impossible because the documentation simply advises against it does not say you cannot do this. I suspect I am making a mistake somewhere in my Startup.cs file. Here is the Startup.cs file (note i have removed some dependencies because i cant share the entirety of the app):

```<code>    services.AddDbContext<AbcContext>(opt => opt.UseSqlServer(Configuration.GetConnectionString("abc")).UseLazyLoadingProxies());

            services.AddScoped<ISomeDependency, SomeDependency()>();
            services.AddGraphQLServer()
                .AddDefaultTransactionScopeHandler()
                .AddHttpRequestInterceptor<HttpRequestInterceptor>()
                .AddErrorFilter<GraphQLErrorFilter>()
                .AddType<SomeResultType>()
                .AddFiltering()
                //.AddAuthorization()
                .AddProjections()
                .AddMutationType<PurchaseMutation>();
</code>```

Thanks for reading, Im fairly new to graphql so I greatly appreciate your time and insights.

答:
This does not work as the object type descriptors are reserved.

If you want to inject a service you can do so in the resolver

```<code>descriptor.Field("foo").Resolve(ctx => ctx.Service<IService>().DoSomething());
</code>```

In case you use the Annotation Based Approach you have support for dependency injection.

If you use Resolvers or Methods though, we only resolve the required services for the query. So all of the services that are not used in this query are not instantiated.

Body:
so I am trying to inject dependencies into classes that extend these types and I am getting runtime errors when I request a schema refresh saying that it cannot create my object. Heres what I am trying to do:

public class SomeResultType : ObjectType<SomeResult>
    {
        private readonly IMyDependency _md;
        public SomeResult(IMYDependency md)
        {
            _md= md;
        }
        protected override void Configure(IObjectTypeDescriptor<QuoteResult> descriptor)
        {
           md.domSomething(); // this dependency is meant to dynamically set the class and field descriptions based on database tables so we can remove schema description from out codebase.
        }
    }

this is the error I get.
. Unable to create instance of type SomeResultType.

I recognize that hotchocolate documentation advises against injecting dependencies into these ObjectType extensions, but I feel my use case is acceptable. Please tell me if this is just outright impossible because the documentation simply advises against it does not say you cannot do this. I suspect I am making a mistake somewhere in my Startup.cs file. Here is the Startup.cs file (note i have removed some dependencies because i cant share the entirety of the app):

    services.AddDbContext<AbcContext>(opt => opt.UseSqlServer(Configuration.GetConnectionString("abc")).UseLazyLoadingProxies());

            services.AddScoped<ISomeDependency, SomeDependency()>();
            services.AddGraphQLServer()
                .AddDefaultTransactionScopeHandler()
                .AddHttpRequestInterceptor<HttpRequestInterceptor>()
                .AddErrorFilter<GraphQLErrorFilter>()
                .AddType<SomeResultType>()
                .AddFiltering()
                //.AddAuthorization()
                .AddProjections()
                .AddMutationType<PurchaseMutation>();

Thanks for reading, Im fairly new to graphql so I greatly appreciate your time and insights.

Body:
This does not work as the object type descriptors are reserved.

If you want to inject a service you can do so in the resolver

descriptor.Field("foo").Resolve(ctx => ctx.Service<IService>().DoSomething());

In case you use the Annotation Based Approach you have support for dependency injection.

If you use Resolvers or Methods though, we only resolve the required services for the query. So all of the services that are not used in this query are not instantiated.


问:
Is there a way to run IOS Simulator on Windows 10?
I want to run IOS Simulator on Windows 10.
Is there a way to do this?</p>

答:
I dont think its possible to get the iOS simulator working on Windows. But if you are willing to explore a dual boot setup, have patience (and a supported motherboard/processor), then you could use OpenCore or Clover to get a macOS running on your pc. This will give you access to the iOS simulator and the other xcode tools.

If you take this route then you should know that macOS doesnt support ntfs writes out the box. This means that if you decide to create a shared volume that both the mac and windows partition would read and write from, then you would either need a 3rd party ntfs drive (e.g. macfuse) or to format your volume to exFAT (this gave me the best results and was free)

If you intend to run the latest macOS I would recommend going with OpenCore. The latest Clover versions ports pieces of OpenCore to it, and finding documentation on configuring the new Clover was a hassle for me. If you are fine with running Catalina and using an older xcode (and thus older iOS simulator), then I would recommend giving tonymac tools a shot. Building the installer took with very little effort. You need an account to download the tools (this is free but they ask for motherboard/gpu model for community posts and verification that you can actually run their software)


问:
Android Emulator Homescreen Looks Cracked
I can't figure out why this keeps happening. Every emulator that I have created will at some point or another develop a weird glitch on the home screen that makes the device look as if the screen is cracked internally. This doesn't seem to change the way that my apps run or operate. However it is rather frustrating especially seeing as there seems to be no consistency as to when the screen will bug out. Also I can't for the life of me figure out what could possibly be causing the change to occur. Seems to happen at randomly sometimes it will be from the first launch of the emulator and other times I'll use the emulator for a few days and then it will just boot up with the same visual bug out of no where. Image of Cracked Screen Glitch

.

Below is the event log from the launch I used to take the screenshot.

4:36 PM Executing tasks: [:app:assembleDebug] in project D:\App_Dev\Calculator_Demo

4:36 PM Gradle build finished in 1 s 146 ms

4:36 PM App restart successful without requiring a re-install.

4:36 PM Launch succeeded

4:37 PM Adb connection Error:An existing connection was forcibly closed by the remote host

4:37 PM Unable to open connection to ADB server: java.io.IOException: Can't find adb server on port 5037, IPv4 attempt: Connection refused: connect, IPv6 attempt: Connection refused: connect

4:37 PM Cannot reach ADB server, attempting to reconnect.

4:37 PM Failed to start monitoring emulator-5554

4:37 PM * daemon not running; starting now at tcp:5037

4:37 PM * daemon started successfully

4:37 PM Failed to start monitoring emulator-5554

.

Below this is an event log from a  2nd launch after completely closing the emulator.

4:42 PM Executing tasks: [:app:assembleDebug] in project D:\App_Dev\Calculator_Demo

4:42 PM Gradle build finished in 709 ms

4:42 PM App restart successful without requiring a re-install.

4:42 PM Launch succeeded

4:42 PM Failed to start monitoring emulator-5554

答: open: tools->Troubleshoot Device Connections</p>


问:
How can I use react-datepicker in the ReScript app
I`m trying to use an external library such as react-datepicker.

My code and usage:

```<code>module DatePicker = {
  @react.component @module("react-datepicker")
  external make: () => React.element = "default";
}

@react.component
let make = () => {
  <DatePicker />
}
</code>```

However, I`ve got an error:

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of ...

P.S.:
I tried a solution from this answer Can't create ReasonML bindings for react-contenteditable but it doesn't help me with an error

答:
@scope decorator is a solution

```<code>module Dp = {
  @react.component @module("react-datepicker") @scope("default")
  external make: () => React.element = "default";
}

@react.component
let make = () => {
  <Dp />
}
</code>```

https://forum.rescript-lang.org/t/help-with-binding-currying/1540/11?u=grigoryev

Body:
I`m trying to use an external library such as react-datepicker.

My code and usage:

module DatePicker = {
  @react.component @module("react-datepicker")
  external make: () => React.element = "default";
}

@react.component
let make = () => {
  <DatePicker />
}

However, I`ve got an error:

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of ...

P.S.:
I tried a solution from this answer Can't create ReasonML bindings for react-contenteditable but it doesn't help me with an error

Body:
@scope decorator is a solution

module Dp = {
  @react.component @module("react-datepicker") @scope("default")
  external make: () => React.element = "default";
}

@react.component
let make = () => {
  <Dp />
}

https://forum.rescript-lang.org/t/help-with-binding-currying/1540/11?u=grigoryev


问:
Python/NumPy first occurrence of subarray
In Python or NumPy, what is the best way to find out the first occurrence of a subarray?

For example, I have

```<code>a = [1, 2, 3, 4, 5, 6]
b = [2, 3, 4]
</code>```

What is the fastest way (run-time-wise) to find out where b occurs in a? I understand for strings this is extremely easy, but what about for a list or numpy ndarray?

Thanks a lot!

[EDITED] I prefer the numpy solution, since from my experience numpy vectorization is much faster than Python list comprehension. Meanwhile, the big array is huge, so I don't want to convert it into a string; that will be (too) long.

答:
I'm assuming you're looking for a numpy-specific solution, rather than a simple list comprehension or for loop. One straightforward approach is to use the rolling window technique to search for windows of the appropriate size.

This approach is simple, works correctly, and is much faster than any pure Python solution. It should be sufficient for many use cases. However, it is not the most efficient approach possible, for a number of reasons. For an approach that is more complicated, but asymptotically optimal in the expected case, see the numba-based rolling hash implementation in norok2's answer.

Here's the rolling_window function:

```<code>>>> def rolling_window(a, size):
...     shape = a.shape[:-1] + (a.shape[-1] - size + 1, size)
...     strides = a.strides + (a. strides[-1],)
...     return numpy.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)
...
</code>```

Then you could do something like

```<code>>>> a = numpy.arange(10)
>>> numpy.random.shuffle(a)
>>> a
array([7, 3, 6, 8, 4, 0, 9, 2, 1, 5])
>>> rolling_window(a, 3) == [8, 4, 0]
array([[False, False, False],
       [False, False, False],
       [False, False, False],
       [ True,  True,  True],
       [False, False, False],
       [False, False, False],
       [False, False, False],
       [False, False, False]], dtype=bool)
</code>```

To make this really useful, you'd have to reduce it along axis 1 using all:

```<code>>>> numpy.all(rolling_window(a, 3) == [8, 4, 0], axis=1)
array([False, False, False,  True, False, False, False, False], dtype=bool)
</code>```

Then you could use that however you'd use a boolean array. A simple way to get the index out:

```<code>>>> bool_indices = numpy.all(rolling_window(a, 3) == [8, 4, 0], axis=1)
>>> numpy.mgrid[0:len(bool_indices)][bool_indices]
array([3])
</code>```

For lists you could adapt one of these rolling window iterators to use a similar approach.

For very large arrays and subarrays, you could save memory like this:

```<code>>>> windows = rolling_window(a, 3)
>>> sub = [8, 4, 0]
>>> hits = numpy.ones((len(a) - len(sub) + 1,), dtype=bool)
>>> for i, x in enumerate(sub):
...     hits &= numpy.in1d(windows[:,i], [x])
...
>>> hits
array([False, False, False,  True, False, False, False, False], dtype=bool)
>>> hits.nonzero()
(array([3]),)
</code>```

On the other hand, this will probably be somewhat slower.

Body:
In Python or NumPy, what is the best way to find out the first occurrence of a subarray?

For example, I have

a = [1, 2, 3, 4, 5, 6]
b = [2, 3, 4]

What is the fastest way (run-time-wise) to find out where b occurs in a? I understand for strings this is extremely easy, but what about for a list or numpy ndarray?

Thanks a lot!

[EDITED] I prefer the numpy solution, since from my experience numpy vectorization is much faster than Python list comprehension. Meanwhile, the big array is huge, so I don't want to convert it into a string; that will be (too) long.

Body:
I'm assuming you're looking for a numpy-specific solution, rather than a simple list comprehension or for loop. One straightforward approach is to use the rolling window technique to search for windows of the appropriate size.

This approach is simple, works correctly, and is much faster than any pure Python solution. It should be sufficient for many use cases. However, it is not the most efficient approach possible, for a number of reasons. For an approach that is more complicated, but asymptotically optimal in the expected case, see the numba-based rolling hash implementation in norok2's answer.

Here's the rolling_window function:

>>> def rolling_window(a, size):
...     shape = a.shape[:-1] + (a.shape[-1] - size + 1, size)
...     strides = a.strides + (a. strides[-1],)
...     return numpy.lib.stride_tricks.as_strided(a, shape=shape, strides=strides)
...

Then you could do something like

>>> a = numpy.arange(10)
>>> numpy.random.shuffle(a)
>>> a
array([7, 3, 6, 8, 4, 0, 9, 2, 1, 5])
>>> rolling_window(a, 3) == [8, 4, 0]
array([[False, False, False],
       [False, False, False],
       [False, False, False],
       [ True,  True,  True],
       [False, False, False],
       [False, False, False],
       [False, False, False],
       [False, False, False]], dtype=bool)

To make this really useful, you'd have to reduce it along axis 1 using all:

>>> numpy.all(rolling_window(a, 3) == [8, 4, 0], axis=1)
array([False, False, False,  True, False, False, False, False], dtype=bool)

Then you could use that however you'd use a boolean array. A simple way to get the index out:

>>> bool_indices = numpy.all(rolling_window(a, 3) == [8, 4, 0], axis=1)
>>> numpy.mgrid[0:len(bool_indices)][bool_indices]
array([3])

For lists you could adapt one of these rolling window iterators to use a similar approach.

For very large arrays and subarrays, you could save memory like this:

>>> windows = rolling_window(a, 3)
>>> sub = [8, 4, 0]
>>> hits = numpy.ones((len(a) - len(sub) + 1,), dtype=bool)
>>> for i, x in enumerate(sub):
...     hits &= numpy.in1d(windows[:,i], [x])
...
>>> hits
array([False, False, False,  True, False, False, False, False], dtype=bool)
>>> hits.nonzero()
(array([3]),)

On the other hand, this will probably be somewhat slower.


问:
How to dynamically filter DataTable in ASP.NET based on SQL Query input from user
Is there any way to possibly filter data in DataTable without using LINQ and Entity Framework? Output can be Enumerable.

I was able to run 2nd line of code using LINQ and Basic filter using myDataTable.Select statement.

myDataTable.Select("[Name] is NULL OR [Name] <> 'n/a'" )

myDataTable.Select("select sum(col1), col2 group by col1, col2")

答:
DataTable is spesific object and you produce a datatable any ways. For examle with code or with SqlConnection object. What is your database name?

For filter to datatable, i use this code in my project:

```<code>dim dt as DataTable
Dim result() As DataRow = dt.Select("ColumnName='" & YourValue & "')
</code>```

Body:
DataTable is spesific object and you produce a datatable any ways. For examle with code or with SqlConnection object. What is your database name?

For filter to datatable, i use this code in my project:

dim dt as DataTable
Dim result() As DataRow = dt.Select("ColumnName='" & YourValue & "')


问:
Export mmtable from R
I am trying to export a generated mmtable either as .png or directly to the word.
I have already tried saveWidget and webshot. But any attempt is without success. Do you have any advice on how to export a mmtable, please?

```<code>library(mmtable2)
library(gt)
library(tidyverse)
</code>```

1.0 Data Transformation -----

```<code>data_wrangled <- mpg %>%
  group_by(manufacturer, cyl) %>%
  summarise(across(.cols = c(cty, hwy), .fns = mean)) %>%
  ungroup() %>%
  pivot_longer(
    cols = c(cty, hwy),
    names_to = "fuel_economy_type",
    values_to = "fuel_economy"
  )

data_wrangled
</code>```

2.0 Table Main ----

```<code>main_table <- data_wrangled %>%
  mutate(fuel_economy = round(fuel_economy, 1)) %>%

  mmtable(cells = fuel_economy, table_name = "Fuel Economy") +

  # Specify Headers
  header_top(manufacturer) +
  header_left(cyl) +
  header_left_top(fuel_economy_type) +

  # Specify formatting
  header_format(manufacturer, list(cell_text(transform = "capitalize"))) +
  header_format(fuel_economy_type, list(cell_text(transform = "uppercase"))) +
  table_format(
    locations = list(
      cells_body(rows = c(2, 6))
    ),
    style     = list(
      cell_borders(sides = "top", color = "grey")
    )
  )

main_table
saveWidget(main_table, "temp.html")
webshot("temp.html", "main_table.png", vwidth = 441, vheight = 351)
</code>```

答:
You can export your mmtable2 table with the gtsave function from the gt package.

Your codes should look something like this:

gtsave(apply_formats(main_table), filename = "main_table.rtf")

or

gtsave(apply_formats(main_table), filename = "main_table.png")

Title: Export mmtable from R

Body:
I am trying to export a generated mmtable either as .png or directly to the word.
I have already tried saveWidget and webshot. But any attempt is without success. Do you have any advice on how to export a mmtable, please?

library(mmtable2)
library(gt)
library(tidyverse)

1.0 Data Transformation -----

data_wrangled <- mpg %>%
  group_by(manufacturer, cyl) %>%
  summarise(across(.cols = c(cty, hwy), .fns = mean)) %>%
  ungroup() %>%
  pivot_longer(
    cols = c(cty, hwy),
    names_to = "fuel_economy_type",
    values_to = "fuel_economy"
  )

data_wrangled

2.0 Table Main ----

main_table <- data_wrangled %>%
  mutate(fuel_economy = round(fuel_economy, 1)) %>%

  mmtable(cells = fuel_economy, table_name = "Fuel Economy") +

  # Specify Headers
  header_top(manufacturer) +
  header_left(cyl) +
  header_left_top(fuel_economy_type) +

  # Specify formatting
  header_format(manufacturer, list(cell_text(transform = "capitalize"))) +
  header_format(fuel_economy_type, list(cell_text(transform = "uppercase"))) +
  table_format(
    locations = list(
      cells_body(rows = c(2, 6))
    ),
    style     = list(
      cell_borders(sides = "top", color = "grey")
    )
  )

main_table
saveWidget(main_table, "temp.html")
webshot("temp.html", "main_table.png", vwidth = 441, vheight = 351)


问:
Is the distributionManagement element really needed with the maven release plugin?
I assumed for a long time that the distributionManagement tag was required for the maven release plugin because it needs to know where to upload the released artifacts.
But to some extent this is true. If I configure my pom.xml like this, maven complains about missing distributionManagement:

```<code><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.github.nbauma109</groupId>
    <artifactId>jd-util</artifactId>
    <version>1.0.16-SNAPSHOT</version>
    <scm>
        <connection>scm:git:https://github.com/nbauma109/jd-util.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/nbauma109/jd-util.git</developerConnection>
        <url>https://github.com/nbauma109/jd-util</url>
        <tag>HEAD</tag>
    </scm>
</project>
</code>```

The error is the following:

```<code>Error: 5,765 [INFO] 15:33:25,764 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project jd-util: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
Error: 5,765 [INFO] 15:33:25,764 [ERROR]
Error: 5,765 [INFO] 15:33:25,764 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: 5,765 [INFO] 15:33:25,764 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
Error: 5,765 [INFO] 15:33:25,764 [ERROR]
Error: 5,765 [INFO] 15:33:25,764 [ERROR] For more information about the errors and possible solutions, please read the following articles:
Error: 5,765 [INFO] 15:33:25,764 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
15:33:25,784 [INFO] ------------------------------------------------------------------------
15:33:25,784 [INFO] BUILD FAILURE
15:33:25,784 [INFO] ------------------------------------------------------------------------
15:33:25,786 [INFO] Total time:  14.696 s
15:33:25,786 [INFO] Finished at: 2022-02-05T15:33:25Z
15:33:25,786 [INFO] ------------------------------------------------------------------------
Error: 5,791 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:perform (default-cli) on project jd-util: Maven execution failed, exit code: '1' -> [Help 1]
Error: 5,791 [ERROR]
Error: 5,791 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: 5,791 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
Error: 5,791 [ERROR]
Error: 5,791 [ERROR] For more information about the errors and possible solutions, please read the following articles:
Error: 5,792 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
</code>```

I found that it's possible to skip the deploy stage with the property maven.deploy.skip=true like in this answer https://stackoverflow.com/a/23222265/8315843 or by configuring the plugin:

https://maven.apache.org/plugins/maven-deploy-plugin/faq.html

```<code><plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-deploy-plugin</artifactId>
  <version>X.Y</version>
  <configuration>
    <skip>true</skip>
  </configuration>
</plugin>
</code>```

However, this isn't even necessary. If I just explicitly configure the release plugin with the same version that was picked up by default (i.e., version 2.5.3), it stops complaining about the distributionManagement.

```<code><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.github.nbauma109</groupId>
    <artifactId>jd-util</artifactId>
    <version>1.0.16-SNAPSHOT</version>
    <scm>
        <connection>scm:git:https://github.com/nbauma109/jd-util.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/nbauma109/jd-util.git</developerConnection>
        <url>https://github.com/nbauma109/jd-util</url>
        <tag>HEAD</tag>
    </scm>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <tagNameFormat>@{project.version}</tagNameFormat>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
</code>```

What's going on here ?

答:
I got confused in my first anaylsis.

Basically there are 2 options :

Configure the release plugin to set the goals to install (comment from @khmarbaise and also his older answer):

https://stackoverflow.com/a/59917365/8315843

```<code><plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <configuration>
    <arguments>${arguments}</arguments>
    <goals>install</goals>
    <autoVersionSubmodules>true</autoVersionSubmodules>
    </configuration>
</plugin>
</code>```

Configure the deploy plugin to skip the deploy step :

https://maven.apache.org/plugins/maven-deploy-plugin/faq.html

```<code><plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-deploy-plugin</artifactId>
  <version>X.Y</version>
  <configuration>
    <skip>true</skip>
  </configuration>
</plugin>
</code>```

Body:
I assumed for a long time that the distributionManagement tag was required for the maven release plugin because it needs to know where to upload the released artifacts.
But to some extent this is true. If I configure my pom.xml like this, maven complains about missing distributionManagement:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.github.nbauma109</groupId>
    <artifactId>jd-util</artifactId>
    <version>1.0.16-SNAPSHOT</version>
    <scm>
        <connection>scm:git:https://github.com/nbauma109/jd-util.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/nbauma109/jd-util.git</developerConnection>
        <url>https://github.com/nbauma109/jd-util</url>
        <tag>HEAD</tag>
    </scm>
</project>

The error is the following:

Error: 5,765 [INFO] 15:33:25,764 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project jd-util: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
Error: 5,765 [INFO] 15:33:25,764 [ERROR]
Error: 5,765 [INFO] 15:33:25,764 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: 5,765 [INFO] 15:33:25,764 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
Error: 5,765 [INFO] 15:33:25,764 [ERROR]
Error: 5,765 [INFO] 15:33:25,764 [ERROR] For more information about the errors and possible solutions, please read the following articles:
Error: 5,765 [INFO] 15:33:25,764 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
15:33:25,784 [INFO] ------------------------------------------------------------------------
15:33:25,784 [INFO] BUILD FAILURE
15:33:25,784 [INFO] ------------------------------------------------------------------------
15:33:25,786 [INFO] Total time:  14.696 s
15:33:25,786 [INFO] Finished at: 2022-02-05T15:33:25Z
15:33:25,786 [INFO] ------------------------------------------------------------------------
Error: 5,791 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:perform (default-cli) on project jd-util: Maven execution failed, exit code: '1' -> [Help 1]
Error: 5,791 [ERROR]
Error: 5,791 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
Error: 5,791 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
Error: 5,791 [ERROR]
Error: 5,791 [ERROR] For more information about the errors and possible solutions, please read the following articles:
Error: 5,792 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

I found that it's possible to skip the deploy stage with the property maven.deploy.skip=true like in this answer https://stackoverflow.com/a/23222265/8315843 or by configuring the plugin:

https://maven.apache.org/plugins/maven-deploy-plugin/faq.html

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-deploy-plugin</artifactId>
  <version>X.Y</version>
  <configuration>
    <skip>true</skip>
  </configuration>
</plugin>

However, this isn't even necessary. If I just explicitly configure the release plugin with the same version that was picked up by default (i.e., version 2.5.3), it stops complaining about the distributionManagement.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.github.nbauma109</groupId>
    <artifactId>jd-util</artifactId>
    <version>1.0.16-SNAPSHOT</version>
    <scm>
        <connection>scm:git:https://github.com/nbauma109/jd-util.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/nbauma109/jd-util.git</developerConnection>
        <url>https://github.com/nbauma109/jd-util</url>
        <tag>HEAD</tag>
    </scm>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <tagNameFormat>@{project.version}</tagNameFormat>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

What's going on here ?

Body:
I got confused in my first anaylsis.

Basically there are 2 options :

Configure the release plugin to set the goals to install (comment from @khmarbaise and also his older answer):

https://stackoverflow.com/a/59917365/8315843

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <configuration>
    <arguments>${arguments}</arguments>
    <goals>install</goals>
    <autoVersionSubmodules>true</autoVersionSubmodules>
    </configuration>
</plugin>

Configure the deploy plugin to skip the deploy step :

https://maven.apache.org/plugins/maven-deploy-plugin/faq.html

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-deploy-plugin</artifactId>
  <version>X.Y</version>
  <configuration>
    <skip>true</skip>
  </configuration>
</plugin>