问:
Undefined reference to memrchr in GCC
I am trying to use memrchr in my project. It is a GNU extension function. But I am getting undefined reference to 'memrchr' error. I have included string.h. __GNUC__ is defined and has a value of 12. My GCC version is 12.2.0.

```<code>> gcc --version
gcc.exe (Rev6, Built by MSYS2 project) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
</code>```

Minimal reproducible example:

```<code>#define _GNU_SOURCE

#include <string.h>

int main() {
    memrchr("hello", 'l', 5);
}
</code>```
```<code>> gcc .\src\temp.c
.\src\temp.c: In function 'main':
.\src\temp.c:6:9: warning: implicit declaration of function 'memrchr'; did you mean 'memchr'? [-Wimplicit-function-declaration]
    6 |         memrchr("hello", 'l', 5);
      |         ^~~~~~~
      |         memchr
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\SOURAV~1\AppData\Local\Temp\ccodiFYq.o:temp.c:(.text+0x23): undefined reference to `memrchr'
collect2.exe: error: ld returned 1 exit status
</code>```

Title: Undefined reference to memrchr in GCC

Body:
I am trying to use memrchr in my project. It is a GNU extension function. But I am getting undefined reference to 'memrchr' error. I have included string.h. __GNUC__ is defined and has a value of 12. My GCC version is 12.2.0.

> gcc --version
gcc.exe (Rev6, Built by MSYS2 project) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Minimal reproducible example:

#define _GNU_SOURCE

#include <string.h>

int main() {
    memrchr("hello", 'l', 5);
}

> gcc .\src\temp.c
.\src\temp.c: In function 'main':
.\src\temp.c:6:9: warning: implicit declaration of function 'memrchr'; did you mean 'memchr'? [-Wimplicit-function-declaration]
    6 |         memrchr("hello", 'l', 5);
      |         ^~~~~~~
      |         memchr
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\SOURAV~1\AppData\Local\Temp\ccodiFYq.o:temp.c:(.text+0x23): undefined reference to `memrchr'
collect2.exe: error: ld returned 1 exit status


来源: stackexchange

问:
is there a way to extract column definitions from SQL stored procs?
I have ~50 SQL Stored procs.

Is there a python or R package that can be used to extract column definitions?

I have looked at sqlparse, and found that it does not recognize stored procs.

I am thinking using regex's, but that will be quite a lengthy project.

ContentLicense: CC BY-SA 4.0


问:
Confidence interval for unmatched win ratio in SAS
I am trying to find the 95% confidence interval for the unmatched win ratio method according to Pocock et al (The win ratio: a new approach to the analysis of composite endpoints in clinical trials based on clinical priorities. doi: 10.1093/eurheartj/ehr352.). I am presenting my code with a demo dataset.

```<code>data demo;
   input ID $ Rank $ Drug;
   datalines;
1 5 1
2 3 1
3 1 2
4 9 2
5 2 2
6 7 1
7 4 2
8 6 1
9 10 1
10 8  2
;
run;

proc sort data=demo;
   by Rank;
run;

proc print data=demo;
run;

proc sql noprint;
   create table merged as select a.rank as rank_1,b.rank as rank_2,
      sum(ifn(rank_1 gt rank_2,1,0)) as numb_wins,
      sum(ifn(rank_2 gt rank_1,1,0)) as numb_loses,
      sum(ifn(rank_1 eq rank_2,1,0)) as numb_ties,
      count(*) as total,
      calculated numb_wins / calculated numb_loses as win_ratio
   from demo (where=(Drug eq 1)) as a,
      demo (where=(Drug eq 2)) as b;

   create table merged2 as select distinct *
   from merged(drop=rank_1 rank_2);
quit;

proc surveyselect data= demo out= bootstrapped
   seed=1234 method=srs reps=1000 samprate=1;
run;
</code>```

First I calculate the win ratio and in the last part using proc surveyselect I create a bootstrapped dataset with 1000 replicates. After this part I am stack. How do I find the win ratio for each Replicate ?

I tried using group by Replicate but in my original bootstrapped dataset that contains 1.7 million observations I get an error that column Replicate is in more than one table.

Body:
I am trying to find the 95% confidence interval for the unmatched win ratio method according to Pocock et al (The win ratio: a new approach to the analysis of composite endpoints in clinical trials based on clinical priorities. doi: 10.1093/eurheartj/ehr352.). I am presenting my code with a demo dataset.

data demo;
   input ID $ Rank $ Drug;
   datalines;
1 5 1
2 3 1
3 1 2
4 9 2
5 2 2
6 7 1
7 4 2
8 6 1
9 10 1
10 8  2
;
run;

proc sort data=demo;
   by Rank;
run;

proc print data=demo;
run;

proc sql noprint;
   create table merged as select a.rank as rank_1,b.rank as rank_2,
      sum(ifn(rank_1 gt rank_2,1,0)) as numb_wins,
      sum(ifn(rank_2 gt rank_1,1,0)) as numb_loses,
      sum(ifn(rank_1 eq rank_2,1,0)) as numb_ties,
      count(*) as total,
      calculated numb_wins / calculated numb_loses as win_ratio
   from demo (where=(Drug eq 1)) as a,
      demo (where=(Drug eq 2)) as b;

   create table merged2 as select distinct *
   from merged(drop=rank_1 rank_2);
quit;

proc surveyselect data= demo out= bootstrapped
   seed=1234 method=srs reps=1000 samprate=1;
run;

First I calculate the win ratio and in the last part using proc surveyselect I create a bootstrapped dataset with 1000 replicates. After this part I am stack. How do I find the win ratio for each Replicate ?

I tried using group by Replicate but in my original bootstrapped dataset that contains 1.7 million observations I get an error that column Replicate is in more than one table.


问:
Eclipse maven not using given user settings.xml
I set up a maven project in eclipse and because I'm behind a proxy, I gave the proxy settings in D:\tools\....\settings.xml. Eclipse is set up to use this path, when I click Run as -> Maven Build ... in eclipse, I see the correct path in the field "User Settings". But the debug output of maven tells me:

```<code>[DEBUG] Reading global settings from settings.xml
[DEBUG] Reading user settings from C:\Users\...\settings.xml
</code>```

consequently: no proxy,  ... Could not resolve dependencies ...

How can I convince maven to use my settings in D:\...?

Body:
I set up a maven project in eclipse and because I'm behind a proxy, I gave the proxy settings in D:\tools\....\settings.xml. Eclipse is set up to use this path, when I click Run as -> Maven Build ... in eclipse, I see the correct path in the field "User Settings". But the debug output of maven tells me:

[DEBUG] Reading global settings from settings.xml
[DEBUG] Reading user settings from C:\Users\...\settings.xml

consequently: no proxy,  ... Could not resolve dependencies ...

How can I convince maven to use my settings in D:\...?


问:
How to loop id of the text field in the table using JavaScript in the project asp.net 6 MVC
I am looking for anyone who can assist me on this issue I am facing. I am looking for how to loop the ids I set in my table body on input fields where I have to choose item from the selection options then to populate the data calculated to fill two other input text fields using id in the JavaScript. The issue is I can get the data filled to the input fields but only on the first row when I add the second row it changes the data in the same first row. See the attachments.

```<code><table class="table table-hover MyTable table-bordered" id="MyTable">
    <thead>
        <tr>
            <th style="width:19%;">
                Product Code
            </th>
            <th style="width:24%;">
                Product Name
            </th>
            <th style="width:15%;">
                Quantity
            </th>
            <th style="width:15%;">
                Price
            </th>
            <th style="width:15%;">
                Amount
            </th>
            <th style="width:12%;">
                <button id='btnAddDetailRow' type="button" class="btn btn-sm btn-secondary visible" onclick="AddItem()">
                    Add
                </button>
            </th>
        </tr>
    </thead>
    <tbody>
        @for (int i = 0; i < Model.InvoiceDetails.Count; i++)
        {
            <tr>
                <td style="width:19%;">
                    <select asp-for="@Model.InvoiceDetails[i].ProductId" id="lstProduct" class="form-control Product" asp-items="@ViewBag.Products" onchange=" getProductName(this); getPrice(this); changeData(this);"></select>
                    <span asp-validation-for="@Model.InvoiceDetails[i].ProductId" class="text-danger"></span>
                </td>
                <td style="width:24%;">
                    <input asp-for="@Model.InvoiceDetails[i].Product" id="txtProductName" class="form-control form-control-plaintext" readonly />
                    <span asp-validation-for="@Model.InvoiceDetails[i].Product" class="text-danger"></span>
                </td>
                <td style="width:15%;">
                    <input asp-for="@Model.InvoiceDetails[i].Quantity" class="form-control QtyTotal" />
                    <span asp-validation-for="@Model.InvoiceDetails[i].Quantity" class="text-danger"></span>
                </td>
                <td style="width:15%;">
                    <input asp-for="@Model.InvoiceDetails[i].Price" id="txtPrice" class="form-control form-control-plaintext PriceTotal" readonly />
                    <span asp-validation-for="@Model.InvoiceDetails[i].Price" class="text-danger"></span>
                </td>
                <td style="width:15%;">
                    <input type="hidden" asp-for="@Model.InvoiceDetails[i].IsDeleted" />
                    <input asp-for="@Model.InvoiceDetails[i].Amount" class="form-control form-control-plaintext AmountTotal" readonly />
                    <span asp-validation-for="@Model.InvoiceDetails[i].Amount" class="text-danger"></span>
                </td>
                <td style="width:12%;">
                    <button id='btnremove-@i' type="button" class="btn btn-sm btn-danger visible" onclick="DeleteItem(this)">
                        Delete
                    </button>
                </td>
            </tr>
        }
    </tbody>
</table>
</code>```

JavaScript

```<code><script type="text/javascript">

function getPrice(productId) {

            var lstbox = document.getElementById('dropdownPrice');

            var txtPrice = document.getElementById('txtPrice');

            var items = lstbox.options;

            for (var i = items.length - 1; i >= 0; i--) {
                if (items[i].value == productId.value) {
                    txtPrice.value = items[i].text;
                    return;
                }
            }
            return;
        }

        function getProductName(productId) {

            var lstbox = document.getElementById('dropdownProductName');

            var txtProductName = document.getElementById('txtProductName');

            var items = lstbox.options;

            for (var i = items.length - 1; i >= 0; i--) {
                if (items[i].value == productId.value) {
                    txtProductName.value = items[i].text;
                    return;
                }
            }
            return;
        }

        function AddItem(btn) {

            var table;
            table = document.getElementById('MyTable');
            var rows = table.getElementsByTagName('tr');
            var rowOuterHtml = rows[rows.length - 1].outerHTML;

            var lastrowIdx = rows.length - 2;

            var nextrowIdx = eval(lastrowIdx) + 1;

            rowOuterHtml = rowOuterHtml.replaceAll('_' + lastrowIdx + '_', '_' + nextrowIdx + '_');
            rowOuterHtml = rowOuterHtml.replaceAll('[' + lastrowIdx + ']', '[' + nextrowIdx + ']');
           rowOuterHtml = rowOuterHtml.replaceAll('-' + lastrowIdx, '-' + nextrowIdx);

           var newRow = table.insertRow();
           newRow.innerHTML = rowOuterHtml;

           var x = document.getElementsByTagName("INPUT");

           for (var cnt = 0; cnt < x.length; cnt++) {
               if (x[cnt].type == "text" && x[cnt].id.indexOf('_' + nextrowIdx + '_') > 0) {
               if (x[cnt].id.indexOf('Unit') == 0)
                   x[cnt].value = '';
               }
               else if (x[cnt].type == "number" &&
                   x[cnt].id.indexOf('_' + nextrowIdx + '_') > 0)
                       x[cnt].value = 0;
               }

       }
    </script>
}
</code>```

