java – Optional int parameter ‘id’ is present but cannot be translated into a null value due to being declared as a primitive type

me encuentro con un error que no sé por donde cogerlo. Estoy realizando un api/rest de android studio (RetroFit) con SpringBoot (como servidor).
Resulta que me encuentro con este error:

 Optional int parameter 'id' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.

Expongo retrofit interface:

 @PUT("editPlayer{id}")
    Call<PlayerDto> editPlayer(@Body PlayerDto player, @Path("id") int id);

Expongo llamada al servidor:

Settings.RESPONSE_CLIENT.getService()
.editPlayer(editedPlayer, 53)
.enqueue(new Callback<PlayerDto>() {
   @Override
   public void onResponse(Call<PlayerDto> call, Response<PlayerDto> response) {
      editedPlayer = response.body();
      typeError = 0;
   }

   @Override
   public void onFailure(Call<PlayerDto> call, Throwable t) {
      Log.e("Error: ", t.getMessage());
      typeError = 2;
   }
});

Expongo servidor Controller:

@PutMapping("/editPlayer{id}")
    public Player editPlayer(@RequestBody Player player, @Param("id") int id) {
        return service.editPlayer(player.getUsername(), id);
    }

Expongo servidor PlayerService:

public Player editPlayer(String username, int id) {

        repoPlayer.editUserNamePlayer(username, id);
        Optional<Player> player = repoPlayer.findById(id);

        return player.get();
    }

Expongo IPlayerRepository, aunque solo es la “Query” :

@Modifying
    @Query("UPDATE Player p SET p.username= :username WHERE p.id= :id")
    public void editUserNamePlayer(@Param("username")String username, @Param("id") Integer id);

Realizo pruebas con Insomnia y no tengo ningún problema adjunto imagen:
imagen de captura test insomnia put api/rest

Pero no tengo manera de enviar la id desde android studio, parece que se le envia “null”.
Ni ingresandolo a mano ni recogiendolo por parámetro.

Necesito ayuda, muchas gracias de antemano.

iteration – FoldList with Composition and parameter

Good day to everyone!

I have two (just for simple example) functions and they compose a map:

m(t_):=RotationMatrix(t).#&
s(k_):={#((1)),#((2))-k2 #((1))^2}&
map=Composition(m(0.2),s(2))

If I use this map in NestList all works nice:

NestList(map,{0.01,0.001},1000)

But now I want to change the first argument t of m(t) at each (or with some step) iteration. For this I was hoping to use FoldList, but this does not work:

FoldList(Composition(m(0.2+#2)&,s(2)),{0.01,0.001},Range(0.01,0.02,0.001))

How can I use Composition in FoldList?

bessel functions – Compute the conditional probability distribution of a noncentral $chi$ variable given the range of Erlang distributed non-centrality parameter

I need to compute a conditional probability distribution as described below for my research.

In $(mathbb R^2,||cdot||_2)$, I have a random vector $underline{z}$ with uniformly distributed angle and $Z=||underline{z}||$ following Erlang distribution with $k=2$ and scale parameter $mu$, i.e. with the density function $f_Z(z)=frac{z}{mu^2}e^{-frac{z}{mu}}$. I have another normal random vector $underline{y}$ independent of $underline{z}$. I’m interested in the resultant vector $underline{x}=underline{y}+underline{z}$ and want to compute the conditional distribution of $X=||underline{x}||$ given $aleq||underline{z}||leq b,0leq a<bleqinfty$, to be specific, the complementary cumulative distribution function $overline{F}_{X|Z}(x|(a,b))=P(X>x|aleq Zleq b)$. Solutions for special cases where $Zleq c$ or $Zgeq c$ for any $c>0$ would be sufficient for my research if they are easier to solve.

Following is my attempt. Given a fixed $Z=z$, since $underline{y}$ is normal, $X$ follows the noncentral $chi$ distribution with $k=2$ and non-centrality parameter $lambda=z$, i.e. $f_{X|Z}(x|z)=xe^{-frac{x^2+z^2}{2}}I_0(xz)$, where $I_0(x)=frac{1}{pi}int_0^pi e^{xcosalpha}dalpha$ is a modified Bessel function of the first kind. Then the density function of the conditional distribution is
$$f_{X|Z}(x|(a,b))=frac{int_a^b f_Z(z)f_{X|Z}(x|z)dz}{int_a^b f_Z(z)dz}$$

The denominator $int_a^b f_Z(z)dz=gamma(2,frac{b}{mu})-gamma(2,frac{a}{mu})$ where $gamma$ is the lower incomplete gamma function.

Change the order of integration, the numerator is
$$begin{align}
int_a^b f_Z(z)f_{X|Z}(x|z)dz & = frac{1}{pi}int_a^bfrac{z}{mu^2}e^{-frac{z}{mu}}xe^{-frac{x^2+z^2}{2}}int_0^pi e^{xcosalpha}dalpha \
& = frac{x}{pimu^2}e^{-frac{x^2}{2}}int_0^pi e^{frac{1}{2}(frac{1}{mu}-xcosalpha)^2}int_a^b ze^{-frac{1}{2}(z+frac{1}{mu}-xcosalpha)^2}dzdalpha \
& = frac{x}{pimu^2}e^{-frac{x^2}{2}}int_0^pi e^{frac{beta^2}{2}}left(e^{-bar{a}^2}-e^{-bar{b}^2}+sqrt{frac{pi}{2}}left(operatorname{erf}bar{a}-operatorname{erf}bar{b}right)right)dalpha
end{align}$$

where $beta=frac{1}{mu}-xcosalpha$, $bar{a}=frac{a+beta}{sqrt{2}},bar{b}=frac{b+beta}{sqrt{2}}$, $operatorname{erf}$ is the error function.

Then I got stuck at the second integral. I am looking for an analytical expression of $f_{X|Z}(x|(a,b))$. I tried numerical integration and compared it to a simulation using matlab. The results are as expected.

Finally, what I want is an analytical expression of $overline{F}_{X|Z}(x|(0,c))=P(X>t|Zleq c)=int_t^infty f_{X|Z}(x|(0,c))dx$ and $overline{F}_{X|Z}(x|(c,infty))=P(X>t|Zgeq c)=int_t^infty f_{X|Z}(x|(c,infty))dx$.

Is it possible?

8 – OAuth2 Server sending ‘null’ as the ‘sub’ parameter instead of User Id

When using OAuth2 Server module to authorize with users, I am not receiving the correct “sub” parameter in the response from the server. I get all the other fields such as email, email_verified, name, preferred_username, and zoneinfo; just not the sub parameter.

{
  "sub": null,
  "email": "someuser@email.com",
  "email_verified": true,
  "name": "SomeUser",
  "preferred_username": "SomeUser",
  "zoneinfo": "Asia/Dubai"
}

I’ve tried using hook_oauth2_server_user_claims to alter this parameter like so:

function my_module_oauth_server_user_claims($account, $requested_scopes) {
  $claims = ();

  if (in_array('profile', $requested_scopes)) {
    $claims('sub') = $account->id();
    $claims('user_id') = $account->id(); // for debugging purposes
  }

  return $claims;
} 

Doing this adds the user_id parameter to the response body, but the ‘sub’ is still set as ‘null’, therefore it must get override afterwards.

I double checked the documentation and have all the permissions set, but can’t find anything about this particular issue.. Why is `sub’ not being populated correctly during this process?

SharePoint Classic view via URL parameter

Is it possible to force SharePoint to use Classic experience with URL parameters?

(For example https://companyname.sharepoint.com/Lists/ListName/AllItems.aspx?ClassicExperience=True)

There is a Bookmark list that we uses on a daily basis, but some of our custom developed pages are not properly showing in the Modern experience, and our colleges have to click on “Change back to old SharePoint” link every single time.

There is a link that leads to the Classic SharePoint:

<a class="LeftNav-notificationLink" role="menuitem" data-bind="attr: { href: $data.url, target: $data.openInNewTab &amp;&amp; $data.openInNewTab() ? '_blank' : null, tabindex: $component.isLeftNavVisible() ? 0: -1, 'aria-label': $data.altText }, visible: !$data.show || $data.show(), click: $component.onClick.bind($component), automation: $data.automationId, automationType: 'Link'" href="#" tabindex="0" aria-label="Kattintson vagy nyomja le az enter billentyűt, ha vissza szeretne térni a klasszikus SharePointra" data-automationtype="Link">
<span class="LeftNav-linkText" data-bind="text: $data.text">Vissza a klasszikus SharePointra</span>
</a>

c++ – warning: ‘struct task_struct’ “Declared inside parameter list will not be visible outside of this definition or declaration”

I have the following piece of code:

File sched.h

   #include <stats.h>
   truct task_struct {
       ...
       struct stats stat;
   };

File stats.h*

   #include <sched.h>
   struct stats
   {
   ...
   };

   void initStats (struct task_struct* tsk);

When I try to compile it gives me the following warning

warning: ‘struct task_struct’ declared inside parameter list will not be visible outside of this definition or declaration
17 | void initStats (struct task_struct* tsk);

I have seen similar questions posted, but I have not been able to fix the problem. I was wondering if the problem was because both files include each other. Any help would be appreciated : ).

termux – Emulate tsu when the device su binary doesn’t support command as a parameter

The stock su binary from the semi-officially rooted Meizu smartphone (Android 7, Flyme 7) does not support passing commands as parameters (–c option) so tsu fails with an error “invalid option — c”.
I’m trying to emulate the actions that tsu performs with a script that I manually should start after executing the su binary. The debug output of tsu revealed the environment variables and its values that tsu tried to set so I prepared the following script with them and I start the script with the source alias (in order to preserve the changes for the current session)

export PATH=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/system/bin:/system/xbin:/sbin:/sbin/bin
export ANDROID_DATA=/data  
export TMPDIR=/data/data/com.termux/files/home/.suroot/.tmp
export PREFIX=/data/data/com.termux/files/usr
export TERM=xterm-256color
export LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
export ANDROID_ROOT=/system
export HOME=/data/data/com.termux/files/home/.suroot

Is this the correct way to emulate tsu actions for termux to work correctly from the superuser? I see that some apps I installed from the general termux user work (mc, nano), but I suspect I can face an unexpected issue in the future. Probably there’s a more suitable way to achieve the same effect (when the su binary is too basic)?