javascript – Setear value de un input radio a un input text vacio

Quiero pasar el value de un input radio seleccionado en un modal, a un input text vacio que tengo en un formulario.

Radio del modal:

        <div class="img-user-profile">
            @foreach($files as $image)
                <label class="checkeable">
                    <input type="radio" id="image-profile-radio" name="image-profile" value="{{'images/user-profile/'.$image->getRelativePathname()}}"/>
                    <img src="{{asset('images/user-profile/'.$image->getRelativePathname()) }}">
                </label>
            @endforeach

 <button id="confirm-image-profile" class="btn btn-primary btn-block joinOnlineEventButton">
 Confirm selection
 </button>

Lo quiero guardar en este campo del formulario del cual se abre el modal.

                <div class="hide">
                    <input type="text" class="input-image-random" name="input-image-random" id="input-image-random" value="">

                </div>

He probado con estas dos funciones, pero no logro que se quede guardado en el value del input text:

$("#confirm-image-profile").click(function() {
    $("#confirm-image-profile").click(function() {
        $("input(name='image-profile')").change(function(){
            $("#input-image-random").val($("input(name='image-profile'):checked").val());
        });
    });
});

$("#confirm-image-profile").click(function() {
    let imageProfile = $("input(name='image-profile'):checked").val();
    let imagenProfileForm = imageProfile;
    console.log(imagenProfileForm + ' a')
    console.log(imageProfile)
    $('#show-upload-user-photo').modal('hide');

});

¿Alguien me puede ayudar a guardar ese valor ahí?

windows – Simulate mouse input message for free look in fps games

This question was previously asked in stackoverflow where no one gives an answer. I also found a similiar question here, but in my situation, I hook and simulate mouse inputs and send them to the game window.


Here is the body of the original question:

After hooking windows mouse and keyboard APIs, I wanted to simulate the mouse input message for free look technique (Move the mouse to rotate the player character’s view). Before coding, I used spy++ to monitor a fps game observing which mouse-related message was sent to the window of the game’s program. I got these following lines when I moved the mouse:

P WM_INPUT nInputCode:RIM_INPUT hRawInput:065A04FD
S WM_NCHITTEST xPos:2504 yPos:889
R WM_NCHITTEST nHittest:HTCLIENT
S WM_SETCURSOR hwnd:0016089A nHittest:HCLIENT wMouseMsg:WM_MOUSEMOVE
R WM_SETCURSOR fHaltProcessing:True
P WM_MOUSEMOVE fwKeys:0000 xPos:419 yPos:183
...

So I wrote these lines of codes (sent WM_INPUT message using codes in How to simulate raw input / Send a WM_INPUT message to an application the right way?, Simulating Raw Input on Windows, and codes in github):

// ...
// mData->px and mData->py indicating the mouse position in client window are double type.
WORD xCor = static_cast<WORD>(mData->px);
WORD yCor = static_cast<WORD>(mData->py);
LPARAM lParamMouseMove = (yCor << 16) | (xCor & 0xFFFFFFFF); // lParam for mouse movement message

// prepare for sending WM_INPUT
LONG _mouse_position.x = static_cast<long>(mData->px);
LONG _mouse_position.y = static_cast<long>(mData->py);
WPARAM wParamRawMouse = RIM_INPUT;
HGLOBAL hRaw = ::GlobalAlloc(GHND, sizeof(RAWINPUT));
RAWINPUT* pRaw = reinterpret_cast<RAWINPUT*>(::GlobalLock(hRaw));

memset((void*)pRaw, 0, sizeof(RAWINPUT));
pRaw->header.dwType = RIM_TYPEMOUSE;
pRaw->header.dwSize = sizeof(RAWINPUT);
pRaw->header.hDevice = GetRawMouseDevice();  // can return the mouse HANDLE correctly
pRaw->header.wParam = wParamRawMouse;