attached video Problem presentation

Body:
I am looking for anyone who can assist me on this issue I am facing. I am looking for how to loop the ids I set in my table body on input fields where I have to choose item from the selection options then to populate the data calculated to fill two other input text fields using id in the JavaScript. The issue is I can get the data filled to the input fields but only on the first row when I add the second row it changes the data in the same first row. See the attachments.

                Product Code

                Product Name

                Quantity

                Price

                Amount

                <button id='btnAddDetailRow' type="button" class="btn btn-sm btn-secondary visible" onclick="AddItem()">
                    Add
                </button>

        @for (int i = 0; i < Model.InvoiceDetails.Count; i++)
        {

                    <select asp-for="@Model.InvoiceDetails[i].ProductId" id="lstProduct" class="form-control Product" asp-items="@ViewBag.Products" onchange=" getProductName(this); getPrice(this); changeData(this);"></select>

                    <input asp-for="@Model.InvoiceDetails[i].Product" id="txtProductName" class="form-control form-control-plaintext" readonly />

                    <input asp-for="@Model.InvoiceDetails[i].Quantity" class="form-control QtyTotal" />

                    <input asp-for="@Model.InvoiceDetails[i].Price" id="txtPrice" class="form-control form-control-plaintext PriceTotal" readonly />

                    <input type="hidden" asp-for="@Model.InvoiceDetails[i].IsDeleted" />
                    <input asp-for="@Model.InvoiceDetails[i].Amount" class="form-control form-control-plaintext AmountTotal" readonly />

                    <button id='btnremove-@i' type="button" class="btn btn-sm btn-danger visible" onclick="DeleteItem(this)">
                        Delete
                    </button>

        }

JavaScript

}

attached video Problem presentation


问:
Why RMSE values is so high in forecasting using LSTM?
I'm trying to predict the number of tourist arrivals using LSTM in Python. But it turns out the RMSE value is too high, 100k and above. Do you have any idea why it happens?

I've modified the codings using sharing in github but the RMSE value is still high. Please help me solve this problem.


问:
Incorrect dependencies when upgrading MySQL from 5.7 to 8.0 on Debian 11
I am attempting to upgrade MySQL server from 5.7 to 8.0 on a Debian 11 machine after upgrading Jessie -> Bullseye.

Original MySQL 5.7 package was installed using basic apt-get install mysql-server.

I have read the "Replacing a Native Distribution of MySQL Using the MySQL APT Repository" guide however when following this guide I still have a conflict between mysql-common 5.7 and 8.0.

Here is an example of what I am doing:

```<code># Delete old mysql installation and all related dependencies
> sudo apt-get remove automysqlbackup mariadb-common libmariadb3 sysbench mysql-community-client mysql-community-server mysql-common mysql-server mysql-client
> sudo apt-get autoremove

# Configure 8.0
> sudo wget https://repo.mysql.com//mysql-apt-config_0.8.24-1_all.deb
> sudo dpkg -i mysql-apt-config_0.8.24-1_all.deb

# Update
> sudo apt-get update

# Install
> sudo apt-get install mysql-server

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mysql-community-server : Depends: mysql-common (>= 8.0.31-1debian11)
                          Depends: mysql-client (= 8.0.31-1debian11) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
</code>```

For whatever reason if I install mysql-common it still installs 5.8. Purging it does not help.

```<code>> sudo apt list -a mysql-common
Listing... Done
mysql-common/unknown 8.0.31-1debian11 all [residual-config]
mysql-common/stable,now 5.8+1.0.7 all [residual-config]
</code>```
```<code>> sudo apt-get install mysql-common

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  mysql-common
0 upgraded, 1 newly installed, 0 to remove and 49 not upgraded.
Need to get 0 B/7,464 B of archives.
After this operation, 34.8 kB of additional disk space will be used.
Selecting previously unselected package mysql-common.
(Reading database ... 82684 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.8+1.0.7_all.deb ...
Unpacking mysql-common (5.8+1.0.7) ...
Setting up mysql-common (5.8+1.0.7) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Scanning processes...
Scanning candidates...
Scanning linux images...

Running kernel seems to be up-to-date.

Restarting services...
 systemctl restart containerd.service

No containers need to be restarted.

No user sessions are running outdated binaries.

</code>```

The only "solution" I could find is to install it manually from the deb:

```<code>wget https://repo.mysql.com//mysql-apt-config_0.8.24-1_all.deb
tar -xvf mysql-apt-config_0.8.24-1_all.deb
sudo dpkg -i mysql-common_8.0.31-1debian11_amd64.deb
</code>```

After which apt-get install mysql-server works. However it seems hacky and not a proper way to do it at all.

What am I doing incorrectly here?

Body:
I am attempting to upgrade MySQL server from 5.7 to 8.0 on a Debian 11 machine after upgrading Jessie -> Bullseye.

Original MySQL 5.7 package was installed using basic apt-get install mysql-server.

I have read the "Replacing a Native Distribution of MySQL Using the MySQL APT Repository" guide however when following this guide I still have a conflict between mysql-common 5.7 and 8.0.

Here is an example of what I am doing:

# Delete old mysql installation and all related dependencies
> sudo apt-get remove automysqlbackup mariadb-common libmariadb3 sysbench mysql-community-client mysql-community-server mysql-common mysql-server mysql-client
> sudo apt-get autoremove

# Configure 8.0
> sudo wget https://repo.mysql.com//mysql-apt-config_0.8.24-1_all.deb
> sudo dpkg -i mysql-apt-config_0.8.24-1_all.deb

# Update
> sudo apt-get update

# Install
> sudo apt-get install mysql-server

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mysql-community-server : Depends: mysql-common (>= 8.0.31-1debian11)
                          Depends: mysql-client (= 8.0.31-1debian11) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

For whatever reason if I install mysql-common it still installs 5.8. Purging it does not help.

> sudo apt list -a mysql-common
Listing... Done
mysql-common/unknown 8.0.31-1debian11 all [residual-config]
mysql-common/stable,now 5.8+1.0.7 all [residual-config]

> sudo apt-get install mysql-common

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  mysql-common
0 upgraded, 1 newly installed, 0 to remove and 49 not upgraded.
Need to get 0 B/7,464 B of archives.
After this operation, 34.8 kB of additional disk space will be used.
Selecting previously unselected package mysql-common.
(Reading database ... 82684 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.8+1.0.7_all.deb ...
Unpacking mysql-common (5.8+1.0.7) ...
Setting up mysql-common (5.8+1.0.7) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Scanning processes...
Scanning candidates...
Scanning linux images...

Running kernel seems to be up-to-date.

Restarting services...
 systemctl restart containerd.service

No containers need to be restarted.

No user sessions are running outdated binaries.

The only "solution" I could find is to install it manually from the deb:

wget https://repo.mysql.com//mysql-apt-config_0.8.24-1_all.deb
tar -xvf mysql-apt-config_0.8.24-1_all.deb
sudo dpkg -i mysql-common_8.0.31-1debian11_amd64.deb

After which apt-get install mysql-server works. However it seems hacky and not a proper way to do it at all.

What am I doing incorrectly here?


问:
Confusing recursive behaviour
I am trying to figure out stuff about recursion (I am studying go)
and by playing around I did this.
playground

```<code>package main

import (
    "fmt"
)

func main() {
    recurse(0)
}

func recurse(i int) {
    if i >= 6 {
        return
    }
    i++
    fmt.Println(i)
    recurse(i)
    rerecurse(i)
    fmt.Println(i)
}
func rerecurse(i int) {
    i++
    recurse(i)
}
</code>```

and this give this:
1, 2, 3, 4, 5, 6, 6, 5, 6, 6, 4, 5, 6, 6, 5, 3, 4, 5, 6, 6, 5, 6, 6, 4, 2, 3, 4, 5, 6, 6, 5, 6, 6, 4, 5, 6, 6, 5, 3, 1

Then I got really confused it get really long if you increase the ceil value (e.g. from 6 to 20)
It does not look like there is any order in that sequence, can any of you shed some light on it?
By the way any good resource to share on how call stack works so I can understand recursion instead of admitting it?

Title: Confusing recursive behaviour

Body:
I am trying to figure out stuff about recursion (I am studying go)
and by playing around I did this.
playground

package main

import (
    "fmt"
)

func main() {
    recurse(0)
}

func recurse(i int) {
    if i >= 6 {
        return
    }
    i++
    fmt.Println(i)
    recurse(i)
    rerecurse(i)
    fmt.Println(i)
}
func rerecurse(i int) {
    i++
    recurse(i)
}

and this give this:
1, 2, 3, 4, 5, 6, 6, 5, 6, 6, 4, 5, 6, 6, 5, 3, 4, 5, 6, 6, 5, 6, 6, 4, 2, 3, 4, 5, 6, 6, 5, 6, 6, 4, 5, 6, 6, 5, 3, 1

Then I got really confused it get really long if you increase the ceil value (e.g. from 6 to 20)
It does not look like there is any order in that sequence, can any of you shed some light on it?
By the way any good resource to share on how call stack works so I can understand recursion instead of admitting it?


问:
Union/Join tables with partly similar structure
I have a question about joining/unioning 2 tables in SQL

I have a structure as follows
Table 1:

A
B
C

T1
X23
ASD

T2
X21
DAS

Table 2:

A
B
D

T3
X11
23

T5
X10
100

A and B contain the same contents, but have no link between each other
A -> Tagname
B -> Adress

C and D are other things

I want a resulting table like this

A
B
C
D

T1
X23
ASD
NULL

...
...
...
...

T5
X10
NULL
100

I was thinking about doing union on the A and B Column and then joining C and D, but i don´t really know how i would do that.
Any Ideas?

Thanks


Title: Export 2 dimensional array data to excel file

Body:
I have a 2 dimensional array like below. How to print output to execl with number of columns = length of array parent.
In each column, the data in the sub-array is foreach and filled vertically similar to the illustration.

I use Laravel 6.2, maatwebsite/excel 3.2

[
0 => [
0 => ["cid" => "99201000000001"],
1 => ["cid" => "99201000000002"],
2 => ["cid" => "99201000000003"],
3 => ["cid" => "99201000000004"],
4 => ["cid" => "99201000000005"],
5 => ["cid" => "99201000000006"],
6 => ["cid" => "99201000000007"],
7 => ["cid" => "99201000000008"]
],
1 => [
0 => ["cid" => "99201000000001"],
1 => ["cid" => "99201000000002"],
2 => ["cid" => "99201000000003"],
3 => ["cid" => "99201000000004"],
4 => ["cid" => "99201000000005"]
],
2 => [
0 => ["cid" => "99201000000001"],
1 => ["cid" => "99201000000002"],
2 => ["cid" => "99201000000003"],
3 => ["cid" => "99201000000004"],
4 => ["cid" => "99201000000005"]
],
3 => [
0 => ["cid" => "99201000000001"],
1 => ["cid" => "99201000000002"],
2 => ["cid" => "99201000000003"]
],
4 => [
0 => ["cid" => "99201000000001"]
],
5 => [],
6 => []
]

I tried with this code but it's not right

            @foreach($usersData as $key => $value)
            {{++$key}} 台紙
            @endforeach

            @foreach($usersData as $key => $userList)
            @foreach($userList as $key => $user)

                {{$user['cid']}}

            @endforeach
            @endforeach


问:
Updating to Spring Security 6.0 bring org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jwtFilter'
I'm trying to upgrade to Spring Boot 3.0.0 and Spring Security 6.0.

when i learn my project i get this error :

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jwtFilter': Unsatisfied dependency expressed through field 'jwtUtility': Error creating bean with name 'jwtUtility': Injection of autowired dependencies failed

My code in WebSecurityConfiguration file:

```<code>package com.ims.usermanagement.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;

import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;

import com.ims.usermanagement.jwt.JwtFilter;

@Configuration
@EnableWebSecurity
public class WebSecurityConfiguration {

  @Autowired
  private JwtFilter jwtFilter;

  @Autowired
  private AuthEntryPointJwt unauthorizedHandler;

  @Bean
  public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration)
      throws Exception {
    return authenticationConfiguration.getAuthenticationManager();
  }

  @Bean
  public PasswordEncoder passwordEncoder() {
    return new BCryptPasswordEncoder(11);
  }

  @Bean
  public SecurityFilterChain configure(HttpSecurity http) throws Exception {
    http.cors().and().csrf().disable()
        .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
        .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
        .authorizeHttpRequests()
        .requestMatchers("/authenticate/")
        .permitAll()
        .requestMatchers("/utilisateur/photos/{id}")
        .permitAll()
        .requestMatchers("/discussion/attachment/{id}")
        .permitAll()
        .requestMatchers("/retrait/file/{id}/{name}")
        .permitAll()
        .requestMatchers("/client/photos/{id}")
        .permitAll()
        .requestMatchers("/partenaire/photos/{id}")
        .permitAll()
        .requestMatchers("/resetPassword")
        .permitAll()
        .requestMatchers("/resetPassword/reset")
        .permitAll()
        .requestMatchers("/autopayment/\\?token=.*$")
        .permitAll()
        .anyRequest()
        .authenticated();
    http.addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class);
    return http.build();
  }

}```

thank you for your help
```

Body:
I'm trying to upgrade to Spring Boot 3.0.0 and Spring Security 6.0.

when i learn my project i get this error :

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jwtFilter': Unsatisfied dependency expressed through field 'jwtUtility': Error creating bean with name 'jwtUtility': Injection of autowired dependencies failed

My code in WebSecurityConfiguration file:

package com.ims.usermanagement.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;

import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;

import com.ims.usermanagement.jwt.JwtFilter;

@Configuration
@EnableWebSecurity
public class WebSecurityConfiguration {

  @Autowired
  private JwtFilter jwtFilter;

  @Autowired
  private AuthEntryPointJwt unauthorizedHandler;

  @Bean
  public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration)
      throws Exception {
    return authenticationConfiguration.getAuthenticationManager();
  }

  @Bean
  public PasswordEncoder passwordEncoder() {
    return new BCryptPasswordEncoder(11);
  }

  @Bean
  public SecurityFilterChain configure(HttpSecurity http) throws Exception {
    http.cors().and().csrf().disable()
        .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
        .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
        .authorizeHttpRequests()
        .requestMatchers("/authenticate/")
        .permitAll()
        .requestMatchers("/utilisateur/photos/{id}")
        .permitAll()
        .requestMatchers("/discussion/attachment/{id}")
        .permitAll()
        .requestMatchers("/retrait/file/{id}/{name}")
        .permitAll()
        .requestMatchers("/client/photos/{id}")
        .permitAll()
        .requestMatchers("/partenaire/photos/{id}")
        .permitAll()
        .requestMatchers("/resetPassword")
        .permitAll()
        .requestMatchers("/resetPassword/reset")
        .permitAll()
        .requestMatchers("/autopayment/\\?token=.*$")
        .permitAll()
        .anyRequest()
        .authenticated();
    http.addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter.class);
    return http.build();
  }

}```

thank you for your help


问:
Send corousel mms items using twilio python package
I have used twilio python to send mms with single image, Please how can I send carousel images as mms using twilio python. I have this items to send as corousel</p>
```<code>items = [
    {
        "media_url": "https://www.pexels.com/photo/assorted-color-kittens-45170/",
        "title": "Item 1",
        "subtitle": "Subtitle for item 1",
        "actions": [
            {
                "type": "url",
                "label": "View more",
                "url": "https://www.pexels.com/photo/assorted-color-kittens-45170/"
            }
        ]
    },
    {
        "media_url": "https://www.pexels.com/photo/photo-of-gray-cat-looking-up-against-black-background-730896/",
        "title": "Item 2",
        "subtitle": "Subtitle for item 2",
        "actions": [
            {
                "type": "url",
                "label": "View more",
                "url": "https://images.pexels.com/photos/730896/pexels-photo-730896.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2/"
            }
        ]
    },
</code>```

Body:
I have used twilio python to send mms with single image, Please how can I send carousel images as mms using twilio python. I have this items to send as corousel

items = [
    {
        "media_url": "https://www.pexels.com/photo/assorted-color-kittens-45170/",
        "title": "Item 1",
        "subtitle": "Subtitle for item 1",
        "actions": [
            {
                "type": "url",
                "label": "View more",
                "url": "https://www.pexels.com/photo/assorted-color-kittens-45170/"
            }
        ]
    },
    {
        "media_url": "https://www.pexels.com/photo/photo-of-gray-cat-looking-up-against-black-background-730896/",
        "title": "Item 2",
        "subtitle": "Subtitle for item 2",
        "actions": [
            {
                "type": "url",
                "label": "View more",
                "url": "https://images.pexels.com/photos/730896/pexels-photo-730896.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=2/"
            }
        ]
    },


问:
Collapsible/Accordion closing when i'm clicking on the other action in Collpase Body Content
I have a accordion with some details. Those detail have some features like search field, filter button. When i'm focusing or click on that filter or search field which are present in the accordion body. Accordion is getting closing. how can i solve that?</p>
```<code>const ViewList = () => {
    const [accordion, setAccordion] = useState([true, false]);
    const handleCollapse = useCallback(newIdx => {
    const state = accordion.map((val, index) => (index === newIdx ? !val : false));
    setAccordion(state);
  }, [accordion]);

  return (
<>
    <Card>
          <Collapsible
            open={accordion[0]}
            onClick={() => handleCollapse(0)}
            aria-expanded={accordion[0]}
            id="collapsible-1"
          >
When i'm click in this button why accordion get closing. how can i solve that?
           <Button onClick={() => {}}>Action 1</Button>
          </Collapsible>
    </Card>

    <Card>
          <Collapsible
            open={accordion[1]}
            onClick={() => handleCollapse(1)}
            aria-expanded={accordion[1]}
            id="collapsible-2"
          >
           <Button onClick={() => {}}>Action 2</Button>
          </Collapsible>
     </Card>
</>
)}
</code>```

Body:
I have a accordion with some details. Those detail have some features like search field, filter button. When i'm focusing or click on that filter or search field which are present in the accordion body. Accordion is getting closing. how can i solve that?

const ViewList = () => {
    const [accordion, setAccordion] = useState([true, false]);
    const handleCollapse = useCallback(newIdx => {
    const state = accordion.map((val, index) => (index === newIdx ? !val : false));
    setAccordion(state);
  }, [accordion]);

  return (
<>
    <Card>
          <Collapsible
            open={accordion[0]}
            onClick={() => handleCollapse(0)}
            aria-expanded={accordion[0]}
            id="collapsible-1"
          >
When i'm click in this button why accordion get closing. how can i solve that?
           <Button onClick={() => {}}>Action 1</Button>
          </Collapsible>
    </Card>

    <Card>
          <Collapsible
            open={accordion[1]}
            onClick={() => handleCollapse(1)}
            aria-expanded={accordion[1]}
            id="collapsible-2"
          >
           <Button onClick={() => {}}>Action 2</Button>
          </Collapsible>
     </Card>
</>
)}


问:
pause before data transfer for MMC card
I am working with a Chinese RK3568 processor and have implemented a data exchange driver with an mmc card. I use DMA for data transmission, but I still get unsatisfactory results in terms of speed. The figure shows that there is a pause between sending a command to read data (a small circle) and receiving actual data (a large oval) when we are just waiting for something and not doing anything. I don't understand why DMA is waiting for something and there is this pause. In my case, I'm just waiting for an interrupt to occur, which indicates that the transfer is completed. Maybe you need to adjust something in the map itself to increase the speed?

enter image description here

Title: pause before data transfer for MMC card


问:
pytype is not recognizing int or float output type as Number
I have a function that returns a number but it's not obvious what the user enters. It could accept a str, int or float. So I've type-hinted it as follows:

from numbers import Number

def to_number(value: Union[str, Number]) -> Number:
    if isinstance(value, Number) and math.isnan(value):
        raise ValueError(f"No NaNsense")

    try:
        return int(value)
    except ValueError:
        try:
            return float(value)
        except ValueError as exc:
            raise ValueError(f"'{value}' is not a number") from exc
```
<p>Upon running pytype on the file I get the following error:</p>
```File "whatever.py", line 8, in evaluate: bad return type [bad-return-type]
           Expected: numbers.Number
  Actually returned: int
File "whatever.py", line 11, in evaluate: bad return type [bad-return-type]
           Expected: numbers.Number
  Actually returned: float
```
<p>But in the REPL</p>
```>>> isinstance(int(5), numbers.Number)
True
>>> isinstance(float(5), numbers.Number)
True
```

What's the resolution here? I'm on CPython 3.7.13, PyType 2022.12.15

Body:
I have a function that returns a number but it's not obvious what the user enters. It could accept a str, int or float. So I've type-hinted it as follows:

from numbers import Number

def to_number(value: Union[str, Number]) -> Number:
    if isinstance(value, Number) and math.isnan(value):
        raise ValueError(f"No NaNsense")

    try:
        return int(value)
    except ValueError:
        try:
            return float(value)
        except ValueError as exc:
            raise ValueError(f"'{value}' is not a number") from exc

Upon running pytype on the file I get the following error:

File "whatever.py", line 8, in evaluate: bad return type [bad-return-type]
           Expected: numbers.Number
  Actually returned: int
File "whatever.py", line 11, in evaluate: bad return type [bad-return-type]
           Expected: numbers.Number
  Actually returned: float

But in the REPL

>>> isinstance(int(5), numbers.Number)
True
>>> isinstance(float(5), numbers.Number)
True

What's the resolution here? I'm on CPython 3.7.13, PyType 2022.12.15


问:
Unidentified publishing object in SwiftUI Map annotation
Setup:

My app uses a SwiftUI Map with annotations. The annotations should be instances of a Place class defined as:

```<code>final class Place: NSManagedObject, UpdateTimestampable, Identifiable {
    @NSManaged var horizontalAccuracy: Double
    @NSManaged var latitude: Double
    @NSManaged var longitude: Double
    @NSManaged var name: String
    @NSManaged var namesOfItemsBoughtHere: Set<String>?
    @NSManaged var radius: Double
    @NSManaged var updatedAt: Date?

    var coordinate: CLLocationCoordinate2D {
        var coord = CLLocationCoordinate2D()
        if let context = self.managedObjectContext {
            context.performAndWait {
                coord = CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
            }
        } else {
            fatalError("Place without context")
        }
        return coord
    }
}
</code>```

The places used as annotations in a specific map are defined by a MapViewModel:

```<code>    let placesForBuyLocationNames = mapViewModel.placesForBuyLocationNames()
</code>```

Problem:

When these places are used directly as annotations, a run time error is generated:

```<code>    let annotations = placesForBuyLocationNames
    Map(coordinateRegion: $region,
            interactionModes: .all,
            showsUserLocation: false,
            annotationItems: annotations) { annotation in
        MapAnnotation(coordinate: annotation.coordinate, anchorPoint: CGPoint(x: 0.5, y: 1)) {
                AnnotationView(region: region, buyPlaceNameBeforeDragging: annotation.name, mapviewModel: mapViewModel)
        }
    }
</code>```

Run time error:

```<code>Publishing changes from within view updates is not allowed, this will cause undefined behavior.
</code>```

No run time error is however generated, if these places are mapped to a helper struct and these structs are used as annotations:

```<code>struct Annotation: Identifiable {
    let id = UUID()
    let name: String
    let coordinate: CLLocationCoordinate2D
}
// …
            let annotations = placesForBuyLocationNames.map { Annotation(name: $0.name, coordinate: $0.coordinate) }
</code>```

Questions:

What could be the reason for this run time error?

Is anything wrong with my code?

Body:
Setup:

My app uses a SwiftUI Map with annotations. The annotations should be instances of a Place class defined as:

final class Place: NSManagedObject, UpdateTimestampable, Identifiable {
    @NSManaged var horizontalAccuracy: Double
    @NSManaged var latitude: Double
    @NSManaged var longitude: Double
    @NSManaged var name: String
    @NSManaged var namesOfItemsBoughtHere: Set<String>?
    @NSManaged var radius: Double
    @NSManaged var updatedAt: Date?

    var coordinate: CLLocationCoordinate2D {
        var coord = CLLocationCoordinate2D()
        if let context = self.managedObjectContext {
            context.performAndWait {
                coord = CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
            }
        } else {
            fatalError("Place without context")
        }
        return coord
    }
}

The places used as annotations in a specific map are defined by a MapViewModel:

    let placesForBuyLocationNames = mapViewModel.placesForBuyLocationNames()

Problem:

When these places are used directly as annotations, a run time error is generated:

    let annotations = placesForBuyLocationNames
    Map(coordinateRegion: $region,
            interactionModes: .all,
            showsUserLocation: false,
            annotationItems: annotations) { annotation in
        MapAnnotation(coordinate: annotation.coordinate, anchorPoint: CGPoint(x: 0.5, y: 1)) {
                AnnotationView(region: region, buyPlaceNameBeforeDragging: annotation.name, mapviewModel: mapViewModel)
        }
    }

Run time error:

Publishing changes from within view updates is not allowed, this will cause undefined behavior.

No run time error is however generated, if these places are mapped to a helper struct and these structs are used as annotations:

struct Annotation: Identifiable {
    let id = UUID()
    let name: String
    let coordinate: CLLocationCoordinate2D
}
// …
            let annotations = placesForBuyLocationNames.map { Annotation(name: $0.name, coordinate: $0.coordinate) }

Questions:

What could be the reason for this run time error?

Is anything wrong with my code?


问:
Inserting a html attribute to visited links on Chrome?
There's a way to apply CSS to a html tags where its link is a visited URL on the Chrome browser. It's a pseudo CSS :visited.

```<code>a:visited{
   color: red !important;
}
</code>```

What I want to do is to check if the a tag is a visited one or not, aka it has :visited or not.

I need this because later I can use that information for Tampermonkey or uBlock, so I need to be able to identity which a tags are visited or not through its html.

So, is it possible to make the html like this below with a JS?

```<code>// from this
<a target="_blank">a boring page I haven't visited yet</a>
<a target="_blank">an interesting page I already visited</a>
</code>```
```<code>// to this
<a target="_blank">a boring page I haven't visited yet</a>
<a target="_blank visited">an interesting page I already visited</a>
</code>```

Body:
There's a way to apply CSS to a html tags where its link is a visited URL on the Chrome browser. It's a pseudo CSS :visited.

a:visited{
   color: red !important;
}

What I want to do is to check if the a tag is a visited one or not, aka it has :visited or not.

I need this because later I can use that information for Tampermonkey or uBlock, so I need to be able to identity which a tags are visited or not through its html.

So, is it possible to make the html like this below with a JS?

// from this
a boring page I haven't visited yet
an interesting page I already visited

// to this
a boring page I haven't visited yet
an interesting page I already visited


问:
Outgoing IP address for PHP stream_socket_client() and fsockopen()
The library PHPMailer uses the functions stream_socket_client() and fsockopen() to connect to an SMTP server.

My server is using IPv4 and IPv6, and (in additional to a single stable IPv6 address) it defines multiple IPv6 addresses on each reboot.

The SMTP server is quite restrictive, and expects the requests to come from a single, specific IPv6 asdress. How do I tell PHP which IP address to use for outgoing connections?

I already found the CURLOPT_DNS_INTERFACE option for cURL, but nothing that refers to the above mentioned functions.


问:
How can I use EJS 'continue' loop keyword in my handlebars.js
How can I edit my register helper for using continue keyword?

I have a ejs code like this :

```<code><% for(let i = iterator; i <= endingLink; i++) { %>
        <% if(i === page) { %>
        <a class="selectedLink" href="/?page=<%=i%>"><%=i%></a>
        **<% continue; %>**  //this keyword confuses me in handblebars
    <% } %>
</code>```

My handlebars.js like this :

```<code>    {{#for iterator endingLink 1}}

       {{#ifCond iterator '===' page}}

        <a class="selectedLink" href="/?page={{iterator}}">{{iterator}}</a>

        {{/ifCond}}

    {{/for}}
</code>```

register helper:

```<code>hbs.registerHelper('for', function(from, to, incr, block) {
    var accum = '';
    for(var i = from; i <= to; i += incr)
        accum += block.fn(i);
    return accum;
});
</code>```

Body:
How can I edit my register helper for using continue keyword?

I have a ejs code like this :

<% for(let i = iterator; i <= endingLink; i++) { %>
        <% if(i === page) { %>
        <a class="selectedLink" href="/?page=<%=i%>"><%=i%>
        **<% continue; %>**  //this keyword confuses me in handblebars
    <% } %>

My handlebars.js like this :

    {{#for iterator endingLink 1}}

       {{#ifCond iterator '===' page}}

        {{iterator}}

        {{/ifCond}}

    {{/for}}

register helper:

hbs.registerHelper('for', function(from, to, incr, block) {
    var accum = '';
    for(var i = from; i <= to; i += incr)
        accum += block.fn(i);
    return accum;
});


问:
how to convert an rstp ffmpeg mp4 buffer into ImageData inside nodejs (nestjs)
I am reading an rtsp stream using ffmpeg in this way:

  const ffmpegArgs = [
    '-rtsp_transport',
    'tcp',
    '-i',
    this.rtspStreamPath,
    '-vcodec',
    'copy',
    '-f',
    'mp4',
    '-movflags',
    'frag_keyframe+empty_moov',
    '-reset_timestamps',
    '1',
    '-vsync',
    '1',
    '-flags',
    'global_header',
    '-bsf:v',
    'dump_extra',
    '-y',
    '-', // output to stdout
  ];
    const liveffmpeg = spawn(ffmpegPath, ffmpegArgs, {
      detached: false,
    });

    liveffmpeg.stdout.on('data', (data) => {
      console.log('data here!', data.toString());
    });
```

Later I pipe the liveffmpeg.stdout to the response object of my NestJS controller so it can be consumed by the frontend in a video HTML Element.

In the frontend I calculate this by doing a snapshot of the video element into a canvas,  getting the ImageData from the canvasContext and doing my calculations after I get two or more updates.

Now I need to do the exact same thing on the backend but I am not able to convert the data value from liveffmpeg.stdout.on('data', ) into an ImageData so I can use the same average function I use in the frontend.

I already installed node-canvas to try to reproduce the frontend steps but to be able to draw something inside the canvas context I need an Image and no Video object can be constructed in nodejs.

So, is there a way to convert the stdout data of the FFmpeg process into ImageData objects? Or, to extract the images of each data update so I can manually draw them on the node-canvas element and get the ImageData?

Thanks!

PDd: I think convert them into Uint8ClampedArray could also work since node-canvas has a function that uses that: createImageData(data: Uint8ClampedArray, width: number, height?: number) => ImageData

Body:
I am reading an rtsp stream using ffmpeg in this way:

  const ffmpegArgs = [
    '-rtsp_transport',
    'tcp',
    '-i',
    this.rtspStreamPath,
    '-vcodec',
    'copy',
    '-f',
    'mp4',
    '-movflags',
    'frag_keyframe+empty_moov',
    '-reset_timestamps',
    '1',
    '-vsync',
    '1',
    '-flags',
    'global_header',
    '-bsf:v',
    'dump_extra',
    '-y',
    '-', // output to stdout
  ];
    const liveffmpeg = spawn(ffmpegPath, ffmpegArgs, {
      detached: false,
    });

    liveffmpeg.stdout.on('data', (data) => {
      console.log('data here!', data.toString());
    });

Later I pipe the liveffmpeg.stdout to the response object of my NestJS controller so it can be consumed by the frontend in a video HTML Element.

In the frontend I calculate this by doing a snapshot of the video element into a canvas,  getting the ImageData from the canvasContext and doing my calculations after I get two or more updates.

Now I need to do the exact same thing on the backend but I am not able to convert the data value from liveffmpeg.stdout.on('data', ) into an ImageData so I can use the same average function I use in the frontend.

I already installed node-canvas to try to reproduce the frontend steps but to be able to draw something inside the canvas context I need an Image and no Video object can be constructed in nodejs.

So, is there a way to convert the stdout data of the FFmpeg process into ImageData objects? Or, to extract the images of each data update so I can manually draw them on the node-canvas element and get the ImageData?

Thanks!

PDd: I think convert them into Uint8ClampedArray could also work since node-canvas has a function that uses that: createImageData(data: Uint8ClampedArray, width: number, height?: number) => ImageData


问:
Could not find org.eclipse.jdt.core.jar (org.eclipse.jdt:org.eclipse.jdt.core:3.10.0.v20131029-1755)
I'm trying to Build Gradle on my Client but this error keep poping up

```<code>Build file 'C:\Users\caver\Desktop\Client-main\game\build.gradle' line: 121

A problem occurred evaluating root project 'game'.
> Could not resolve all dependencies for configuration ':shade'.
   > Could not find org.eclipse.jdt.core.jar (org.eclipse.jdt:org.eclipse.jdt.core:3.10.0.v20131029-1755).
     Searched in the following locations:
         http://files.minecraftforge.net/maven/org/eclipse/jdt/org.eclipse.jdt.core/3.10.0.v20131029-1755/org.eclipse.jdt.core-3.10.0.v20131029-1755.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
</code>```

I tried to download the org.eclipse.jdt file but it didn't work.
I hope this would solve and Make my gradle build

Body:
I'm trying to Build Gradle on my Client but this error keep poping up

Build file 'C:\Users\caver\Desktop\Client-main\game\build.gradle' line: 121

A problem occurred evaluating root project 'game'.
> Could not resolve all dependencies for configuration ':shade'.
   > Could not find org.eclipse.jdt.core.jar (org.eclipse.jdt:org.eclipse.jdt.core:3.10.0.v20131029-1755).
     Searched in the following locations:
         http://files.minecraftforge.net/maven/org/eclipse/jdt/org.eclipse.jdt.core/3.10.0.v20131029-1755/org.eclipse.jdt.core-3.10.0.v20131029-1755.jar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

I tried to download the org.eclipse.jdt file but it didn't work.
I hope this would solve and Make my gradle build


问:
dependency-injectory and pytest in combination messing up directory calls
I'm running the pytest command (python -m pytest) locally from pycharm, and my code is intended (and already works as expected) in a notebook and uses dependency-injector. Within a module I have:

module1.py

```<code>import os
print({os.getcwd()}")

container = initialize('../../config.yaml')
container.config()
</code>```

module1.py is 2 directories lower than the root in the repo. However the Traceback is given after using the pytest command, the print gives the path of my root. Therefore, the '../../config.yaml' implies to go 2 directories above the root, which is obviously incorrect.

containers.py

```<code>class Container(containers.DeclarativeContainer):
    config = providers.Configuration(yaml_files=[default_path])

def initialize(config_path):
    container = Container()
    if config_path:
        container.config.from_yaml(config_path, required=True)

    return container
</code>```

The error I receive:

```<code>myNotebook\containers.py:12: in initialize
    container = Container()
src/dependency_injector/containers.pyx:742: in dependency_injector.containers.DeclarativeContainer.__new__
    ???
src/dependency_injector/containers.pyx:393: in dependency_injector.containers.DynamicContainer.load_config
    ???
    ???
src/dependency_injector/providers.pyx:2312: in dependency_injector.providers.Configuration.from_yaml
    ???
src/dependency_injector/providers.pyx:4951: in dependency_injector.providers.merge_dicts
    ???
E   TypeError: 'NoneType' object is not iterable
</code>```

How can I execute pytest properly without encountering this path confusion?

EDIT

conftest.py

```<code>@pytest.fixture(scope="session")
def test_container():
    return Container()

@pytest.fixture(scope="session")
def test_initialize():
    test_container = initialize('./myNotebook/tests/test.yaml')
    return test_container
</code>```

I had expected that the test_container and/or test_initalize get called.

When I run pytest, the print statment for module1.py is:

```<code>C:\Projects\my-Notebook
</code>```

and is called using python -m pytest and is run from the root dir (i.e. also from C:\Projects\my-Notebook)

When I run the notebook the print statment for module1.py is:

```<code>/Workspace/Repos/myAccount/my-Notebook/myNotebook/notebooks
</code>```

I wanted that the correct config file, in htis case the test.ymal gets called. However the pytest command is using the wrong directory.

Body:
I'm running the pytest command (python -m pytest) locally from pycharm, and my code is intended (and already works as expected) in a notebook and uses dependency-injector. Within a module I have:

module1.py

import os
print({os.getcwd()}")

container = initialize('../../config.yaml')
container.config()

module1.py is 2 directories lower than the root in the repo. However the Traceback is given after using the pytest command, the print gives the path of my root. Therefore, the '../../config.yaml' implies to go 2 directories above the root, which is obviously incorrect.

containers.py

class Container(containers.DeclarativeContainer):
    config = providers.Configuration(yaml_files=[default_path])

def initialize(config_path):
    container = Container()
    if config_path:
        container.config.from_yaml(config_path, required=True)

    return container

The error I receive:

myNotebook\containers.py:12: in initialize
    container = Container()
src/dependency_injector/containers.pyx:742: in dependency_injector.containers.DeclarativeContainer.__new__
    ???
src/dependency_injector/containers.pyx:393: in dependency_injector.containers.DynamicContainer.load_config
    ???
    ???
src/dependency_injector/providers.pyx:2312: in dependency_injector.providers.Configuration.from_yaml
    ???
src/dependency_injector/providers.pyx:4951: in dependency_injector.providers.merge_dicts
    ???
E   TypeError: 'NoneType' object is not iterable

How can I execute pytest properly without encountering this path confusion?

EDIT

conftest.py

@pytest.fixture(scope="session")
def test_container():
    return Container()

@pytest.fixture(scope="session")
def test_initialize():
    test_container = initialize('./myNotebook/tests/test.yaml')
    return test_container

I had expected that the test_container and/or test_initalize get called.

When I run pytest, the print statment for module1.py is:

C:\Projects\my-Notebook

and is called using python -m pytest and is run from the root dir (i.e. also from C:\Projects\my-Notebook)

When I run the notebook the print statment for module1.py is:

/Workspace/Repos/myAccount/my-Notebook/myNotebook/notebooks

I wanted that the correct config file, in htis case the test.ymal gets called. However the pytest command is using the wrong directory.


问:
How can I make my code run directly? Javascript
Currently, I have the code inside the window.load which causes a slight delay before it is triggered.

It is the function highlighted in the image-

And here is the code-

```<code><script type="text/javascript">
  var myrandom1= Math.round(Math.random()*15)
  var link1="https://url/Zielgruppe"
  var link2="https://url/glossar-b/Budget"
  var link3="https://url/glossar-C/Chatbot"

  window.onload= function(){
        if (myrandom1==0){
        btn_link1 = link1;

    } else if (myrandom1==1){
        btn_link1 = link2;

    }else if (myrandom1==2){
        btn_link1 = link3;

    }else if (myrandom1==3){
        btn_link1 = link4;

    }else if (myrandom1==4){
        btn_link1 = link5;

    }else if (myrandom1==5){
        btn_link1 = link6

  }
    const btnText1 = btn_link1.substr(34)
    document.getElementById("button_1").value=btnText1;

  };
  function random_1(){
    if (myrandom1==0)
        window.location=link1
    else if (myrandom1==1)
        window.location=link2
    else if (myrandom1==2)
        window.location=link3
  };

</script>
<form>
  <input class="random_Button" id="button_1" type="button" onclick="random_1()">
</form>

</code>```

Instead of using onload, what other solution could help?

Body:
Currently, I have the code inside the window.load which causes a slight delay before it is triggered.

It is the function highlighted in the image-

And here is the code-

<form>
  <input class="random_Button" id="button_1" type="button" onclick="random_1()">
</form>

Instead of using onload, what other solution could help?


问:
Python code on Hadoop. Trying to code mapper to emit 5 most use review words and sentiments of a text file
Restaurant I swung in to give them a try but was disappointed. 0
Restaurant I had a pretty satisfying experience. 1
Movie Some applause should be given to the "prelude". 1
Product A must study for anyone interested poor design. 0
Your task is to write a Python based Hadoop Map/Reduce solution that will, in a single pass, find the
5 most common words associated with a given item type and sentiment. The result will be 6 rows of
data consisting of the top 5 words for each item type and sentiment score in a form similar to the
following (the format and order can be different but the words for each item/sentiment must be
correct):</p>
```<code>#!/usr/bin/env python3

import sys
import string

# Student ID: <Replace with your ID number>

excluded = {"i","not","is"}

def eprint(*args, **kwargs):
    print(*args,file=sys.stderr,**kwargs)

f = open('excluded.txt')
for word in f:

    # input comes from STDIN (standard input)
    for line in sys.stdin:
        # remove leading and trailing whitespace
        line = line.strip()

        nopunc = line.maketrans("","",".,!")
        words = line.translate(nopunc).split()
        type= line.translate(nopunc).split()
        review = line.split()[:5]
        sentiment = line.translate(nopunc).split()
        # Get the type of review, the review text and the sentiment
        (type,review,sentiment) = line.split('\t')

        # Print the type and sentiment
        # Note that this is not the required output for a valid solution
        # and will just give a count of how many reviews of each type there are.
        # You will need to change the code from this point onward to meet the
        # assignment requirements.

        for word in words:
            if word in excluded:
                continue
        print('%s\t%s\t%s' % (type, sentiment,review))
</code>```

Body:
Restaurant I swung in to give them a try but was disappointed. 0
Restaurant I had a pretty satisfying experience. 1
Movie Some applause should be given to the "prelude". 1
Product A must study for anyone interested poor design. 0
Your task is to write a Python based Hadoop Map/Reduce solution that will, in a single pass, find the
5 most common words associated with a given item type and sentiment. The result will be 6 rows of
data consisting of the top 5 words for each item type and sentiment score in a form similar to the
following (the format and order can be different but the words for each item/sentiment must be
correct):

#!/usr/bin/env python3

import sys
import string

# Student ID: <Replace with your ID number>

excluded = {"i","not","is"}

def eprint(*args, **kwargs):
    print(*args,file=sys.stderr,**kwargs)

f = open('excluded.txt')
for word in f:

    # input comes from STDIN (standard input)
    for line in sys.stdin:
        # remove leading and trailing whitespace
        line = line.strip()

        nopunc = line.maketrans("","",".,!")
        words = line.translate(nopunc).split()
        type= line.translate(nopunc).split()
        review = line.split()[:5]
        sentiment = line.translate(nopunc).split()
        # Get the type of review, the review text and the sentiment
        (type,review,sentiment) = line.split('\t')

        # Print the type and sentiment
        # Note that this is not the required output for a valid solution
        # and will just give a count of how many reviews of each type there are.
        # You will need to change the code from this point onward to meet the
        # assignment requirements.

        for word in words:
            if word in excluded:
                continue
        print('%s\t%s\t%s' % (type, sentiment,review))


Title: Raycaster sometimes renders walls in the wrong order

Body:
I made a very basic raycasting engine from the formula laid out in this video in Rust. this works fine and is very flexible, however when it renders two connecting blocks, it sometimes renders the wrong wall.
I am fairly certain that this is a rounding error, as I had trouble with that in the past, but I cannot find where it is.

The code, in full, is:

const SCREEN_WIDTH: f32 = 750f32;
const SCREEN_HEIGHT: f32 = 500f32;
const SCREEN_OFFSET: f32 = SCREEN_WIDTH / 100f32;

const SHOW_2D_RAYS: bool = false;
const SHOW_2D_LEVEL: bool = false;

const CELL_SIZE: f32 = SCREEN_HEIGHT / MAP_SIZE;

const level: [[f32; MAP_SIZE as usize]; MAP_SIZE as usize] = [
    [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ],
    [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, ],
    [ 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ],
    [ 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, ],
    [ 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, ],
    [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, ],
];

fn draw_level() {
    for i in 0..MAP_SIZE as usize {
        for j in 0..MAP_SIZE as usize {
            if level[i][j] > 0f32 {
                draw_rectangle(
                    (j as f32 * CELL_SIZE) + 1f32,
                    (i as f32 * (SCREEN_HEIGHT / MAP_SIZE)) + 1f32,
                    (CELL_SIZE) - 2f32,
                    (SCREEN_HEIGHT / MAP_SIZE) - 2f32,
                    WHITE,
                );
            }
        }
    }
}
fn distance(aX: f32, aY: f32, bX: f32, bY: f32, angle: f32) -> f32 {
    return ((bX - aX) * (bX - aX) + (bY - aY) * (bY - aY)).sqrt() as f32;
}
fn draw_simple_background() {
    draw_rectangle(
        SCREEN_OFFSET,
        0f32,
        SCREEN_WIDTH,
        SCREEN_HEIGHT / 2f32,
        LIGHTGRAY,
    );
    draw_rectangle(
        SCREEN_OFFSET,
        SCREEN_HEIGHT / 2f32,
        SCREEN_WIDTH,
        SCREEN_HEIGHT,
        GRAY,
    );
}
struct Player {
    rect: Rect,
    deltaX: f32,
    deltaY: f32,
    angle: f32,
}
impl Player {
    pub fn new() -> Self {
        Self {
            rect: Rect::new(150f32, 150f32, 4f32, 4f32),
            angle: (PI / 2f32) + 1f32,
            deltaX: (PI / 2f32) + 1f32.cos() * 5f32,
            deltaY: (PI / 2f32) + 1f32.sin() * 5f32,
        }
    }

    pub fn drawRay(&mut self, RenderType: bool) {
        let mut rayAngle: f32 = self.angle - DEGREE * 30f32;
        if rayAngle < 0f32 {
            rayAngle += 2f32 * PI;
        }
        if rayAngle > 2f32 * PI {
            rayAngle -= 2f32 * PI
        }

        let mut rayX: f32 = self.rect.x;
        let mut rayY: f32 = self.rect.y;

        let mut finalDistance: f32 = 100000f32;

        let mut Yoffset: f32 = 0f32;
        let mut Xoffset: f32 = 0f32;
        let mut mapX: f32 = 0f32;
        let mut mapY: f32 = 0f32;

        for n in 1..(FIELD_OF_VIEW * RAYS_PER_DEGREE) as usize {
            let mut wallColor: [f32; 4] = [1f32, 0f32, 0f32, 1f32];

            let mut horizontalDistance: f32 = 100000f32;
            let mut horizontalX: f32 = self.rect.x;
            let mut horizontalY: f32 = self.rect.y;

            let arcTan: f32 = -1f32 / rayAngle.tan();
            let mut maxChecks: f32 = 0f32;
            if rayAngle > PI {
                rayY = self.rect.y.floor() - (self.rect.y % CELL_SIZE);
                rayX = ((self.rect.y - rayY) * arcTan + self.rect.x);
                Yoffset = -CELL_SIZE;
                Xoffset = -Yoffset * arcTan;
            } else if rayAngle < PI {
                rayY = self.rect.y - (self.rect.y % CELL_SIZE) + CELL_SIZE;
                rayX = (self.rect.y - rayY) * arcTan + self.rect.x;
                Yoffset = CELL_SIZE;
                Xoffset = -Yoffset * arcTan;
            } else {
                rayX = self.rect.x;
                rayY = self.rect.y;
                maxChecks = MAP_SIZE;
            }
            while maxChecks < MAP_SIZE {
                mapX = rayX / CELL_SIZE;
                mapY = rayY / CELL_SIZE;
                if mapX > MAP_SIZE - 1f32 {
                    mapX = MAP_SIZE - 1f32
                }
                if mapX < 0f32 {
                    mapX = 0f32;
                }
                if mapY > MAP_SIZE - 1f32 {
                    mapY = MAP_SIZE - 1f32
                }
                if mapY < 0f32 {
                    mapY = 0f32;
                }
                if level[mapY as usize][mapX as usize] > 0f32 {
                    maxChecks = MAP_SIZE;
                    horizontalX = rayX;
                    horizontalY = rayY;
                    horizontalDistance =
                        distance(self.rect.x, self.rect.y, horizontalX, horizontalY, rayAngle);
                } else {
                    rayX += Xoffset;
                    rayY += Yoffset;
                    maxChecks += 1f32;
                }
            }

            let mut verticalDistance: f32 = 100000f32;
            let mut verticalX: f32 = self.rect.x;
            let mut verticalY: f32 = self.rect.y;

            let negativeTan: f32 = -1f32 * rayAngle.tan();
            maxChecks = 0f32;
            if (rayAngle > (PI / 2f32)) && (rayAngle < (3f32 * PI) / 2f32) {
                rayX = self.rect.x.floor() - (self.rect.x % CELL_SIZE);
                rayY = ((self.rect.x - rayX) * negativeTan + self.rect.y);
                Xoffset = -CELL_SIZE;
                Yoffset = -Xoffset * negativeTan;
            } else if (rayAngle < (PI / 2f32)) || (rayAngle > (3f32 * PI) / 2f32) {
                rayX = self.rect.x - (self.rect.x % CELL_SIZE) + CELL_SIZE;
                rayY = (self.rect.x - rayX) * negativeTan + self.rect.y;
                Xoffset = CELL_SIZE;
                Yoffset = -Xoffset * negativeTan;
            } else {
                rayX = self.rect.x;
                rayY = self.rect.y;
                maxChecks = MAP_SIZE;
            }
            while maxChecks < MAP_SIZE {
                mapX = rayX / CELL_SIZE;
                mapY = rayY / CELL_SIZE;
                if mapY > MAP_SIZE - 1f32 {
                    mapY = MAP_SIZE - 1f32;
                }
                if mapY < 0f32 {
                    mapY = 0f32;
                }
                if mapX > MAP_SIZE - 1f32 {
                    mapX = MAP_SIZE - 1f32;
                }
                if mapX < 0f32 {
                    mapX = 0f32;
                }
                if level[mapY as usize][mapX as usize] > 0f32 {
                    maxChecks = CELL_SIZE;
                    verticalX = rayX;
                    verticalY = rayY;
                    verticalDistance =
                        distance(self.rect.x, self.rect.y, verticalX, verticalY, rayAngle);
                } else {
                    rayX += Xoffset;
                    rayY += Yoffset;
                    maxChecks += 1f32;
                }
            }
            if verticalDistance <= horizontalDistance {
                rayX = verticalX;
                rayY = verticalY;
                finalDistance = verticalDistance;
                wallColor = [0.8f32, 0f32, 0f32, 1f32]; // different wall shading
            } else {
                rayX = horizontalX;
                rayY = horizontalY;
                finalDistance = horizontalDistance;
            }

            let mut correctionAngle: f32 = self.angle - rayAngle;
            if correctionAngle < 0f32 {
                correctionAngle += 2f32 * PI;
            }
            if correctionAngle > 2f32 * PI {
                correctionAngle -= 2f32 * PI;
            }
            finalDistance = finalDistance * correctionAngle.cos();

            for x in 0..2 {
                // distance shading
                wallColor[x] = wallColor[x] - (finalDistance / 500f32);
            }
            let lineHeight: f32 = (MAP_SIZE * SCREEN_HEIGHT) / finalDistance;

            if RenderType {
                draw_line(
                    self.rect.x + 2f32,
                    self.rect.y + 2f32,
                    rayX,
                    rayY,
                    3f32,
                    Color::new(wallColor[0], wallColor[1], wallColor[2], wallColor[3]),
                );
            } else {
                draw_line(
                    SCREEN_OFFSET
                        + (SCREEN_WIDTH / (FIELD_OF_VIEW * RAYS_PER_DEGREE)) * (n as f32 - 1f32)
                        + (SCREEN_OFFSET / (FIELD_OF_VIEW * RAYS_PER_DEGREE) / 2f32),
                    (SCREEN_HEIGHT - lineHeight) / 2f32,
                    SCREEN_OFFSET
                        + ((SCREEN_WIDTH) / (FIELD_OF_VIEW * RAYS_PER_DEGREE)) * (n as f32 - 1f32)
                        + ((SCREEN_OFFSET) / (FIELD_OF_VIEW * RAYS_PER_DEGREE) / 2f32),
                    ((SCREEN_HEIGHT - lineHeight) / 2f32) + lineHeight,
                    SCREEN_WIDTH / (FIELD_OF_VIEW * RAYS_PER_DEGREE) / 1f32,
                    Color::new(wallColor[0], wallColor[1], wallColor[2], wallColor[3]),
                );
            }

            rayAngle += DEGREE / 2f32;
            if rayAngle < 0f32 {
                rayAngle += 2f32 * PI;
            }
            if rayAngle > 2f32 * PI {
                rayAngle -= 2f32 * PI
            }
        }
    }
    pub fn update(&mut self, dt: f32) {
        if is_key_down(KeyCode::Left) {
            self.angle -= PLAYER_SPEED;
            if self.angle < 0f32 {
                self.angle += 2f32 * PI;
            }
            self.deltaX = self.angle.cos() * 5f32 * PLAYER_ROTATE_SPEED;
            self.deltaY = self.angle.sin() * 5f32 * PLAYER_ROTATE_SPEED;
        }
        if is_key_down(KeyCode::Right) {
            self.angle += PLAYER_SPEED;
            if self.angle > 2f32 * PI {
                self.angle -= 2f32 * PI;
            }
            self.deltaX = self.angle.cos() * 5f32 * PLAYER_ROTATE_SPEED;
            self.deltaY = self.angle.sin() * 5f32 * PLAYER_ROTATE_SPEED;
        }
        if is_key_down(KeyCode::W) {
            self.rect.x += self.deltaX;
            self.rect.y += self.deltaY;
        }
        if is_key_down(KeyCode::S) {
            self.rect.x -= self.deltaX;
            self.rect.y -= self.deltaY;
        }
    }
    pub fn draw(&self) {
        draw_rectangle(self.rect.x, self.rect.y, self.rect.w, self.rect.h, BLUE);
        draw_line(
            self.rect.x + 2.0,
            self.rect.y + 2.0,
            self.rect.x + self.deltaX * 5f32,
            self.rect.y + self.deltaY * 5f32,
            2f32,
            BLUE,
        );
    }
}

#[macroquad::main("Raycaster")]
async fn main() {
    request_new_screen_size(SCREEN_WIDTH, SCREEN_HEIGHT);
    let mut player = Player::new();

    loop {
        clear_background(BLACK);

        player.update(get_frame_time());

        draw_simple_background();
        player.drawRay(false);
        if is_key_down(KeyCode::Tab) {
            clear_background(BLACK);
            draw_level();
            player.draw();
            player.drawRay(true);
        }

        next_frame().await
    }
}

Where I think the problem is exactly:

if rayAngle > PI {
    rayY = self.rect.y.floor() - (self.rect.y % CELL_SIZE);
    rayX = ((self.rect.y - rayY) * arcTan + self.rect.x);
    Yoffset = -CELL_SIZE;
    Xoffset = -Yoffset * arcTan;
} else if rayAngle < PI {
    rayY = self.rect.y - (self.rect.y % CELL_SIZE) + CELL_SIZE;
    rayX = (self.rect.y - rayY) * arcTan + self.rect.x;
    Yoffset = CELL_SIZE;
    Xoffset = -Yoffset * arcTan;
} else {
    rayX = self.rect.x;
    rayY = self.rect.y;
    maxChecks = MAP_SIZE;
}
while maxChecks < MAP_SIZE {
    mapX = rayX / CELL_SIZE;
    mapY = rayY / CELL_SIZE;
    if mapX > MAP_SIZE - 1f32 {
        mapX = MAP_SIZE - 1f32
    }
    if mapX < 0f32 {
        mapX = 0f32;
    }
    if mapY > MAP_SIZE - 1f32 {
        mapY = MAP_SIZE - 1f32
    }
    if mapY < 0f32 {
        mapY = 0f32;
    }
    if level[mapY as usize][mapX as usize] > 0f32 {
        maxChecks = MAP_SIZE;
        horizontalX = rayX;
        horizontalY = rayY;
        horizontalDistance =
            distance(self.rect.x, self.rect.y, horizontalX, horizontalY, rayAngle);
    } else {
        rayX += Xoffset;
        rayY += Yoffset;
        maxChecks += 1f32;
    }
}

The program throws out 2 rays per call, one for vertical walls and one for horizontal. the problem happens with both, vertical overlapping horizontal when it shouldn't and vice versa.

The distance between the player and the wall is calculated with an i32 then converted into a usize, aka float to int. I think this is where the error is, but I have made no progress in fixing it.
any help would be appreciated, thank you


问:
How to convert HEX to DEC in IBM DB2?
The needed data is stored in a IBM DB2 in a column as HEX values, I need to convert it to DEC.
But I cannot find the correct function.

I used the CAST(table1.hex as DEC) but it didn't work.

Title: How to convert HEX to DEC in IBM DB2?


问:
How to show message of nodata on highcharts c# .net
I'm using Highcharts under c# .net
I want to show a message "No data to display" if the series are empty and there no graphe or data to display.

I added the code bellow but it is not shown:

```<code>            Lang = new Lang
            {
               NoData = "Aucune donnée à afficher",
            },
            NoData = new NoData
            {
                Style = new NoDataStyle
                {
                    FontWeight = "bold",
                    FontSize = "15px",
                    Color = "#303030",
                },
            }
</code>```

Can someone help me please ?

Body:
I'm using Highcharts under c# .net
I want to show a message "No data to display" if the series are empty and there no graphe or data to display.

I added the code bellow but it is not shown:

            Lang = new Lang
            {
               NoData = "Aucune donnée à afficher",
            },
            NoData = new NoData
            {
                Style = new NoDataStyle
                {
                    FontWeight = "bold",
                    FontSize = "15px",
                    Color = "#303030",
                },
            }

Can someone help me please ?


问:
Can I use npm-watch for tailwind.config.js?
I feel like I'm missing something very obvious/easy, so hopefully someone here can help me.

I've setup npm-watch in my project:

```<code>{
  "watch": {
    "build": {
      "patterns": ["src", "style"],
      "extensions": "ts,tsx,css",
      "runOnChangeOnly": true
    }
  },
</code>```

However, since I use TailwindCSS, I would like for it to watch the tailwind.config.js file as well, since I'm constantly updating/adding custom styles to the theme. How can I best do this? It's located in the root folder.

I've tried adding "../tailwind.config.js" to the patterns, or "config.js" as an extension, but it doesn't work.

Thanks in advance!

Body:
I feel like I'm missing something very obvious/easy, so hopefully someone here can help me.

I've setup npm-watch in my project:

{
  "watch": {
    "build": {
      "patterns": ["src", "style"],
      "extensions": "ts,tsx,css",
      "runOnChangeOnly": true
    }
  },

However, since I use TailwindCSS, I would like for it to watch the tailwind.config.js file as well, since I'm constantly updating/adding custom styles to the theme. How can I best do this? It's located in the root folder.

I've tried adding "../tailwind.config.js" to the patterns, or "config.js" as an extension, but it doesn't work.

Thanks in advance!


问:
I get a certificate error on start my node.js server
why im getting this error ? and how i can fix this
Node.js version: v14.15.1
certificate: pfx
enter image description here

Error (as seen in image):

```<code>> node app.js
tls_common. js : 273
       c.context. loadPKCS12(buf) ;
Error : header too long
at Object.createSecureContext (_t1s_common.js:273:19)
at Server.setSecureContext (_t1s_wrap.js:1323:27)
at Server (_t1s_wrap.js:1181:8)
at new Server (https.js:66:14)
</code>```
```<code> const { readFileSync } = require('fs');
 const pfx = readFileSync(__dirname + '/src/certs/cert.pfx');
const pid = process.pid

const express = require('express');
const app = express();
app.get('/', function (req, res) {
  console.log('/')
  res.send(`${pid}`);
});
const { createServer } = require('https');

 const { createRoutes } = require('./src/routes/index');
 const { createSocket } = require('./src/core/socket');

const https = createServer({
  pfx: pfx,
  passphrase: '',
}, app);

 const io = createSocket(https);
 createRoutes(app, io);

const PORT = process.env.PORT || 5005; // 8443

https.listen(PORT, () => {
  console.log(`https server started on port:${PORT}`);
});
</code>```

Body:
why im getting this error ? and how i can fix this
Node.js version: v14.15.1
certificate: pfx
enter image description here

Error (as seen in image):

> node app.js
tls_common. js : 273
       c.context. loadPKCS12(buf) ;
Error : header too long
at Object.createSecureContext (_t1s_common.js:273:19)
at Server.setSecureContext (_t1s_wrap.js:1323:27)
at Server (_t1s_wrap.js:1181:8)
at new Server (https.js:66:14)

 const { readFileSync } = require('fs');
 const pfx = readFileSync(__dirname + '/src/certs/cert.pfx');
const pid = process.pid

const express = require('express');
const app = express();
app.get('/', function (req, res) {
  console.log('/')
  res.send(`${pid}`);
});
const { createServer } = require('https');

 const { createRoutes } = require('./src/routes/index');
 const { createSocket } = require('./src/core/socket');

const https = createServer({
  pfx: pfx,
  passphrase: '',
}, app);

 const io = createSocket(https);
 createRoutes(app, io);

const PORT = process.env.PORT || 5005; // 8443

https.listen(PORT, () => {
  console.log(`https server started on port:${PORT}`);
});


问:
How to pass text parameters in api method?
Hi I want to pass text paramas in my api method am requesting 3 rd party api to hit the url so in that am passing text format params please help me?

text=

```<code>{ publisherCommissions(forPublishers: ["5638564"], sincePostingDate:"2022-01-01T00:00:00Z"
,beforePostingDate:"2022-01-28T00:00:00Z"){count payloadComplete records {actionTrackerName websiteName advertiserName postingDate pubCommissionAmountUsd items { quantity perItemSaleAmountPubCurrency totalCommissionPubCurrency }} }}
</code>```

I want to pass text params in body

Body:
Hi I want to pass text paramas in my api method am requesting 3 rd party api to hit the url so in that am passing text format params please help me?

text=

{ publisherCommissions(forPublishers: ["5638564"], sincePostingDate:"2022-01-01T00:00:00Z"
,beforePostingDate:"2022-01-28T00:00:00Z"){count payloadComplete records {actionTrackerName websiteName advertiserName postingDate pubCommissionAmountUsd items { quantity perItemSaleAmountPubCurrency totalCommissionPubCurrency }} }}

I want to pass text params in body


问:
Pairs matching game
My array only deploys one image i would like it to display 52 card images each one twice and selected randomly

is anyone able to point me in the right direction

Thanks

Image of grid

```<code>namespace FinalPairsGame
{
    public partial class Background : Form
    {
        // global decalrations
        int[,] memoryarray = new int[6, 6];
        GImageArray controlarray;
        string imagepath = Directory.GetCurrentDirectory() + "\\Cards\\";

        public Background()
        {
            InitializeComponent();
        }

        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            initgame();
            pictureBox1.Hide();
            Title.Hide();
        }
        private void helpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            inithelp();
        }
        private void inithelp()
        {
            MessageBox.Show("Pairs, the aim of the game is to match 2 cards in the grid, each player will take it in turns to find a pair, once the card pair has been found it will turn blue. The winner is the player who ends with the most pairs");
        }

        public void initgame()
        {
            for (int row = 0; row < 6; row++)
            {
                for (int col = 0; col <6;col++)
                {
                    memoryarray[row, col] = 1;
                    if (memoryarray[row, col] == 1)
                    {
                        ;
                    }
                }
            }
            controlarray = new GImageArray(this, memoryarray, 35, 200, 10, 200, 10, imagepath);
            controlarray.Which_Element_Clicked += new GImageArray.ImageClickedEventHandler(Which_Element_Clicked);
        }

        private void Which_Element_Clicked(object sender, EventArgs e)
        {
            int row = controlarray.Get_Row(sender);
            int col = controlarray.Get_Col(sender);

        }
        private void assigncardstogrid()
        {

        }

    }
}

</code>```

I tried messing around with it but could never get further than one card and yeah not sure how to fix this would appreciate it if someone could help me out

Title: Pairs matching game

Body:
My array only deploys one image i would like it to display 52 card images each one twice and selected randomly

is anyone able to point me in the right direction

Thanks

Image of grid

namespace FinalPairsGame
{
    public partial class Background : Form
    {
        // global decalrations
        int[,] memoryarray = new int[6, 6];
        GImageArray controlarray;
        string imagepath = Directory.GetCurrentDirectory() + "\\Cards\\";

        public Background()
        {
            InitializeComponent();
        }

        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            initgame();
            pictureBox1.Hide();
            Title.Hide();
        }
        private void helpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            inithelp();
        }
        private void inithelp()
        {
            MessageBox.Show("Pairs, the aim of the game is to match 2 cards in the grid, each player will take it in turns to find a pair, once the card pair has been found it will turn blue. The winner is the player who ends with the most pairs");
        }

        public void initgame()
        {
            for (int row = 0; row < 6; row++)
            {
                for (int col = 0; col <6;col++)
                {
                    memoryarray[row, col] = 1;
                    if (memoryarray[row, col] == 1)
                    {
                        ;
                    }
                }
            }
            controlarray = new GImageArray(this, memoryarray, 35, 200, 10, 200, 10, imagepath);
            controlarray.Which_Element_Clicked += new GImageArray.ImageClickedEventHandler(Which_Element_Clicked);
        }

        private void Which_Element_Clicked(object sender, EventArgs e)
        {
            int row = controlarray.Get_Row(sender);
            int col = controlarray.Get_Col(sender);

        }
        private void assigncardstogrid()
        {

        }

    }
}

I tried messing around with it but could never get further than one card and yeah not sure how to fix this would appreciate it if someone could help me out


问:
C++ objects to Lua [ Overloading operator= ]
Using the Lua API, I can create C++ classes in lua, for which I have redefined some operators (__tostring, __gc, __len, etc.). Everything works correctly, but but such objects are pointers in lua script.

Code in lua script:

```<code>local vec = Vector2:new(500, 500)

local table = {
    new_vec = vec   -- A pointer to the object is created, not a copy of it.
}

print(tostring(vec))
print(tostring(table.new_vec))

vec.x = 100
vec.y = 100

print(tostring(vec))
print(tostring(table.new_vec))

table.new_vec.x = 200
table.new_vec.y = 200

print(tostring(vec))
print(tostring(table.new_vec))
</code>```

Output:
500
500

100
100

200
200

But I would like a copy of the object to be stored in a table, and the changes only concern it.
Is it possible to reload the operator=, something like __replace?

Body:
Using the Lua API, I can create C++ classes in lua, for which I have redefined some operators (__tostring, __gc, __len, etc.). Everything works correctly, but but such objects are pointers in lua script.

Code in lua script:

local vec = Vector2:new(500, 500)

local table = {
    new_vec = vec   -- A pointer to the object is created, not a copy of it.
}

print(tostring(vec))
print(tostring(table.new_vec))

vec.x = 100
vec.y = 100

print(tostring(vec))
print(tostring(table.new_vec))

table.new_vec.x = 200
table.new_vec.y = 200

print(tostring(vec))
print(tostring(table.new_vec))

Output:
500
500

100
100

200
200

But I would like a copy of the object to be stored in a table, and the changes only concern it.
Is it possible to reload the operator=, something like __replace?


问:
How to test controller with AuthenticationManagerBuilder and SecurityContextHolder?
I have such controller. I want to test that it returns JWT token in header.

```<code>@PostMapping("/login")
public ResponseEntity<String> login(@RequestBody AuthDto authDto) {

    UsernamePasswordAuthenticationToken authenticationToken
            = new UsernamePasswordAuthenticationToken(
                    authDto.getUsername(),
                    authDto.getPassword()
    );

    Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
    SecurityContextHolder.getContext().setAuthentication(authentication);

    String jwt = tokenProvider.createToken(authentication);

    HttpHeaders headers = new HttpHeaders();
    headers.add("Authorization", "Bearer " + jwt);

    return new ResponseEntity<>("", headers, HttpStatus.OK);
}
</code>```

I tried such test. I was expecting that authenticationManagerBuilder would be injected into authController as a mock and no its methods would be invoked. Actually I wanted to skip lines in controller with authenticationManagerBuilder and SecurityContextHolder because I don't want to test them.

```<code>@ExtendWith(MockitoExtension.class)
public class AuthControllerTest {

    @Mock
    private AuthenticationManagerBuilder authenticationManagerBuilder;

    @InjectMocks
    private AuthController authController;

    @Test
    public void shouldReturnUserDtoAndBearerToken() {
        String username = "username";
        String password = "password";
        AuthDto authDto = AuthDto.builder().username(username).password(password).build();

        UsernamePasswordAuthenticationToken authenticationToken
                = new UsernamePasswordAuthenticationToken(
                authDto.getUsername(),
                authDto.getPassword()
        );

        Authentication authentication = new UsernamePasswordAuthenticationToken(username, password);

        Mockito.when(authenticationManagerBuilder.getObject())
                        .thenReturn(new ProviderManager());

        Mockito.when(authenticationManagerBuilder.getObject().authenticate(authenticationToken))
                        .thenReturn(authentication);

        Mockito.mock(SecurityContextHolder.class);

        ResponseEntity<String> responseEntity = authController.login(authDto);

        Assertions.assertTrue(responseEntity.getHeaders().containsKey("Authorization"));
        Assertions.assertEquals(1, responseEntity.getHeaders().get("Authorization").size());
        Assertions.assertTrue(responseEntity.getHeaders().get("Authorization").get(0).startsWith("Bearer"));
        Assertions.assertNotEquals("Bearer", responseEntity.getHeaders().get("Authorization").get(0));
    }
}
</code>```

It crushed with such exception.

```<code>Cannot invoke "java.util.concurrent.atomic.AtomicBoolean.get()" because "this.building" is null
java.lang.NullPointerException: Cannot invoke "java.util.concurrent.atomic.AtomicBoolean.get()" because "this.building" is null
    at org.springframework.security.config.annotation.AbstractSecurityBuilder.getObject(AbstractSecurityBuilder.java:50)
    at com.corporation.controller.AuthController.login(AuthController.java:36)
    at com.corporation.controller.auth.AuthControllerTest.shouldReturnUserDtoAndBearerToken(AuthControllerTest.java:52)
</code>```

Body:
I have such controller. I want to test that it returns JWT token in header.

@PostMapping("/login")
public ResponseEntity<String> login(@RequestBody AuthDto authDto) {

    UsernamePasswordAuthenticationToken authenticationToken
            = new UsernamePasswordAuthenticationToken(
                    authDto.getUsername(),
                    authDto.getPassword()
    );

    Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authenticationToken);
    SecurityContextHolder.getContext().setAuthentication(authentication);

    String jwt = tokenProvider.createToken(authentication);

    HttpHeaders headers = new HttpHeaders();
    headers.add("Authorization", "Bearer " + jwt);

    return new ResponseEntity<>("", headers, HttpStatus.OK);
}

I tried such test. I was expecting that authenticationManagerBuilder would be injected into authController as a mock and no its methods would be invoked. Actually I wanted to skip lines in controller with authenticationManagerBuilder and SecurityContextHolder because I don't want to test them.

@ExtendWith(MockitoExtension.class)
public class AuthControllerTest {

    @Mock
    private AuthenticationManagerBuilder authenticationManagerBuilder;

    @InjectMocks
    private AuthController authController;

    @Test
    public void shouldReturnUserDtoAndBearerToken() {
        String username = "username";
        String password = "password";
        AuthDto authDto = AuthDto.builder().username(username).password(password).build();

        UsernamePasswordAuthenticationToken authenticationToken
                = new UsernamePasswordAuthenticationToken(
                authDto.getUsername(),
                authDto.getPassword()
        );

        Authentication authentication = new UsernamePasswordAuthenticationToken(username, password);

        Mockito.when(authenticationManagerBuilder.getObject())
                        .thenReturn(new ProviderManager());

        Mockito.when(authenticationManagerBuilder.getObject().authenticate(authenticationToken))
                        .thenReturn(authentication);

        Mockito.mock(SecurityContextHolder.class);

        ResponseEntity<String> responseEntity = authController.login(authDto);

        Assertions.assertTrue(responseEntity.getHeaders().containsKey("Authorization"));
        Assertions.assertEquals(1, responseEntity.getHeaders().get("Authorization").size());
        Assertions.assertTrue(responseEntity.getHeaders().get("Authorization").get(0).startsWith("Bearer"));
        Assertions.assertNotEquals("Bearer", responseEntity.getHeaders().get("Authorization").get(0));
    }
}

It crushed with such exception.

Cannot invoke "java.util.concurrent.atomic.AtomicBoolean.get()" because "this.building" is null
java.lang.NullPointerException: Cannot invoke "java.util.concurrent.atomic.AtomicBoolean.get()" because "this.building" is null
    at org.springframework.security.config.annotation.AbstractSecurityBuilder.getObject(AbstractSecurityBuilder.java:50)
    at com.corporation.controller.AuthController.login(AuthController.java:36)
    at com.corporation.controller.auth.AuthControllerTest.shouldReturnUserDtoAndBearerToken(AuthControllerTest.java:52)


问:
Apply waitcursor via javascript doesn't work
I've a javascript function which needs a couple of seconds for executing, but the waitcursor isn't applied. (https://jsfiddle.net/pegast/a9c2e6qs/29/).

function dosomething() {
  document.body.style.cursor = 'wait';
  let result = 0;
  for (let i = 0; i < 10000000; i++) {
    for (let ii = 0; ii < 20; ii++) {
      result += Math.random() * Math.random() * Math.random();
    }
  }
  document.getElementById("result").innerHTML = result;
  document.body.style.cursor = 'default';
};```
<pre class="snippet-code-css lang-css prettyprint-override"><code>button:hover{
  cursor: pointer;
}</code>```

<button id="button" onclick="dosomething();">Start process</button>

```

Body:
I've a javascript function which needs a couple of seconds for executing, but the waitcursor isn't applied. (https://jsfiddle.net/pegast/a9c2e6qs/29/).

function dosomething() {
  document.body.style.cursor = 'wait';
  let result = 0;
  for (let i = 0; i < 10000000; i++) {
    for (let ii = 0; ii < 20; ii++) {
      result += Math.random() * Math.random() * Math.random();
    }
  }
  document.getElementById("result").innerHTML = result;
  document.body.style.cursor = 'default';
};

button:hover{
  cursor: pointer;
}

<button id="button" onclick="dosomething();">Start process</button>


问:
Can't see video in R shiny tag$video
i'm trying to embed videos in my shiny output. it's in my www folder, and i copied and slightly changed the codes from the internet, but it's not working.
down below is my code

```<code>library(shiny)

function(input, output, session) {

  output$tb <- renderUI({
    #if(input$opp == 1)
    h6("match highlights", br(), tags$video(src="vs Dustin Poirier.mp4", type="video/mp4", width="350px", height="350px", autoplay = NA, controls = NA))
  })

}
</code>```

and in the output, only control bar and title are shown.
it's left blank where my video is supposed to be showing. control bar does not work either.

i am using mac and R 4.2.2

Title: Can't see video in R shiny tag$video

Body:
i'm trying to embed videos in my shiny output. it's in my www folder, and i copied and slightly changed the codes from the internet, but it's not working.
down below is my code

library(shiny)

function(input, output, session) {

  output$tb <- renderUI({
    #if(input$opp == 1)
    h6("match highlights", br(), tags$video(src="vs Dustin Poirier.mp4", type="video/mp4", width="350px", height="350px", autoplay = NA, controls = NA))
  })

}

and in the output, only control bar and title are shown.
it's left blank where my video is supposed to be showing. control bar does not work either.

i am using mac and R 4.2.2