RAWMOUSE rawMouseInfo;
memset((void*)&rawMouseInfo, 0, sizeof(RAWMOUSE));
rawMouseInfo.usFlags = MOUSE_MOVE_RELATIVE;
rawMouseInfo.lLastX = _mouse_position.x - _last_mouse_position.x;  // get the mouse's location change
rawMouseInfo.lLastY = _mouse_position.y - _last_mouse_position.y;
rawMouseInput.data.mouse = rawMouseInfo;
rawMouseInfo.ulExtraInformation = 0;
rawMouseInfo.ulButtons = 0;
rawMouseInfo.usButtonFlags = 0;
rawMouseInfo.ulRawButtons = 0;
pRaw = &rawMouseInput;

::GlobalUnlock(hRaw);

// mainGameWnd is the main window handle
PostMessageA(mainGameWnd, WM_INPUT, wParamRawMouse, (LPARAM)hRaw);
SendMessageA(mainGameWnd, WM_NCHITTEST, 0, MAKELPARAM(_mouse_position.x, _mouse_position.y));
SendMessageA(mainGameWnd, WM_SETCURSOR, (WPARAM)mainGameWnd, MAKELPARAM(HTCLIENT,WM_MOUSEMOVE));
PostMessageA(mainGameWnd, WM_MOUSEMOVE, 0, lParamMouseMove);
// ...

And I used spy++ to monitor my own program:

P WM_INPUT nInputCode:RIM_INPUT hRawInput:0000023822711808
S WM_NCHITTEST xPos:492 yPos:373
R WM_NCHITTEST nHittest:HTNOWHERE
S WM_SETCURSOR hwnd:001B0794 nHittest:HCLIENT wMouseMsg:WM_MOUSEMOVE
R WM_SETCURSOR fHaltProcessing:True
P WM_MOUSEMOVE fwKeys:0000 xPos:492 yPos:373

It didn’t work, when I moved the mouse, the character’s view didn’t change and the cursor just moved.
So how to correctly send the four message? Do some magics beyond sending message for free look in games? By the way, this question mentions camera, I think in this hooking situation, the camera is still handled by the game and I just need to send mouse-related message to the game. No need to consider the camera. Am I right?

Modifying default input form for Sharepoint List

I have a Sharepoint list that I am modifying, and my customers like the default input form (image below) but are requesting I add a few fields to this/make minor formatting changes to it. They do not want the layout of a customized form in Power Apps. My question(s) are:

  1. Is it possible to modify the below input form with a few additional fields (that are already found in my list but not currently displayed in the form)? If not…

  2. Is there a way I can use Power Apps to modify the default form layout below, adding the fields that I’m looking to add?

I’m new to maintaining Sharepoint lists and using Power Apps, so a simple solution is preferred here, if at all possible.

Thanks in advance.

enter image description here

headphones – Macbook Air + Logitech G773 headset speeding up videos and not detecting mic input

I recently bought a Macbook Air (Late 2020 M1). I also bought a Logitech G773 headset. Since the receiver is USB-A, and the ports are USB-C, I have an adapter/hub that I am plugging the headset receiver into. If my computer is on when I plug the receiver in, the audio works, but the mic input does not (even after selecting the proper audio input/output in both the app and System Settings). The weirder thing is that when watching videos, such as on Youtube or elsewhere, the video will speed up and go back to normal speed, somewhat randomly.

Things I have tried:

  • Rebooting audio via this answer
  • Unplugging and plugging it back in.
  • Uninstalling/reinstalling the Logitech app
  • Using a different USB adapter (with no other devices)

Restarting fixes the problem, but it is kind of a pain to do it every time I plug in my headset. Has anyone had a similar issue and can offer a solution?

unity – How to go back to the old input system?

I have tried using Unity’s new input system, but it’s incredibly hard to learn, the documentation is poor, and the old system is much easier to work with. I would like to revert my project back to the old system, but I am unsure how to do that. How do i disable the package and reconfigure my project so it will accept code using the old system?

differential equations – Asymptotic Output Tracking – Where to Place the Input Control Signal?

Asymptotic Output Tracking: Code Issues

I ask for help from specialists in differential equations, dynamical systems, optimal control and
general control theory;

I have the following system of differential equations:

begin{cases} frac{dx(t)}{dt}=G(t) \ frac{dz(t)}{dt}+z(t)=frac{df}{dt} \ frac{dG(t)}{dt}+G(t)=z(t) cdot alpha sin(omega t) \ frac{dH(t)}{dt}+H(t)=z(t) cdot (frac{16}{alpha^2}(sin(omega t)-frac{1}{2})) \ frac{dX(t)}{dt}+X(t)=frac{dx(t)}{dt} end{cases}

where, $x,z,G,H,X$ – variables; $f=-(x(t)+alpha sin(omega t)-x_e)^2$; $alpha, omega$ – parameters.

As an output $y$, I assign:

$y=tanh(k cdot H(t))$

As an reference signal $r_1$, I assign:

$r_1=-1$

As an constant time $p_1$, I assign:

$p_1=-1$

Well, I tried to program this in the Mathematica program and ran into a difficulty that I can’t get over yet. Question: in which of the equations should the control signal $u(t)$ be placed?

I chose the first equation, then the original system of equations will look like this:

begin{cases} frac{dx(t)}{dt}=G(t)+u(t) \ frac{dz(t)}{dt}+z(t)=frac{df}{dt} \ frac{dG(t)}{dt}+G(t)=z(t) cdot alpha sin(omega t) \ frac{dH(t)}{dt}+H(t)=z(t) cdot (frac{16}{alpha^2}(sin(omega t)-frac{1}{2})) \ frac{dX(t)}{dt}+X(t)=frac{dx(t)}{dt} end{cases}

(***)

Clear("Derivative")

ClearAll("Global`*")

Needs("Parallel`Developer`")

S(t) = (Alpha) Sin((Omega) t)

M(t) = 16/(Alpha)^2 (Sin((Omega) t) - 1/2)

f = -(x(t) + S(t) - xe)^2

Parallelize(
 asys = AffineStateSpaceModel({x'(t) == G(t) + u(t), 
     z'(t) + z(t) == D(f, t), G'(t) + G(t) == z(t) S(t), 
     H'(t) + H(t) == z(t) M(t), 
     1/k X'(t) + X(t) == D(x(t), t)}, {{x(t), xs}, {z(t), 0.1}, {G(t),
       0}, {H(t), 0}, {X(t), 0}}, {u(t)}, {Tanh(k H(t))}, t) // 
   Simplify)

pars1 = {Subscript(r, 1) -> -1, Subscript(p, 1) -> -1}

Parallelize(
 fb = AsymptoticOutputTracker(asys, {-1}, {-1, -1}) // Simplify)

pars = {xs = -1, xe = 1, (Alpha) = 0.3, (Omega) = 2 Pi*1/2/Pi, 
  k = 100, (Mu) = 1}

Parallelize(
 csys = SystemsModelStateFeedbackConnect(asys, fb) /. pars1 // 
    Simplify // Chop)

plots = {OutputResponse({csys}, {0, 0}, {t, 0, 1})}

At the end, I get an error.

At t == 0.005418556209176463`, step size is effectively zero; 
singularity or stiff system suspected

It seems to me that this is due to the fact that either in the system there is a ksk somewhere, or I have put the control input signal in the wrong equation. I need the support of a theorist who can help me choose the right sequence of actions to solve the problem.

I would be glad to any advice and help.

platformer – How to detect taps vs tilts in analog stick input

I’m trying to implement a very simple Smash Bros style game using SDL2 and C++.

I’ve been trying to figure out how to handle analog stick inputs like Super Smash Bros. Melee and Rivals of Aether do. Specifically:

  • Q. How to detect tilts vs taps (i.e. for dashing, etc.)?
  • Q. Do I need to use input buffers / separate input buffers for analog sticks and face buttons?
  • Q. Should I poll for input events or use a function that just returns the current stick position?
  • Q. Polling for stick movement can result in a lot of analog stick change events. Should I consolidate them or just use the last event?

Attempt #1

This is what I did originally:

  • Poll for input events via SDL_PollEvent
  • Update the game controller state with the latest input events
    • The game controller state does not track order of input events
    • The game controller state is designed to reflect the final state of the controller

As the game controller state is updated with new events, it calculates the change in stick position and determines if the player tapped/smashed the stick or not. This seems okay for simple cases, but we don’t know the order of inputs. I feel it can be done better.

Attempt #2

I have also tried introducing an input buffer. Essentially, all of the input events are pushed into a ring buffer (button press events and analog stick events exist in the same buffer). The ring buffer is passed to a state machine that iterates over the events and updates the state. This implementation is what lead to this post.

Other Info

I used the following for learning about SSBM:

Rivals of Aether appears to use an input buffer of 6 frames. So the game will result in a dash if the analog stick exceeds a certain threshold within that number of frames.

settings – How can I prevent my soft keyboard from changing for different input types?

I would like to disable the soft keyboard mode (gboard) for inputType=textUri on my Pixel 4a, and fall back on the default text keyboard mode.

Coming from a much older version of Android which supported fewer inputTypes, I am finding it difficult to adjust to these similar-yet-subtly-different soft keyboards. In particular, the uri mode is causing problems for me, as mobile browsers tend to use it in their top url/search bar. This causes me problems because punctuation commonly used for logic in search, such as “, +, -, :, !, etc, are removed from their usual location (on my keyboard, behind the period), and replaced with shortcuts for common top level domains.

I would like my keyboard to always be the same, or at least, I would like to disable some of the input modes that are similar enough to be confusing.

I understand that this input type feature may not be intended to be configurable.
Still, I would appreciate any advice that can be offered.

strings – C scrabble counter with piping input

I want to start making some command line programs in C, this is a fork of something else I made but is more suitable to this site. My big question is there a better way to pipe commands? I think the way I did it feels improper. I especially feel the string method is a bit hacky.

#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
#include <string.h>
int main(int argc, char *argv())
{
    char t(32767);
    unsigned int val = 0;
    if (argc == 2)
    {
        memset(t, '', sizeof(t));
        strcpy(t, argv(1));
    }
    else
    {
        read(STDIN_FILENO, t, 32767);
    }
    for (int i = 0; t(i); i++)
    {
        t(i) = tolower(t(i));
    }
    int i;
    for (i = 0; t(i) != ''; i++)
    {
        switch (t(i))
        {
        case 'a':
        case 'e':
        case 'i':
        case 'o':
        case 'u':
        case 'l':
        case 'n':
        case 's':
        case 't':
        case 'r':
            val += 1;
            break;
        case 'd':
        case 'g':
            val += 2;
            break;
        case 'b':
        case 'c':
        case 'm':
        case 'p':
            val += 3;
            break;
        case 'f':
        case 'h':
        case 'v':
        case 'w':
        case 'y':
            val += 4;
            break;
        case 'k':
            val += 5;
            break;
        case 'j':
        case 'x':
            val += 8;
            break;
        case 'q':
        case 'z':
            val += 10;
        }
    }
    printf("%in", val);
    return 0;
}

I know this is similar to Scrabble word scoring, but I am less interested in the switch but the stdin and the piping.

c# – Visual Studio not recognizing Unity’s new Input system

I’m attempting to learn Unity’s new input system, but when I try to add using UnityEngine.InputSystem; to my code it getsa red squiggly line under it. It doesn’t cause any compiler errors, but it’s very annoying. How do i get Visual Studio to recognize this so Intellisense will work again?