问:
My traied model with tensorflow on transformer pipeline pop out error
I’m using this github text summarization and I have a problem. I have been struggling for two weeks and I could not figure that out.
I'm using a notebook from this github repository:
https://github.com/flogothetis/Abstractive-Summarization-T5-Keras

notebook link:
https://github.com/flogothetis/Abstractive-Summarization-T5-Keras/blob/main/AbstractiveSummarizationT5.ipynb

After training the model I want to use huggingface transformer pipeline to generate summarizations.

```<code>from transformers import pipeline

summarizer = pipeline(“summarization”, model=model, tokenizer=“t5small”, framework=“tf”)
summarizer(“some text”)
</code>```

but it returns the following error:

AttributeError: ‘Functional’ object has no attribute 'config’

Anyone has any idea how can i solve it?

full error:

```<code>AttributeError Traceback (most recent call last)
/tmp/ipykernel_20/1872405895.py in
----> 1 summarizer = pipeline(“summarization”, model=model, tokenizer=“t5-small”, framework=“tf”)
2
3 summarizer(“The US has passed the peak on new coronavirus cases, President Donald Trump said and predicted that some states would reopen”)

/opt/conda/lib/python3.7/site-packages/transformers/pipelines/init.py in pipeline(task, model, config, tokenizer, framework, revision, use_fast, use_auth_token, model_kwargs, **kwargs)
432 break
433
→ 434 return task_class(model=model, tokenizer=tokenizer, modelcard=modelcard, framework=framework, task=task, **kwargs)

/opt/conda/lib/python3.7/site-packages/transformers/pipelines/text2text_generation.py in init(self, *args, **kwargs)
37
38 def init(self, *args, **kwargs):
—> 39 super().init(*args, **kwargs)
40
41 self.check_model_type(

/opt/conda/lib/python3.7/site-packages/transformers/pipelines/base.py in init(self, model, tokenizer, modelcard, framework, task, args_parser, device, binary_output)
548
549 # Update config with task specific parameters
→ 550 task_specific_params = self.model.config.task_specific_params
551 if task_specific_params is not None and task in task_specific_params:
552 self.model.config.update(task_specific_params.get(task))

AttributeError: ‘Functional’ object has no attribute 'config’
</code>```

Body:
I’m using this github text summarization and I have a problem. I have been struggling for two weeks and I could not figure that out.
I'm using a notebook from this github repository:
https://github.com/flogothetis/Abstractive-Summarization-T5-Keras

notebook link:
https://github.com/flogothetis/Abstractive-Summarization-T5-Keras/blob/main/AbstractiveSummarizationT5.ipynb

After training the model I want to use huggingface transformer pipeline to generate summarizations.

from transformers import pipeline

summarizer = pipeline(“summarization”, model=model, tokenizer=“t5small”, framework=“tf”)
summarizer(“some text”)

but it returns the following error:

AttributeError: ‘Functional’ object has no attribute 'config’

Anyone has any idea how can i solve it?

full error:

AttributeError Traceback (most recent call last)
/tmp/ipykernel_20/1872405895.py in
----> 1 summarizer = pipeline(“summarization”, model=model, tokenizer=“t5-small”, framework=“tf”)
2
3 summarizer(“The US has passed the peak on new coronavirus cases, President Donald Trump said and predicted that some states would reopen”)

/opt/conda/lib/python3.7/site-packages/transformers/pipelines/init.py in pipeline(task, model, config, tokenizer, framework, revision, use_fast, use_auth_token, model_kwargs, **kwargs)
432 break
433
→ 434 return task_class(model=model, tokenizer=tokenizer, modelcard=modelcard, framework=framework, task=task, **kwargs)

/opt/conda/lib/python3.7/site-packages/transformers/pipelines/text2text_generation.py in init(self, *args, **kwargs)
37
38 def init(self, *args, **kwargs):
—> 39 super().init(*args, **kwargs)
40
41 self.check_model_type(

/opt/conda/lib/python3.7/site-packages/transformers/pipelines/base.py in init(self, model, tokenizer, modelcard, framework, task, args_parser, device, binary_output)
548
549 # Update config with task specific parameters
→ 550 task_specific_params = self.model.config.task_specific_params
551 if task_specific_params is not None and task in task_specific_params:
552 self.model.config.update(task_specific_params.get(task))

AttributeError: ‘Functional’ object has no attribute 'config’


来源: stackexchange

问:
GDB improperly tokenizes command-line arguments containing spaces
(This is possibly related to Pass arguments with space in GDB?, which did not get resolved.)

Witness the following:

```<code>zlaski@RUMCAJS /cygdrive/d/music/wurlitzer/Drum And Bass
$ ls Wen\ -\ Commotion.backup.mp3
'Wen - Commotion.backup.mp3'

zlaski@RUMCAJS /cygdrive/d/music/wurlitzer/Drum And Bass
$ gdb -q -ex start --args ls Wen\ -\ Commotion.backup.mp3
Reading symbols from ls...
Reading symbols from /usr/bin/ls.exe.dbg...
Temporary breakpoint 1 at 0x1004181e0: file /usr/src/debug/coreutils-9.0-1/src/ls.c, line 1658.
Starting program: /usr/bin/ls Wen\ -\ Commotion.backup.mp3
[New Thread 34524.0x4edc]
[New Thread 34524.0x2abc]
[New Thread 34524.0x7dd4]
[New Thread 34524.0x7aa0]

Thread 1 "ls" hit Temporary breakpoint 1, main (argc=4, argv=0x7ffffcc20) at /usr/src/debug/coreutils-9.0-1/src/ls.c:1658
</code>```

We are passing a single argument, Wen\ -\ Commotion.backup.mp3, to the ls program.  However, gdb chops it into 3 pieces, which is why we wind up with an argc of 4 instead of 2:

```<code>(gdb) print argv[0]
$1 = 0xa00003380 "/usr/bin/ls"
(gdb) print argv[1]
$2 = 0x7ffffcc67 "Wen\\"
(gdb) print argv[2]
$3 = 0x7ffffcc6c "-\\"
(gdb) print argv[3]
$4 = 0x7ffffcc6f "Commotion.backup.mp3"
</code>```

I have also tried the following incantations of the argument:

```<code>'Wen - Commotion.backup.mp3'
"Wen - Commotion.backup.mp3"
Wen\\ -\\ Commotion.backup.mp3
"Wen\\ -\\ Commotion.backup.mp3"
'Wen\\ -\\ Commotion.backup.mp3'
'Wen\ -\ Commotion.backup.mp3'
"Wen\ -\ Commotion.backup.mp3"
</code>```

In all cases, the argument is chopped into 3 pieces.

I have an eerie feeling that I must be doing something wrong as it seems implausible that gdb would have such a glaring defect for all these years.  Anyhoo, I hope that you gentlefolk can enlighten me here.

My configuration is as follows:

```<code>MACHTYPE=x86_64-unknown-cygwin
bash-4.4.12-3
coreutils-9.0-1
cygwin-3.4.3-1
gdb-11.2-1
</code>```

Thanks!

ContentLicense: CC BY-SA 4.0

Body:
(This is possibly related to Pass arguments with space in GDB?, which did not get resolved.)

Witness the following:

zlaski@RUMCAJS /cygdrive/d/music/wurlitzer/Drum And Bass
$ ls Wen\ -\ Commotion.backup.mp3
'Wen - Commotion.backup.mp3'

zlaski@RUMCAJS /cygdrive/d/music/wurlitzer/Drum And Bass
$ gdb -q -ex start --args ls Wen\ -\ Commotion.backup.mp3
Reading symbols from ls...
Reading symbols from /usr/bin/ls.exe.dbg...
Temporary breakpoint 1 at 0x1004181e0: file /usr/src/debug/coreutils-9.0-1/src/ls.c, line 1658.
Starting program: /usr/bin/ls Wen\ -\ Commotion.backup.mp3
[New Thread 34524.0x4edc]
[New Thread 34524.0x2abc]
[New Thread 34524.0x7dd4]
[New Thread 34524.0x7aa0]

Thread 1 "ls" hit Temporary breakpoint 1, main (argc=4, argv=0x7ffffcc20) at /usr/src/debug/coreutils-9.0-1/src/ls.c:1658

We are passing a single argument, Wen\ -\ Commotion.backup.mp3, to the ls program.  However, gdb chops it into 3 pieces, which is why we wind up with an argc of 4 instead of 2:

(gdb) print argv[0]
$1 = 0xa00003380 "/usr/bin/ls"
(gdb) print argv[1]
$2 = 0x7ffffcc67 "Wen\\"
(gdb) print argv[2]
$3 = 0x7ffffcc6c "-\\"
(gdb) print argv[3]
$4 = 0x7ffffcc6f "Commotion.backup.mp3"

I have also tried the following incantations of the argument:

'Wen - Commotion.backup.mp3'
"Wen - Commotion.backup.mp3"
Wen\\ -\\ Commotion.backup.mp3
"Wen\\ -\\ Commotion.backup.mp3"
'Wen\\ -\\ Commotion.backup.mp3'
'Wen\ -\ Commotion.backup.mp3'
"Wen\ -\ Commotion.backup.mp3"

In all cases, the argument is chopped into 3 pieces.

I have an eerie feeling that I must be doing something wrong as it seems implausible that gdb would have such a glaring defect for all these years.  Anyhoo, I hope that you gentlefolk can enlighten me here.

My configuration is as follows:

MACHTYPE=x86_64-unknown-cygwin
bash-4.4.12-3
coreutils-9.0-1
cygwin-3.4.3-1
gdb-11.2-1

Thanks!


问:
Total memory needed to store all Geohash strings
Geohash has precision levels ranging from 1 and 12 (e.g., 2p5qnb2). The longer a precision level, the smaller the size the Geohash covers.

What will be the total memory needed to store all Geohash strings?

For each Geohash character, it could be made up of 0 - 9 digit or 22 lowercase alphabets (all alphabets except "a", "i", "l" and "o"). This makes each character can be fit with 5 bits (2 ^ 5 = 32 possibilities from digits and lowercase alphabets), but let's assume 1 byte for each character for simplicity.

Below is my calculation:

For precision level of length 12, we will need 12 bytes each, and we will have 32 ^ 12 of Geohash strings.

Similarly, for precision level of length 12, we will have 32 ^ 11 of Geohash strings.

And so on.

So we will have 32 ^ 12 + 32 ^ 11 + 32 ^ 10 ... + 32 = ~ 1.19 x 10 ^ 18 bytes = 1,190 PBs, which seems way off to me.


问:
MILP - Adding a constraint renders solution feasible?
I am using CBC solver in Pulp.

I have an MILP where I know a feasible solution exists.
Yet, I received a "Solution is not feasible" error.

I added a constraint "var_1 == var_2", which is part of the feasible solution I know exists and ta-dam, optimal solution is found.

How can this be?
Shouldn't the solver be able to always find a solution if one exists

I will note that all variables are either integers bounded between [1,50] or binary variables.

Thank you


问:
How to get the IBKR TWS API to recognize the Path that has been added to the Environment Variable through python
Basically I have Installed Python, TWS Desktop app, and the TWS api on Windows which I run on Mac through parallels. I am using the terminal on Windows and am accessing it through cmd. I then type 'python' in the terminal. From here I type 'import ibapi' and the terminal is producing an error 'ModuleNotFoundError: No module named 'ibapi'' For additional context, I have added a path on the 'Edit environment variable' from the Windows start menu and it is called 'C:\Python\ibapi'.

I am expecting to be able to write scripts through the API so that I write algos to trade through the TWS API.


问:
Command failed with a non-zero return code (123)
I am running into an issue when I try to generate a build with electron-packager (npx electron-packager . --platform=win32 --arch=x64). On Windows with intel chip (inside guext linux vm) the same config (package.json) and same command yield a good *.exe application. However, when I try this inside a guest vm Linux on a macOS arm64, I run into :

Command failed with a non-zero return code (123) : wine64 ...
parameters ...

I haven't found an explanation in the wine website. I also looked online but without any luck. I noticed that I don't have wine32 and wine sometimes recommend the installation. Note that the command does not include the ia32 arch.

In any case, I tried the complete reinstallation of wine on a new guest vm (Ubuntu 22.04). After following the step by step from wineHQ website, I run into the same problems, including when I enter the last command :

sudo apt install --install-recommends winehq-stable

Where the error is :

wine-stable:i386 : Depends libc6:i386 (>= 2.34) but it is not
installable

I tried to install this package but to no avail (libc6:i386; no installation candidate), I did follow the answer here and still no candidate. Package replacing it (libdb1-compat libnss-nis libnss-nisplus libcrypt1) were installed but still no luck.

Not all the time, but sometimes, Ubuntu report a crash of wine64 when running npx electron-packager... . In it is possible to find UnreportableReason : You have some obselete package version installed... libcurl4, libsasl2-2, libsasl2-module, libsasl2-modules-db. -> I did upgrade those, but that does not change the result of the electron-package command. In the Stacktrace the backtrace is stopped due to "cannot access memory at address xxxxxxx".

I also tried to move the project folder directly into a locally emulated drive of the Linux vm, but that does not have a different outcome.

Finally, I also tried to remove the option --out, --ico, etc. and ended up just running :

npx electron-packager . --platform=win32 --arch=x64

I am out of idea.


问:
memory ram usage increases after run that vba (copy\paste) sub code
i need help here . my PC memory ram usage starts to increases gradually after that sub is run,  until it is used completely and the system crashes ,

the code only to copy range from sheet and paste to other sheet

i use windows 10 , and the ram is 16 and i try with 32 ram also the same issue happen to me

the code is here

```<code>Private Sub btnsave_Click()

Dim ws1 As Worksheet, ws2 As Worksheet
Dim rng1 As Range, rng2 As Range

Set ws1 = ThisWorkbook.Sheets("main")
Set ws2 = ThisWorkbook.Sheets("Sor4main")
Set rng1 = Application.WorksheetFunction.XLookup(ws1.Range("E2"), ws1.Range("B:B"), ws1.Range("B:B").Offset(0, 1), "", 0, 1)
Set rng2 = ws2.Range("A3:CB3")

    ws1.Activate
    rng1.Activate
    ActiveCell.Select

    rng2.Copy
    rng1.PasteSpecial xlPasteValues

Set ws1 = Nothing
Set ws2 = Nothing
Set rng1 = Nothing
Set rng2 = Nothing

Application.CutCopyMode = False
ThisWorkbook.Save

End Sub
</code>```

Body:
i need help here . my PC memory ram usage starts to increases gradually after that sub is run,  until it is used completely and the system crashes ,

the code only to copy range from sheet and paste to other sheet

i use windows 10 , and the ram is 16 and i try with 32 ram also the same issue happen to me

the code is here

Private Sub btnsave_Click()

Dim ws1 As Worksheet, ws2 As Worksheet
Dim rng1 As Range, rng2 As Range

Set ws1 = ThisWorkbook.Sheets("main")
Set ws2 = ThisWorkbook.Sheets("Sor4main")
Set rng1 = Application.WorksheetFunction.XLookup(ws1.Range("E2"), ws1.Range("B:B"), ws1.Range("B:B").Offset(0, 1), "", 0, 1)
Set rng2 = ws2.Range("A3:CB3")

    ws1.Activate
    rng1.Activate
    ActiveCell.Select

    rng2.Copy
    rng1.PasteSpecial xlPasteValues

Set ws1 = Nothing
Set ws2 = Nothing
Set rng1 = Nothing
Set rng2 = Nothing

Application.CutCopyMode = False
ThisWorkbook.Save

End Sub


问:
Compiling LAPACKe library using C in MacOS
I need to use LAPACKe functions in a code that should run on Linux and macOS, but the problem is under OsX. I have a MacBook Pro 2021, with an M1 Pro processor, running an OsX 12.6.2

I wrote an example code

```<code>#include <stdio.h>
#include <stdlib.h>
#ifdef __APPLE__
#include <Accelerate/Accelerate.h>
#else
#include <lapacke.h>
#endif

const int N= 3, NRHS=2, LDA=N, LDB=N;

const int NN=5, NRHS2=3;

int main(int argc, char** argv) {

    /******* Example of using the lapack library with
             the C interface for solving linear systems
             for a general full matrix                   **************/
    int ipiv[N], info;
    // a[LDA*N]
    double a[] = {
         6.80, -2.11,  5.66,
        -6.05, -3.30,  5.36,
        -0.45,  2.58, -2.70
    };
    // b[LDB*NRHS]
    double b[] = {
         4.02, 6.19, -8.22,
        -1.56, 4.00, -8.67
    };

    printf("\nTest of using LAPACKe Library\n");
    printf("Matrix A : %d by %d\n", N, N);
    for(int i=0; i<N; i++){
        int s = i;
        for(int j=0; j<N; j++, s+=LDA) printf(" % 6.2lf", a[s]);
        printf("\n");
    }

    printf("\nRight hand side %d vectors of %d\n", NRHS, N);
    for(int i=0; i<N; i++){
        int s = i;
        for(int j=0; j<NRHS; j++, s+=LDA) printf(" % 10.6lf", b[s]);
        printf("\n");
    }
    /** As long the LAPACK_COL_MAJOR is used, the matrix is
        filled up by columns, pay attention in the way is printed **/
    info = LAPACKE_dgesv( LAPACK_COL_MAJOR, N, NRHS, a, LDA, ipiv, b, LDB);

    if (info == 0) {
        printf("\nFactorization of LU : %d by %d\n", N, N);
        for(int i=0; i<N; i++){
            int s = i;
            for(int j=0; j<N; j++, s+=LDA) printf(" % 10.5lf", a[s]);
            printf("\n");
        }

        printf("\nSolution of %dright hand side vectors of %d\n", NRHS, N);
        for(int i=0; i<N; i++){
            int s = i;
            for(int j=0; j<NRHS; j++, s+=LDA) printf(" % 10.6lf", b[s]);
            printf("\n");
        }

        printf("\nFactorization pivot indices by %d\n", N);
        for(int i=0; i<N; i++) printf(" % 5.0d", ipiv[i]);
        printf("\n\n");

    } // End of if (info == 0)
    else
        printf("An error ocurred in the LAPACK lib dgesv, with code %d\n", info);

    /******* Example of using the lapack library with
         the C interface for solving linear systems
         for a trigiagonal matrix                     **************/
    int ldb = NN;
    // d1[NN-1] lower diagonal
    double dl[] = {1, 4, 4, 1};
    // d[NN] main diagonal
    double d[] = {-2, -2, -2, -2, -2};
    // du[NN-1] upper diagonal
    double du[] = {1, 4, 4, 1};

    // bb[NN*NRHS2] number of righ hand side vectors
    double bb[] = {
         3.,    5.,    5.,    5.,    3.,
        -1.56,  4.,   -8.67,  1.75,  2.86,
         9.81, -4.09, -4.57, -8.61,  8.99
    };

    info = LAPACKE_dgtsv(LAPACK_COL_MAJOR, NN, NRHS2, dl, d, du, bb, ldb);

    if (info == 0) {
        printf("\nTest of using LAPACKe Library for Tridiagonal systems\n");
        printf("\nSolution of %dright hand side vectors of %d\n", NRHS2, NN);
        for(int i=0; i<NN; i++){
            int s = i;
            for(int j=0; j<NRHS2; j++, s+=ldb) printf(" % 10.6lf", bb[s]);
            printf("\n");
        }

    } // End of if (info == 0)
    else
        printf("An error ocurred in the LAPACK lib dgesv, with code %d\n", info);

    return 0;
}
</code>```

This runs in a WSL (Windows Subsystem Linux) and compiles successfully making the command
gcc example2.c -o lapack -llapacke

But, when I try to compile it in my Mac using the line
gcc example2.c -o lapacke -framework Accelerate

I receive the following error:

```<code>example2.c:47:9: error: implicit declaration of function 'LAPACKE_dgesv' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        info = LAPACKE_dgesv( LAPACK_COL_MAJOR, N, NRHS, a, LDA, ipiv, b, LDB);
               ^
example2.c:47:24: error: use of undeclared identifier 'LAPACK_COL_MAJOR'
        info = LAPACKE_dgesv( LAPACK_COL_MAJOR, N, NRHS, a, LDA, ipiv, b, LDB);
                              ^
example2.c:91:9: error: implicit declaration of function 'LAPACKE_dgtsv' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        info = LAPACKE_dgtsv(LAPACK_COL_MAJOR, NN, NRHS2, dl, d, du, bb, ldb);
               ^
example2.c:91:9: note: did you mean 'LAPACKE_dgesv'?
example2.c:47:9: note: 'LAPACKE_dgesv' declared here
        info = LAPACKE_dgesv( LAPACK_COL_MAJOR, N, NRHS, a, LDA, ipiv, b, LDB);
               ^
example2.c:91:23: error: use of undeclared identifier 'LAPACK_COL_MAJOR'
        info = LAPACKE_dgtsv(LAPACK_COL_MAJOR, NN, NRHS2, dl, d, du, bb, ldb);
                             ^
4 errors generated.
</code>```

It looks like inside the Accelerate.h the headers of LAPACKe functions are not defined. I was looking around but I don't see anything that can help me.

BTW, I have another example using cblas and it runs smoothly

Body:
I need to use LAPACKe functions in a code that should run on Linux and macOS, but the problem is under OsX. I have a MacBook Pro 2021, with an M1 Pro processor, running an OsX 12.6.2

I wrote an example code

#include <stdio.h>
#include <stdlib.h>
#ifdef __APPLE__
#include <Accelerate/Accelerate.h>
#else
#include <lapacke.h>
#endif

const int N= 3, NRHS=2, LDA=N, LDB=N;

const int NN=5, NRHS2=3;

int main(int argc, char** argv) {

    /******* Example of using the lapack library with
             the C interface for solving linear systems
             for a general full matrix                   **************/
    int ipiv[N], info;
    // a[LDA*N]
    double a[] = {
         6.80, -2.11,  5.66,
        -6.05, -3.30,  5.36,
        -0.45,  2.58, -2.70
    };
    // b[LDB*NRHS]
    double b[] = {
         4.02, 6.19, -8.22,
        -1.56, 4.00, -8.67
    };

    printf("\nTest of using LAPACKe Library\n");
    printf("Matrix A : %d by %d\n", N, N);
    for(int i=0; i<N; i++){
        int s = i;
        for(int j=0; j<N; j++, s+=LDA) printf(" % 6.2lf", a[s]);
        printf("\n");
    }

    printf("\nRight hand side %d vectors of %d\n", NRHS, N);
    for(int i=0; i<N; i++){
        int s = i;
        for(int j=0; j<NRHS; j++, s+=LDA) printf(" % 10.6lf", b[s]);
        printf("\n");
    }
    /** As long the LAPACK_COL_MAJOR is used, the matrix is
        filled up by columns, pay attention in the way is printed **/
    info = LAPACKE_dgesv( LAPACK_COL_MAJOR, N, NRHS, a, LDA, ipiv, b, LDB);

    if (info == 0) {
        printf("\nFactorization of LU : %d by %d\n", N, N);
        for(int i=0; i<N; i++){
            int s = i;
            for(int j=0; j<N; j++, s+=LDA) printf(" % 10.5lf", a[s]);
            printf("\n");
        }

        printf("\nSolution of %dright hand side vectors of %d\n", NRHS, N);
        for(int i=0; i<N; i++){
            int s = i;
            for(int j=0; j<NRHS; j++, s+=LDA) printf(" % 10.6lf", b[s]);
            printf("\n");
        }

        printf("\nFactorization pivot indices by %d\n", N);
        for(int i=0; i<N; i++) printf(" % 5.0d", ipiv[i]);
        printf("\n\n");

    } // End of if (info == 0)
    else
        printf("An error ocurred in the LAPACK lib dgesv, with code %d\n", info);

    /******* Example of using the lapack library with
         the C interface for solving linear systems
         for a trigiagonal matrix                     **************/
    int ldb = NN;
    // d1[NN-1] lower diagonal
    double dl[] = {1, 4, 4, 1};
    // d[NN] main diagonal
    double d[] = {-2, -2, -2, -2, -2};
    // du[NN-1] upper diagonal
    double du[] = {1, 4, 4, 1};

    // bb[NN*NRHS2] number of righ hand side vectors
    double bb[] = {
         3.,    5.,    5.,    5.,    3.,
        -1.56,  4.,   -8.67,  1.75,  2.86,
         9.81, -4.09, -4.57, -8.61,  8.99
    };

    info = LAPACKE_dgtsv(LAPACK_COL_MAJOR, NN, NRHS2, dl, d, du, bb, ldb);

    if (info == 0) {
        printf("\nTest of using LAPACKe Library for Tridiagonal systems\n");
        printf("\nSolution of %dright hand side vectors of %d\n", NRHS2, NN);
        for(int i=0; i<NN; i++){
            int s = i;
            for(int j=0; j<NRHS2; j++, s+=ldb) printf(" % 10.6lf", bb[s]);
            printf("\n");
        }

    } // End of if (info == 0)
    else
        printf("An error ocurred in the LAPACK lib dgesv, with code %d\n", info);

    return 0;
}

This runs in a WSL (Windows Subsystem Linux) and compiles successfully making the command
gcc example2.c -o lapack -llapacke

But, when I try to compile it in my Mac using the line
gcc example2.c -o lapacke -framework Accelerate

I receive the following error:

example2.c:47:9: error: implicit declaration of function 'LAPACKE_dgesv' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        info = LAPACKE_dgesv( LAPACK_COL_MAJOR, N, NRHS, a, LDA, ipiv, b, LDB);
               ^
example2.c:47:24: error: use of undeclared identifier 'LAPACK_COL_MAJOR'
        info = LAPACKE_dgesv( LAPACK_COL_MAJOR, N, NRHS, a, LDA, ipiv, b, LDB);
                              ^
example2.c:91:9: error: implicit declaration of function 'LAPACKE_dgtsv' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        info = LAPACKE_dgtsv(LAPACK_COL_MAJOR, NN, NRHS2, dl, d, du, bb, ldb);
               ^
example2.c:91:9: note: did you mean 'LAPACKE_dgesv'?
example2.c:47:9: note: 'LAPACKE_dgesv' declared here
        info = LAPACKE_dgesv( LAPACK_COL_MAJOR, N, NRHS, a, LDA, ipiv, b, LDB);
               ^
example2.c:91:23: error: use of undeclared identifier 'LAPACK_COL_MAJOR'
        info = LAPACKE_dgtsv(LAPACK_COL_MAJOR, NN, NRHS2, dl, d, du, bb, ldb);
                             ^
4 errors generated.

It looks like inside the Accelerate.h the headers of LAPACKe functions are not defined. I was looking around but I don't see anything that can help me.

BTW, I have another example using cblas and it runs smoothly


问:
flutter - FileSystemException: Exists failed, OS Error: The device is not ready., errno = 21
I had a windows 8.1 and now upgraded to windows 10 and i copied my flutter sdk from the windows 8.1 with path (D:\flutter\Sdk\flutter\) to the new windows 10 and changed the path to (C:\Programming\Flutter\Sdk\flutter) and i installed android studio, changed path in my system variables and set everything up but whenever i try running flutter doctor i get the error below

Command

```<code>flutter doctor
</code>```

Steps to Reproduce

upgrade windows from 8.1 to 10

copied flutter sdk from windows 8.1 to 10

changed path from D:\flutter\Sdk\flutter\ to C:\Programming\Flutter\Sdk\flutter

run flutter doctor

Logs

FileSystemException: FileSystemException: Exists failed, path = 'D:\flutter\Sdk\flutter.pub-cache\hosted\pub.dartlang.org_fe_analyzer_shared-41.0.0\lib' (OS Error: The device is not ready.
, errno = 21)

```<code>#0      _Directory.existsSync (dart:io/directory_impl.dart:94:7)
#1      ForwardingFileSystemEntity.existsSync (package:file/src/forwarding/forwarding_file_system_entity.dart:43:33)
#2      ErrorHandlingDirectory.existsSync.<anonymous closure> (package:flutter_tools/src/base/error_handling_io.dart:497:22)
#3      _runSync (package:flutter_tools/src/base/error_handling_io.dart:597:14)
#4      ErrorHandlingDirectory.existsSync (package:flutter_tools/src/base/error_handling_io.dart:496:12)
#5      PubDependencies.isUpToDate (package:flutter_tools/src/flutter_cache.dart:101:57)
<asynchronous suspension>
#6      Cache.updateAll (package:flutter_tools/src/cache.dart:673:11)
<asynchronous suspension>
#7      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1325:7)
<asynchronous suspension>
#8      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1209:27)
<asynchronous suspension>
#9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#11     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
<asynchronous suspension>
#12     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#13     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#14     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#15     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#16     main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>
</code>```

flutter doctor

```<code>[✓] Flutter (Channel stable, 3.3.4, on Microsoft Windows [Version 10.0.10240], locale en-US)
    • Flutter version 3.3.4 on channel stable at C:\Programming\Flutter\Sdk\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision eb6d86ee27 (3 months ago), 2022-10-04 22:31:45 -0700
    • Engine revision c08d7d5efc
    • Dart version 2.18.2
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at C:\Users\kcib\AppData\Local\Android\Sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✗] Visual Studio - develop for Windows
    ✗ Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[✓] Android Studio (version 3.5)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 44.0.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[✓] VS Code (version 1.74.2)
    • VS Code at C:\Users\kcib\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.56.0

[✓] Connected device (2 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.10240]
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 108.0.1462.76

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.
</code>```

Please how do i make change my path to listen to the new one

Body:
I had a windows 8.1 and now upgraded to windows 10 and i copied my flutter sdk from the windows 8.1 with path (D:\flutter\Sdk\flutter\) to the new windows 10 and changed the path to (C:\Programming\Flutter\Sdk\flutter) and i installed android studio, changed path in my system variables and set everything up but whenever i try running flutter doctor i get the error below

Command

flutter doctor

Steps to Reproduce

upgrade windows from 8.1 to 10

copied flutter sdk from windows 8.1 to 10

changed path from D:\flutter\Sdk\flutter\ to C:\Programming\Flutter\Sdk\flutter

run flutter doctor

Logs

FileSystemException: FileSystemException: Exists failed, path = 'D:\flutter\Sdk\flutter.pub-cache\hosted\pub.dartlang.org_fe_analyzer_shared-41.0.0\lib' (OS Error: The device is not ready.
, errno = 21)

#0      _Directory.existsSync (dart:io/directory_impl.dart:94:7)
#1      ForwardingFileSystemEntity.existsSync (package:file/src/forwarding/forwarding_file_system_entity.dart:43:33)
#2      ErrorHandlingDirectory.existsSync.<anonymous closure> (package:flutter_tools/src/base/error_handling_io.dart:497:22)
#3      _runSync (package:flutter_tools/src/base/error_handling_io.dart:597:14)
#4      ErrorHandlingDirectory.existsSync (package:flutter_tools/src/base/error_handling_io.dart:496:12)
#5      PubDependencies.isUpToDate (package:flutter_tools/src/flutter_cache.dart:101:57)
<asynchronous suspension>
#6      Cache.updateAll (package:flutter_tools/src/cache.dart:673:11)
<asynchronous suspension>
#7      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1325:7)
<asynchronous suspension>
#8      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1209:27)
<asynchronous suspension>
#9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#10     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#11     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
<asynchronous suspension>
#12     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#13     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#14     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#15     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#16     main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>

flutter doctor

[✓] Flutter (Channel stable, 3.3.4, on Microsoft Windows [Version 10.0.10240], locale en-US)
    • Flutter version 3.3.4 on channel stable at C:\Programming\Flutter\Sdk\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision eb6d86ee27 (3 months ago), 2022-10-04 22:31:45 -0700
    • Engine revision c08d7d5efc
    • Dart version 2.18.2
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at C:\Users\kcib\AppData\Local\Android\Sdk
    • Platform android-33, build-tools 33.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✗] Visual Studio - develop for Windows
    ✗ Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components

[✓] Android Studio (version 3.5)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 44.0.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[✓] VS Code (version 1.74.2)
    • VS Code at C:\Users\kcib\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.56.0

[✓] Connected device (2 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.10240]
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 108.0.1462.76

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.

Please how do i make change my path to listen to the new one


问:
Cannot install 'sudo' in docker container
I'm creating a Docker container for development (I've done it before and never had this problem) but when the Dockerfile executes the command ''RUN apt-get install -y sudo" the execution fails with the following result:

```<code>#0 0.563 Reading package lists...
#0 0.594 Building dependency tree...
#0 0.602 Reading state information...
#0 0.607 Package sudo is not available, but is referred to by another package.
#0 0.607 This may mean that the package is missing, has been obsoleted, or
#0 0.607 is only available from another source
#0 0.607
#0 0.609 E: Package 'sudo' has no installation candidate
</code>```

The following is the dockerfile I'm trying to run:

```<code>FROM node:18-bullseye

# Arguments
ARG USER=platzi
ARG USER_HOME=/home/$USER
ARG VOLUME=/home/volume
ARG SHELL=/bin/bash

RUN apt-get update

# Install OS utilities
RUN apt-get install -y locales \
    && sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen \
    && locale-gen
RUN apt-get install -y sudo   **execution fails here**
RUN apt-get install -y python3-pip
RUN pip3 install --upgrade pip

# Install Dev utilities
RUN pip3 install yapf
RUN pip3 install jupyter

# Install CLI utilities
RUN apt-get install -y jq
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
    && unzip awscliv2.zip \
    && ./aws/install \
    && apt-get install -y less

# Set up non root user
RUN echo "$USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN useradd -ms $SHELL $USER
RUN mkdir -p $VOLUME \
    && chown -R $USER:$USER $VOLUME

# Preserve bash history
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
    && echo $SNIPPET >> "/root/.bashrc" \
    && mkdir /commandhistory \
    && touch /commandhistory/.bash_history \
    && chown -R $USER /commandhistory \
    && echo $SNIPPET >> "$USER_HOME/.bashrc"

USER $USER
</code>```

Body:
I'm creating a Docker container for development (I've done it before and never had this problem) but when the Dockerfile executes the command ''RUN apt-get install -y sudo" the execution fails with the following result:

#0 0.563 Reading package lists...
#0 0.594 Building dependency tree...
#0 0.602 Reading state information...
#0 0.607 Package sudo is not available, but is referred to by another package.
#0 0.607 This may mean that the package is missing, has been obsoleted, or
#0 0.607 is only available from another source
#0 0.607
#0 0.609 E: Package 'sudo' has no installation candidate

The following is the dockerfile I'm trying to run:

FROM node:18-bullseye

# Arguments
ARG USER=platzi
ARG USER_HOME=/home/$USER
ARG VOLUME=/home/volume
ARG SHELL=/bin/bash

RUN apt-get update

# Install OS utilities
RUN apt-get install -y locales \
    && sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen \
    && locale-gen
RUN apt-get install -y sudo   **execution fails here**
RUN apt-get install -y python3-pip
RUN pip3 install --upgrade pip

# Install Dev utilities
RUN pip3 install yapf
RUN pip3 install jupyter

# Install CLI utilities
RUN apt-get install -y jq
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
    && unzip awscliv2.zip \
    && ./aws/install \
    && apt-get install -y less

# Set up non root user
RUN echo "$USER ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN useradd -ms $SHELL $USER
RUN mkdir -p $VOLUME \
    && chown -R $USER:$USER $VOLUME

# Preserve bash history
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
    && echo $SNIPPET >> "/root/.bashrc" \
    && mkdir /commandhistory \
    && touch /commandhistory/.bash_history \
    && chown -R $USER /commandhistory \
    && echo $SNIPPET >> "$USER_HOME/.bashrc"

USER $USER


问:
Packet capturing using arp poisoning and IP forwarding
I made a script in Golang that allows me to perform arp poisoning attack and with that I enabled IP forwarding to forward the packets to my router, When I use pcap.OpenLive I can only see the packets from the attacked device to the router. For example, if I go to www.example.com I can see the request from the device to the site but not the other case what can i do to capture those packets

```<code>    handle, err := pcap.OpenLive(iface.Name, 1024, true, pcap.BlockForever)
    if err != nil {
        return err
    }
    defer handle.Close()
    src := gopacket.NewPacketSource(handle, layers.LayerTypeEthernet)
    if err != nil {
        log.Fatal(err)
    }
    for packet := range src.Packets() {
       layer := packet.Layer(layers.LayerTypeIPv4)
        if layer == nil {
            continue
        }
        IPv4Layer, ok := layer.(*layers.IPv4)
        if !ok {
            continue
        }
         ................. more code here
     }
</code>```

Body:
I made a script in Golang that allows me to perform arp poisoning attack and with that I enabled IP forwarding to forward the packets to my router, When I use pcap.OpenLive I can only see the packets from the attacked device to the router. For example, if I go to www.example.com I can see the request from the device to the site but not the other case what can i do to capture those packets

    handle, err := pcap.OpenLive(iface.Name, 1024, true, pcap.BlockForever)
    if err != nil {
        return err
    }
    defer handle.Close()
    src := gopacket.NewPacketSource(handle, layers.LayerTypeEthernet)
    if err != nil {
        log.Fatal(err)
    }
    for packet := range src.Packets() {
       layer := packet.Layer(layers.LayerTypeIPv4)
        if layer == nil {
            continue
        }
        IPv4Layer, ok := layer.(*layers.IPv4)
        if !ok {
            continue
        }
         ................. more code here
     }


问:
How to handle large mui icon bundle - possibly by duplicating?
I have a react project that's using MUI icons. Most pages use only a few icons, but we do have a page that let's 'manager' to customize with the choice of everything in MUI icons library.

So you could imagine the bundle brings in the entire MUI icons library, which is very big. I thought that maybe I could somehow have 2 MUI icons bundle, one for 'customization' page, and one for all other pages (and I would try to lazy-load on customization page, I guess?). But I'm not sure on how to go on about this.

Or if there are other suggestions, that would be great to hear too.


问:
Assign id to each group in groupBy performantly
Continuing from this question, I have data like the following (but imagine I have 100M records with hundreds of distinct values for col)

```<code>row_num | col | val |
1       |  a  | 13  |
2       |  a  | 8   |
3       |  b  | 0   |
4       |  c  | 2   |
5       |  c  | 90  |
</code>```

I want to take the max of val by groups defined by col, and attach an id for each group. This id would be useful especially when group by columns include more than col.

Following this solution, I tried:

Setup

```<code>from pyspark.sql.types import *
schema = StructType([
    StructField('row_num', IntegerType()),
    StructField('col', StringType()),
    StructField('val', IntegerType()),
])
data = [
    Row(1, 'a', 13),
    Row(2, 'a', 8),
    Row(3, 'b', 0),
    Row(4, 'c', 2),
    Row(5, 'c', 90)
]
df = spark.createDataFrame(data, schema)
</code>```
```<code>from pyspark.sql.window import Window
import pyspark.sql.functions as F

agg_cols = ['val']
groupby_cols = ['col']
df_agg = df.groupby(groupby_cols).agg(*[F.max(col) for col in agg_cols])

df_with_groupids = df.select(
    F.dense_rank().over(Window.orderBy(*groupby_cols)).alias("groupid"),
    *df.columns
)

match_aggs_conditions = [
    df_with_groupids[col] == df_agg[col]
    for col in agg_cols
]

df_with_groupids.alias("df").join(
    df_agg,
    on=match_aggs_conditions,
    how='inner'
).select("df.*").show(truncate=False)

+-------+---+---+
|groupid|col|val|
+-------+-------+
|1      |a  |13 |
|3      |c  |90 |
|2      |b  |0  |
+-------+---+---+
</code>```

This works! But I'm concerned about this line:

```<code>F.dense_rank().over(Window.orderBy(*groupby_cols)).alias("groupid")
</code>```

Since there is no partitionBy in the Window clause, this means all records are gathered into one partition, correct? This is concerning for performance reasons, but I can't use this to partition by columns or else the group id's will be wrong.

Is there a way to get these group id's without bringing all records into a single partition?

I ran a df.explain and got:

```<code>== Physical Plan ==
*(7) Project [groupid#203, row_num#0, col#1, val#2]
+- *(7) SortMergeJoin [val#2], [val#24], Inner
   :- *(3) Sort [val#2 ASC NULLS FIRST], false, 0
   :  +- Exchange hashpartitioning(val#2, 200), [id=#439]
   :     +- *(2) Project [groupid#203, row_num#0, col#1, val#2]
   :        +- *(2) Filter isnotnull(val#2)
   :           +- Window [dense_rank(col#1) windowspecdefinition(col#1 ASC NULLS FIRST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS groupid#203], [col#1 ASC NULLS FIRST]
   :              +- *(1) Sort [col#1 ASC NULLS FIRST], false, 0
   :                 +- Exchange SinglePartition, [id=#415]
   :                    +- Scan ExistingRDD[row_num#0,col#1,val#2]
   +- *(6) Sort [val#24 ASC NULLS FIRST], false, 0
      +- Exchange hashpartitioning(val#24, 200), [id=#453]
         +- *(5) Filter isnotnull(val#24)
            +- *(5) HashAggregate(keys=[col#215], functions=[max(val#216)])
               +- Exchange hashpartitioning(col#215, 200), [id=#448]
                  +- *(4) HashAggregate(keys=[col#215], functions=[partial_max(val#216)])
                     +- *(4) Project [col#215, val#216]
                        +- Scan ExistingRDD[row_num#214,col#215,val#216]
</code>```

Can someone also explain how we may verify the performance concern raised in this question?

Body:
Continuing from this question, I have data like the following (but imagine I have 100M records with hundreds of distinct values for col)

row_num | col | val |
1       |  a  | 13  |
2       |  a  | 8   |
3       |  b  | 0   |
4       |  c  | 2   |
5       |  c  | 90  |

I want to take the max of val by groups defined by col, and attach an id for each group. This id would be useful especially when group by columns include more than col.

Following this solution, I tried:

Setup

from pyspark.sql.types import *
schema = StructType([
    StructField('row_num', IntegerType()),
    StructField('col', StringType()),
    StructField('val', IntegerType()),
])
data = [
    Row(1, 'a', 13),
    Row(2, 'a', 8),
    Row(3, 'b', 0),
    Row(4, 'c', 2),
    Row(5, 'c', 90)
]
df = spark.createDataFrame(data, schema)

from pyspark.sql.window import Window
import pyspark.sql.functions as F

agg_cols = ['val']
groupby_cols = ['col']
df_agg = df.groupby(groupby_cols).agg(*[F.max(col) for col in agg_cols])

df_with_groupids = df.select(
    F.dense_rank().over(Window.orderBy(*groupby_cols)).alias("groupid"),
    *df.columns
)

match_aggs_conditions = [
    df_with_groupids[col] == df_agg[col]
    for col in agg_cols
]

df_with_groupids.alias("df").join(
    df_agg,
    on=match_aggs_conditions,
    how='inner'
).select("df.*").show(truncate=False)

+-------+---+---+
|groupid|col|val|
+-------+-------+
|1      |a  |13 |
|3      |c  |90 |
|2      |b  |0  |
+-------+---+---+

This works! But I'm concerned about this line:

F.dense_rank().over(Window.orderBy(*groupby_cols)).alias("groupid")

Since there is no partitionBy in the Window clause, this means all records are gathered into one partition, correct? This is concerning for performance reasons, but I can't use this to partition by columns or else the group id's will be wrong.

Is there a way to get these group id's without bringing all records into a single partition?

I ran a df.explain and got:

== Physical Plan ==
*(7) Project [groupid#203, row_num#0, col#1, val#2]
+- *(7) SortMergeJoin [val#2], [val#24], Inner
   :- *(3) Sort [val#2 ASC NULLS FIRST], false, 0
   :  +- Exchange hashpartitioning(val#2, 200), [id=#439]
   :     +- *(2) Project [groupid#203, row_num#0, col#1, val#2]
   :        +- *(2) Filter isnotnull(val#2)
   :           +- Window [dense_rank(col#1) windowspecdefinition(col#1 ASC NULLS FIRST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS groupid#203], [col#1 ASC NULLS FIRST]
   :              +- *(1) Sort [col#1 ASC NULLS FIRST], false, 0
   :                 +- Exchange SinglePartition, [id=#415]
   :                    +- Scan ExistingRDD[row_num#0,col#1,val#2]
   +- *(6) Sort [val#24 ASC NULLS FIRST], false, 0
      +- Exchange hashpartitioning(val#24, 200), [id=#453]
         +- *(5) Filter isnotnull(val#24)
            +- *(5) HashAggregate(keys=[col#215], functions=[max(val#216)])
               +- Exchange hashpartitioning(col#215, 200), [id=#448]
                  +- *(4) HashAggregate(keys=[col#215], functions=[partial_max(val#216)])
                     +- *(4) Project [col#215, val#216]
                        +- Scan ExistingRDD[row_num#214,col#215,val#216]

Can someone also explain how we may verify the performance concern raised in this question?


问:
FPDI or FPDF Class with Templates for specific Users
currently working with those PDF Generator Classes and it is fun.
Now trying to find a solution to generate user based pdf-files and want to know how I could save those method and execute orders in my laravel project.
Here is an example inside

```<code>    $pdf->AddPage('P', 'A4');
    $pdf->SetFont('Arial', 'B', 14);
    $pdf->SetFont('Arial', '', 12);
    $pdf->Cell(0, 20, '', 0, 1);//end of line
    $pdf->Cell(130, 5, utf8_decode($company->name), 0, 0);
    $pdf->Cell(59, 5, '', 0, 1);//end of line
</code>```

The current question that every user want to have another Cell width or another font. And I did not find any idea to save those executions user based.

Maybe you can help me. Thanks!

Body:
currently working with those PDF Generator Classes and it is fun.
Now trying to find a solution to generate user based pdf-files and want to know how I could save those method and execute orders in my laravel project.
Here is an example inside

    $pdf->AddPage('P', 'A4');
    $pdf->SetFont('Arial', 'B', 14);
    $pdf->SetFont('Arial', '', 12);
    $pdf->Cell(0, 20, '', 0, 1);//end of line
    $pdf->Cell(130, 5, utf8_decode($company->name), 0, 0);
    $pdf->Cell(59, 5, '', 0, 1);//end of line

The current question that every user want to have another Cell width or another font. And I did not find any idea to save those executions user based.

Maybe you can help me. Thanks!


问:
munmap of an unlinked file - is the data flushed?
I am interested in using an mmap'ed file as a private swap space in case the machine doesn't have enough RAM for my huge tables. When I'm done with this processing, I no longer need these tables and hence there is no need to flush the data to disk if not already done so. Would mmap followed by unlinking the file (or alternatively opening a file with O_TMPFILE) cause munmap to skip flushing, since the file will be deleted anyway upon munmap (assuming its the only open reference to the file)? I'm primarily interested in Linux, but would also like to know the answer for MacOS.</p>


问:
initialise ngrx component store lazily from ngAfterViewInit
does ngrx component store have a connect() equivalent?

I have a dom element that's not available until ngAfterViewInit().
Can I include this dom element in my ngrx component store without it being nullable?

i.e. i want to remove the | null

```<code>export interface MyState {
   domElement: HTMLElement | null
}

</code>```

I can't do it in the constructor:

```<code>constructor() {
    super({
       domElement: ... don't have the dom element yet...
    });
  }
</code>```

but without the constructor, I can't update the state:

```<code>Error: SelectDatapointStore has not been initialized yet. Please make sure it is initialized before updating/getting.
</code>```

which it confirms in the docs ( https://ngrx.io/guide/component-store/initialization ):

Note: Initialization has to be done before updating the state, otherwise an error would be thrown.

One solution I can think of is to make a new state,
e.g.

```<code>state2: Observable<Required<MyState>> = state$.filter(s => s.domElement != null)
</code>```

and use that to derive other states, but i don't think this is the intended way.

Body:
does ngrx component store have a connect() equivalent?

I have a dom element that's not available until ngAfterViewInit().
Can I include this dom element in my ngrx component store without it being nullable?

i.e. i want to remove the | null

export interface MyState {
   domElement: HTMLElement | null
}

I can't do it in the constructor:

constructor() {
    super({
       domElement: ... don't have the dom element yet...
    });
  }

but without the constructor, I can't update the state:

Error: SelectDatapointStore has not been initialized yet. Please make sure it is initialized before updating/getting.

which it confirms in the docs ( https://ngrx.io/guide/component-store/initialization ):

Note: Initialization has to be done before updating the state, otherwise an error would be thrown.

One solution I can think of is to make a new state,
e.g.

state2: Observable<Required<MyState>> = state$.filter(s => s.domElement != null)

and use that to derive other states, but i don't think this is the intended way.


问:
EmptyDataError: No columns to parse from file when reading, manipulating, and combining files using Pandas in for-loop
I want to read a list of CSV files, , and then perform a series of operations using pandas before concatenating the data frames.

For a single file, I would do:

```<code>df= pd.read_csv("/work/exon_kipan.01.csv", sep="\t", index_col=0, low_memory=False)
df= df[df.columns[::3]]
df= df.T
del df[df.columns[0]]
df.index = df.index.str.upper()
df= df.sort_index()
df.index = ['-'.join( s.split('-')[:4]) for s in df.index.tolist() ]
df.rename_axis(None, axis=1, inplace=True)
</code>```

Output:

```<code>    pd.DataFrame({'chr1:12595-12721:+': {'TCGA-A3-3307-01A': '0',
  'TCGA-A3-3308-01A': '150',
  'TCGA-A3-3311-01A': '0',
  'TCGA-A3-3313-01A': '50'},
 'chr1:12613-12721:+': {'TCGA-A3-3307-01A': '0',
  'TCGA-A3-3308-01A': '150',
  'TCGA-A3-3311-01A': '0',
  'TCGA-A3-3313-01A': '40'},
 'chr1:12646-12697:+': {'TCGA-A3-3307-01A': '0',
  'TCGA-A3-3308-01A': '95',
  'TCGA-A3-3311-01A': '0',
  'TCGA-A3-3313-01A': '7'},
 'chr1:13221-14409:+': {'TCGA-A3-3307-01A': '478',
  'TCGA-A3-3308-01A': '1555',
  'TCGA-A3-3311-01A': '294',
  'TCGA-A3-3313-01A': '693'}})
</code>```

However, now I want to read, manipulate, and concatenate multiple files.

```<code>filename = '/work/exon_kipan.{:02}.csv'
df_dict = {}
exon_clin_list = []
for i in range(1, 25):
    df_dict[i] = pd.read_csv(filename.format(i), index_col=0, low_memory=False, sep="\t")
    df_dict[i] = df_dict[i][df_dict[i].columns[::3]]
    df_dict[i] = df_dict[i].T
    del df_dict[i][df_dict[i].columns[0]]
    df_dict[i].index = df_dict[i].index.str.upper()
    df_dict[i] = df_dict[i].sort_index()
    df_dict[i].index = ['-'.join( s.split('-')[:4]) for s in df_dict[i].index.tolist() ]
    df_dict[i].rename_axis(None, axis=1, inplace=True)
    df_dict[i] = df_dict[i].loc[~df_dict[i].index.duplicated(keep='first')]

    exon_clin_list.append(df_dict[i])

exon_clin = pd.concat(exon_clin_list)
exon_clin
</code>```

My code raised:

```<code>EmptyDataError: No columns to parse from file
</code>```

Body:
I want to read a list of CSV files, , and then perform a series of operations using pandas before concatenating the data frames.

For a single file, I would do:

df= pd.read_csv("/work/exon_kipan.01.csv", sep="\t", index_col=0, low_memory=False)
df= df[df.columns[::3]]
df= df.T
del df[df.columns[0]]
df.index = df.index.str.upper()
df= df.sort_index()
df.index = ['-'.join( s.split('-')[:4]) for s in df.index.tolist() ]
df.rename_axis(None, axis=1, inplace=True)

Output:

    pd.DataFrame({'chr1:12595-12721:+': {'TCGA-A3-3307-01A': '0',
  'TCGA-A3-3308-01A': '150',
  'TCGA-A3-3311-01A': '0',
  'TCGA-A3-3313-01A': '50'},
 'chr1:12613-12721:+': {'TCGA-A3-3307-01A': '0',
  'TCGA-A3-3308-01A': '150',
  'TCGA-A3-3311-01A': '0',
  'TCGA-A3-3313-01A': '40'},
 'chr1:12646-12697:+': {'TCGA-A3-3307-01A': '0',
  'TCGA-A3-3308-01A': '95',
  'TCGA-A3-3311-01A': '0',
  'TCGA-A3-3313-01A': '7'},
 'chr1:13221-14409:+': {'TCGA-A3-3307-01A': '478',
  'TCGA-A3-3308-01A': '1555',
  'TCGA-A3-3311-01A': '294',
  'TCGA-A3-3313-01A': '693'}})

However, now I want to read, manipulate, and concatenate multiple files.

filename = '/work/exon_kipan.{:02}.csv'
df_dict = {}
exon_clin_list = []
for i in range(1, 25):
    df_dict[i] = pd.read_csv(filename.format(i), index_col=0, low_memory=False, sep="\t")
    df_dict[i] = df_dict[i][df_dict[i].columns[::3]]
    df_dict[i] = df_dict[i].T
    del df_dict[i][df_dict[i].columns[0]]
    df_dict[i].index = df_dict[i].index.str.upper()
    df_dict[i] = df_dict[i].sort_index()
    df_dict[i].index = ['-'.join( s.split('-')[:4]) for s in df_dict[i].index.tolist() ]
    df_dict[i].rename_axis(None, axis=1, inplace=True)
    df_dict[i] = df_dict[i].loc[~df_dict[i].index.duplicated(keep='first')]

    exon_clin_list.append(df_dict[i])

exon_clin = pd.concat(exon_clin_list)
exon_clin

My code raised:

EmptyDataError: No columns to parse from file


问:
How to replace foreground service in android app widget?
There is a appwidget in my android app.

features of appwidget

If user press button of appwidget, it request backend api.

Update view with api result.

I originally wrote app widget with foreground service.
Because I thought that work like it cannot be handled without service.

But, for now, Foreground service in app widget is restricted in Android 12 or higher.

So I should modify it with other way.

Which method can I choose in this case?


问:
How to understand the output of GLMGam and apply the gam.predict to real case?
I am leraning the GAM model using the statsmodels package, and I used the df_autos data model provided by UCI. However, I had a hard time to understand the ouput of the GAM and also failed to use gam.predict to predict a score.

Here is the code I used:

```<code>from statsmodels.gam.tests.test_penalized import df_autos
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
import statsmodels.api as sm

df_autos_new = df_autos[['city_mpg', 'weight','hp']].copy()

# Split the data into X (input features) and y (output variable)
X = df_autos_new.drop(columns='city_mpg')
y = df_autos_new['city_mpg']

# Split the data into training and test sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

x_spline = df_autos_new[['weight', 'hp']]

bs = BSplines(x_spline, df=[5, 5], degree=[3, 3])

gam = sm.GLMGam.from_formula('city_mpg ~ weight + hp', data=df_autos_new, smoother=bs).fit()

# Evaluate the GAM
print(gam.summary())

</code>```

And the output is like:

And I tried to check the output of the model using
y_pred = gam.predict(df_autos)
but got the erros like:

```<code>ValueError: shapes (203,3) and (11,) not aligned: 3 (dim 1) != 11 (dim 0)

</code>```

So I was wondering what's the input data format? And how to understand the output of the  Generalized Linear Model Regression Results ?

Thanks in advance!!!!!

Body:
I am leraning the GAM model using the statsmodels package, and I used the df_autos data model provided by UCI. However, I had a hard time to understand the ouput of the GAM and also failed to use gam.predict to predict a score.

Here is the code I used:

from statsmodels.gam.tests.test_penalized import df_autos
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
import statsmodels.api as sm

df_autos_new = df_autos[['city_mpg', 'weight','hp']].copy()

# Split the data into X (input features) and y (output variable)
X = df_autos_new.drop(columns='city_mpg')
y = df_autos_new['city_mpg']

# Split the data into training and test sets
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

x_spline = df_autos_new[['weight', 'hp']]

bs = BSplines(x_spline, df=[5, 5], degree=[3, 3])

gam = sm.GLMGam.from_formula('city_mpg ~ weight + hp', data=df_autos_new, smoother=bs).fit()

# Evaluate the GAM
print(gam.summary())

And the output is like:

And I tried to check the output of the model using
y_pred = gam.predict(df_autos)
but got the erros like:

ValueError: shapes (203,3) and (11,) not aligned: 3 (dim 1) != 11 (dim 0)

So I was wondering what's the input data format? And how to understand the output of the  Generalized Linear Model Regression Results ?

Thanks in advance!!!!!


问:
How to deploy ISR site on Heroku?
Hello i'm trying to deploy my NextJS site on Heroku. The problem is that i want to use the ISR functionality of NextJS sites but i dont know how, when i try to deploy it always ends on Heroku using the SSG build.

I expect Heroku uses the build that the next export command produces and ISR functionality works.

This is my package.json scripts:

```<code>  "scripts": {
    "dev": "next dev",
    "build": "next build && next-sitemap && next export && next-export-optimize-images",
    "start": "next start",
    "lint": "next lint"
  },
</code>```

Title: How to deploy ISR site on Heroku?

Body:
Hello i'm trying to deploy my NextJS site on Heroku. The problem is that i want to use the ISR functionality of NextJS sites but i dont know how, when i try to deploy it always ends on Heroku using the SSG build.

I expect Heroku uses the build that the next export command produces and ISR functionality works.

This is my package.json scripts:

  "scripts": {
    "dev": "next dev",
    "build": "next build && next-sitemap && next export && next-export-optimize-images",
    "start": "next start",
    "lint": "next lint"
  },


问:
Using yt-channel-info getChannelVideos with Netlify Functions produces TypeError
I'm using the npm library yt-channel-info to get videos from a YouTube channel. This is my function:

import ytch from 'yt-channel-info'

export const handler = async () => {

    const payload = {
        channelId: '...', // This is a channel ID, any channel ID will do
        channelIdType: 1,
     }

     ytch.getChannelVideos(payload).then((response) => {
        if (!response.alertMessage) {
           console.log(response)
        } else {
           console.log('Channel could not be found.')
           // throw response.alertMessage
        }
     }).catch((err) => {
        console.log(err)
     })

}
```
<p>This function works on Replit, but when I deploy it via Netlify Functions, I get the following error:</p>
```TypeError: video.title.runs.at is not a function
    at YoutubeGrabberHelper.parseVideo (/Users/.../node_modules/yt-channel-info/app/helper.js:192:49)
    at /Users/.../node_modules/yt-channel-info/app/helper.js:110:19
    at Array.map (<anonymous>)
    at YoutubeGrabberHelper.parseChannelVideoResponse (/Users/.../node_modules/yt-channel-info/app/helper.js:109:8)
    at Function.getChannelVideosNewest (/Users/.../node_modules/yt-channel-info/app/fetchers/channel.js:7:29)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at Function.getChannelVideos (/Users/.../node_modules/yt-channel-info/app/youtube-grabber.js:223:14)
```

I have tried other functions in yt-channel-info, and they work fine on Netlify Functions + Replit, and I've tried swapping out the channel ID, and other minor debugging things, but no dice. When I've looked on GitHub for other people using the library with Netlify Functions, nobody else seems to be having an issue with this particular function. Any ideas why I might be getting this error, and how I can deploy the function? I think I'm missing something.

Body:
I'm using the npm library yt-channel-info to get videos from a YouTube channel. This is my function:

import ytch from 'yt-channel-info'

export const handler = async () => {

    const payload = {
        channelId: '...', // This is a channel ID, any channel ID will do
        channelIdType: 1,
     }

     ytch.getChannelVideos(payload).then((response) => {
        if (!response.alertMessage) {
           console.log(response)
        } else {
           console.log('Channel could not be found.')
           // throw response.alertMessage
        }
     }).catch((err) => {
        console.log(err)
     })

}

This function works on Replit, but when I deploy it via Netlify Functions, I get the following error:

TypeError: video.title.runs.at is not a function
    at YoutubeGrabberHelper.parseVideo (/Users/.../node_modules/yt-channel-info/app/helper.js:192:49)
    at /Users/.../node_modules/yt-channel-info/app/helper.js:110:19
    at Array.map (<anonymous>)
    at YoutubeGrabberHelper.parseChannelVideoResponse (/Users/.../node_modules/yt-channel-info/app/helper.js:109:8)
    at Function.getChannelVideosNewest (/Users/.../node_modules/yt-channel-info/app/fetchers/channel.js:7:29)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at Function.getChannelVideos (/Users/.../node_modules/yt-channel-info/app/youtube-grabber.js:223:14)

I have tried other functions in yt-channel-info, and they work fine on Netlify Functions + Replit, and I've tried swapping out the channel ID, and other minor debugging things, but no dice. When I've looked on GitHub for other people using the library with Netlify Functions, nobody else seems to be having an issue with this particular function. Any ideas why I might be getting this error, and how I can deploy the function? I think I'm missing something.


问:
Visual Studio Navigation Bar Not Showing Overloaded Functions
how do you enable showing different overloaded functions in the navigation bar in Visual Studio?

Currently I have two functions, one with 0 and and one with several parameters and the navigation bar only displays the function with no parameters by default.


问:
USPS Address validation rest API is not working as expected
I am trying to validate the below address using USPS rest API provided by USPS.

```<code>2205 Ambassador Rd NE,
APT 122,
Albuquerque,
NM 87112
</code>```

but in the response, address1 and address2 are interchanged.

Request:

```<code>https://secure.shippingapis.com/ShippingAPI.dll?API=Verify&XML=<AddressValidateRequest USERID="XXXXXXXXXXXX">
<Revision>1</Revision><Address ID="0">
<Address1>2205 Ambassador Rd NE</Address1>
<Address2>Apt 122</Address2>
<City>Albuquerque</City>
<State>NM</State>
<Zip5>87112</Zip5><Zip4/>
</Address>
</AddressValidateRequest>
</code>```

Typically apartment number will be entered as the address2, but on the response, it shows address1.

Response:

```<code><?xml version="1.0" encoding="UTF-8"?>
 <AddressValidateResponse>
    <Address ID="0">
        <Address1>APT 122</Address1>
        <Address2>2205 AMBASSADOR RD NE</Address2>
        <City>ALBUQUERQUE</City>
        <State>NM</State>
        <Zip5>87112</Zip5>
        <Zip4>2746</Zip4>
        <DeliveryPoint>47</DeliveryPoint>
        <CarrierRoute>C001</CarrierRoute>
        <Footnotes>N</Footnotes>
        <DPVConfirmation>Y</DPVConfirmation>
        <DPVCMRA>N</DPVCMRA>
        <DPVFootnotes>AABB</DPVFootnotes>
        <Business>N</Business>
        <CentralDeliveryPoint>N</CentralDeliveryPoint>
        <Vacant>N</Vacant>
    </Address>
 </AddressValidateResponse>
</code>```

Expected response:

```<code><?xml version="1.0" encoding="UTF-8"?>
 <AddressValidateResponse>
    <Address ID="0">
        <Address1>2205 AMBASSADOR RD NE</Address1>
        <Address2>APT 122</Address2>
        <City>ALBUQUERQUE</City>
        <State>NM</State>
        <Zip5>87112</Zip5>
        <Zip4>2746</Zip4>
        <DeliveryPoint>47</DeliveryPoint>
        <CarrierRoute>C001</CarrierRoute>
        <Footnotes>N</Footnotes>
        <DPVConfirmation>Y</DPVConfirmation>
        <DPVCMRA>N</DPVCMRA>
        <DPVFootnotes>AABB</DPVFootnotes>
        <Business>N</Business>
        <CentralDeliveryPoint>N</CentralDeliveryPoint>
        <Vacant>N</Vacant>
    </Address>
 </AddressValidateResponse>
</code>```

Body:
I am trying to validate the below address using USPS rest API provided by USPS.

2205 Ambassador Rd NE,
APT 122,
Albuquerque,
NM 87112

but in the response, address1 and address2 are interchanged.

Request:

https://secure.shippingapis.com/ShippingAPI.dll?API=Verify&XML=<AddressValidateRequest USERID="XXXXXXXXXXXX">
<Revision>1</Revision><Address ID="0">
<Address1>2205 Ambassador Rd NE</Address1>
<Address2>Apt 122</Address2>
<City>Albuquerque</City>
<State>NM</State>
<Zip5>87112</Zip5><Zip4/>
</Address>
</AddressValidateRequest>

Typically apartment number will be entered as the address2, but on the response, it shows address1.

Response:

<?xml version="1.0" encoding="UTF-8"?>
 <AddressValidateResponse>
    <Address ID="0">
        <Address1>APT 122</Address1>
        <Address2>2205 AMBASSADOR RD NE</Address2>
        <City>ALBUQUERQUE</City>
        <State>NM</State>
        <Zip5>87112</Zip5>
        <Zip4>2746</Zip4>
        <DeliveryPoint>47</DeliveryPoint>
        <CarrierRoute>C001</CarrierRoute>
        <Footnotes>N</Footnotes>
        <DPVConfirmation>Y</DPVConfirmation>
        <DPVCMRA>N</DPVCMRA>
        <DPVFootnotes>AABB</DPVFootnotes>
        <Business>N</Business>
        <CentralDeliveryPoint>N</CentralDeliveryPoint>
        <Vacant>N</Vacant>
    </Address>
 </AddressValidateResponse>

Expected response:

<?xml version="1.0" encoding="UTF-8"?>
 <AddressValidateResponse>
    <Address ID="0">
        <Address1>2205 AMBASSADOR RD NE</Address1>
        <Address2>APT 122</Address2>
        <City>ALBUQUERQUE</City>
        <State>NM</State>
        <Zip5>87112</Zip5>
        <Zip4>2746</Zip4>
        <DeliveryPoint>47</DeliveryPoint>
        <CarrierRoute>C001</CarrierRoute>
        <Footnotes>N</Footnotes>
        <DPVConfirmation>Y</DPVConfirmation>
        <DPVCMRA>N</DPVCMRA>
        <DPVFootnotes>AABB</DPVFootnotes>
        <Business>N</Business>
        <CentralDeliveryPoint>N</CentralDeliveryPoint>
        <Vacant>N</Vacant>
    </Address>
 </AddressValidateResponse>


问:
AudioManager.EXTRA_SCO_AUDIO_STATE always return -1
I have a call recording app , when i record a call on android 12  , it does only record my voice but not the other person voice , for this reason i thought about using The bluetooth Sco which i think it might help in resolving this issue , but i could not make it work , can any one help me please . Thank you

This is receiver where i check for it

```<code> public void onReceive(Context context, Intent intent) {
        Bundle bundle;
        String state;
        int scoState = -1;
        String incomingNumber;
        String action = intent.getAction();

        if(action != null && action.equals(AudioManager.EXTRA_SCO_AUDIO_STATE)){
            scoState = intent.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE,-1);
            Intent intentService = new Intent(context, RecorderService.class);
                        serviceName = intentService.getComponent();
                        intentService.putExtra(ARG_INCOMING, false);
                        intentService.putExtra(BLUETOOTH_STATE,scoState);

                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                            context.startForegroundService(intentService);
                        } else {
                            context.startService(intentService);
                        }
        }
}

</code>```

This is manifest file

```<code>  <receiver
            android:name=".recorder.CallReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.PHONE_STATE" />
                <action android:name="android.media.extra.SCO_AUDIO_STATE"/>
            </intent-filter>

        </receiver>
</code>```

*This is how i start it( blueToothState is basically the state i pass from receiver to service )

```<code>  if(AudioManager.SCO_AUDIO_STATE_CONNECTED == blueToothState){
                audioManager.setBluetoothScoOn(true);
                audioManager.startBluetoothSco();
                putSpeakerOff();
            }
</code>```

Body:
I have a call recording app , when i record a call on android 12  , it does only record my voice but not the other person voice , for this reason i thought about using The bluetooth Sco which i think it might help in resolving this issue , but i could not make it work , can any one help me please . Thank you

This is receiver where i check for it

 public void onReceive(Context context, Intent intent) {
        Bundle bundle;
        String state;
        int scoState = -1;
        String incomingNumber;
        String action = intent.getAction();

        if(action != null && action.equals(AudioManager.EXTRA_SCO_AUDIO_STATE)){
            scoState = intent.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE,-1);
            Intent intentService = new Intent(context, RecorderService.class);
                        serviceName = intentService.getComponent();
                        intentService.putExtra(ARG_INCOMING, false);
                        intentService.putExtra(BLUETOOTH_STATE,scoState);

                        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                            context.startForegroundService(intentService);
                        } else {
                            context.startService(intentService);
                        }
        }
}

This is manifest file

  <receiver
            android:name=".recorder.CallReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.PHONE_STATE" />
                <action android:name="android.media.extra.SCO_AUDIO_STATE"/>
            </intent-filter>

        </receiver>

*This is how i start it( blueToothState is basically the state i pass from receiver to service )

  if(AudioManager.SCO_AUDIO_STATE_CONNECTED == blueToothState){
                audioManager.setBluetoothScoOn(true);
                audioManager.startBluetoothSco();
                putSpeakerOff();
            }


问:
What does context backgorund protection mean on Android?
In the Google I/O app there is following theme with an intereseting comment I don't really understand:

```<code><style name="AppTheme" parent="Base.AppTheme">
        <!-- We use a transparent nav bar on API 29, as the system is responsible for applying
             context background protection -->
        <item name="android:navigationBarColor">@color/transparent</item>
        <item name="ioschedNavigationBarDividerColor">@color/transparent</item>
    </style>
</code>```

What does context background protection is? And should each app use this or what is the use case?

Body:
In the Google I/O app there is following theme with an intereseting comment I don't really understand:

What does context background protection is? And should each app use this or what is the use case?


问:
UnhandledPromiseRejectionWarning: TypeError: Class constructor PuzzleEntity cannot be invoked without 'new'
I am receiving a runtime error when attempting to query a postgres database using TypeORM.

Code

import { BaseEntity, Column, ConnectionOptions, DataSource, Entity, PrimaryGeneratedColumn } from 'typeorm';

interface IPuzzle {
  puzzle: string[][];
  puzzle_num: number;
  active_from: Date;
  active_to: Date;
}

@Entity()
class PuzzleEntity extends BaseEntity implements IPuzzle {
  @PrimaryGeneratedColumn()
  id: number;

  @Column('jsonb')
  puzzle: string[][];

  @Column({ unique: true })
  puzzle_num: number;

  @Column({ type: 'timestamptz', nullable: false })
  active_from: Date;

  @Column({ type: 'timestamptz', nullable: false })
  active_to: Date;
}

export const dbConnection: ConnectionOptions = {
  type: 'postgres',
  host: 'localhost',
  port: 5432,
  username: 'root',
  password: 'admin',
  database: 'test',
  synchronize: true,
  logging: false,
  entities: [PuzzleEntity],
};

console.log('Creating data source');
const appDataSource = new DataSource(dbConnection);
console.log('Initializing data source');

appDataSource.initialize();

const getCurrentPuzzle = async (): Promise<PuzzleEntity> => {
  const now = new Date();

  const res = await appDataSource
      .createQueryBuilder()
      .select("Puzzle")
      .from(PuzzleEntity, "Puzzle")
      .where(":now > Puzzle.active_from AND :now < Puzzle.active_to ", { now })
      .orderBy('active_from', 'DESC')
      .getOne();
  return res;
}

console.log('Attempting to query');
getCurrentPuzzle().then(p => console.log(p));

```
<p><strong>tsconfig.json</strong></p>
<pre class="lang-js prettyprint-override"><code>{
  "compileOnSave": false,
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "lib": ["es2017", "esnext.asynciterable"],
    "typeRoots": ["node_modules/@types"],
    "allowSyntheticDefaultImports": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "forceConsistentCasingInFileNames": true,
    "moduleResolution": "node",
    "pretty": true,
    "sourceMap": true,
    "declaration": true,
    "outDir": "dist",
    "allowJs": false,
    "noEmit": false,
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "importHelpers": true,
    "baseUrl": "src",
    "downlevelIteration": true,
    "paths": {
      "@/*": ["*"],
      "@controllers/*": ["controllers/*"],
      "@databases": ["databases"],
      "@dtos/*": ["dtos/*"],
      "@entities/*": ["entities/*"],
      "@exceptions/*": ["exceptions/*"],
      "@interfaces/*": ["interfaces/*"],
      "@middlewares/*": ["middlewares/*"],
      "@routes/*": ["routes/*"],
      "@services/*": ["services/*"],
      "@utils/*": ["utils/*"]
    }
  },
  "include": ["src/**/*.ts", "src/**/*.json", ".env"],
  "exclude": ["node_modules", "src/http", "src/logs", "src/tests"]
}

</code>```

Output

```<code>Creating data source
Initializing data source
Attempting to query
(node:9148) UnhandledPromiseRejectionWarning: TypeError: Class constructor PuzzleEntity cannot be invoked without 'new'
    at SelectQueryBuilder.createFromAlias (C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\node_modules\typeorm\query-builder\QueryBuilder.js:424:37)
</code>```

Full stack trace

```<code>(node:29724) UnhandledPromiseRejectionWarning: TypeError: Class constructor PuzzleEntity cannot be invoked without 'new'
    at SelectQueryBuilder.createFromAlias (C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\node_modules\typeorm\query-builder\QueryBuilder.js:424:37)
    at SelectQueryBuilder.from (C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\node_modules\typeorm\query-builder\SelectQueryBuilder.js:164:32)
    at C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\dist\app.js:73:10
    at Generator.next (<anonymous>)
    at C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\node_modules\tslib\tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\node_modules\tslib\tslib.js:113:16)
    at getCurrentPuzzle (C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\dist\app.js:68:40)
    at Object.<anonymous> (C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\dist\app.js:81:30)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:29724) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:29724) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
</code>```

Environment

Dependency
Version

Operating System
Windows 11

Node.js version
14.6.0

Typescript version
4.7.4

TypeORM version
0.3.11

I initially opened this an issue on the TypeORM github issue tracker but after sleeping on it I'm not so sure that it's a bug with TypeORM.

Body:
I am receiving a runtime error when attempting to query a postgres database using TypeORM.

Code

import { BaseEntity, Column, ConnectionOptions, DataSource, Entity, PrimaryGeneratedColumn } from 'typeorm';

interface IPuzzle {
  puzzle: string[][];
  puzzle_num: number;
  active_from: Date;
  active_to: Date;
}

@Entity()
class PuzzleEntity extends BaseEntity implements IPuzzle {
  @PrimaryGeneratedColumn()
  id: number;

  @Column('jsonb')
  puzzle: string[][];

  @Column({ unique: true })
  puzzle_num: number;

  @Column({ type: 'timestamptz', nullable: false })
  active_from: Date;

  @Column({ type: 'timestamptz', nullable: false })
  active_to: Date;
}

export const dbConnection: ConnectionOptions = {
  type: 'postgres',
  host: 'localhost',
  port: 5432,
  username: 'root',
  password: 'admin',
  database: 'test',
  synchronize: true,
  logging: false,
  entities: [PuzzleEntity],
};

console.log('Creating data source');
const appDataSource = new DataSource(dbConnection);
console.log('Initializing data source');

appDataSource.initialize();

const getCurrentPuzzle = async (): Promise<PuzzleEntity> => {
  const now = new Date();

  const res = await appDataSource
      .createQueryBuilder()
      .select("Puzzle")
      .from(PuzzleEntity, "Puzzle")
      .where(":now > Puzzle.active_from AND :now < Puzzle.active_to ", { now })
      .orderBy('active_from', 'DESC')
      .getOne();
  return res;
}

console.log('Attempting to query');
getCurrentPuzzle().then(p => console.log(p));

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "lib": ["es2017", "esnext.asynciterable"],
    "typeRoots": ["node_modules/@types"],
    "allowSyntheticDefaultImports": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "forceConsistentCasingInFileNames": true,
    "moduleResolution": "node",
    "pretty": true,
    "sourceMap": true,
    "declaration": true,
    "outDir": "dist",
    "allowJs": false,
    "noEmit": false,
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "importHelpers": true,
    "baseUrl": "src",
    "downlevelIteration": true,
    "paths": {
      "@/*": ["*"],
      "@controllers/*": ["controllers/*"],
      "@databases": ["databases"],
      "@dtos/*": ["dtos/*"],
      "@entities/*": ["entities/*"],
      "@exceptions/*": ["exceptions/*"],
      "@interfaces/*": ["interfaces/*"],
      "@middlewares/*": ["middlewares/*"],
      "@routes/*": ["routes/*"],
      "@services/*": ["services/*"],
      "@utils/*": ["utils/*"]
    }
  },
  "include": ["src/**/*.ts", "src/**/*.json", ".env"],
  "exclude": ["node_modules", "src/http", "src/logs", "src/tests"]
}

Output

Creating data source
Initializing data source
Attempting to query
(node:9148) UnhandledPromiseRejectionWarning: TypeError: Class constructor PuzzleEntity cannot be invoked without 'new'
    at SelectQueryBuilder.createFromAlias (C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\node_modules\typeorm\query-builder\QueryBuilder.js:424:37)

Full stack trace

(node:29724) UnhandledPromiseRejectionWarning: TypeError: Class constructor PuzzleEntity cannot be invoked without 'new'
    at SelectQueryBuilder.createFromAlias (C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\node_modules\typeorm\query-builder\QueryBuilder.js:424:37)
    at SelectQueryBuilder.from (C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\node_modules\typeorm\query-builder\SelectQueryBuilder.js:164:32)
    at C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\dist\app.js:73:10
    at Generator.next (<anonymous>)
    at C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\node_modules\tslib\tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\node_modules\tslib\tslib.js:113:16)
    at getCurrentPuzzle (C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\dist\app.js:68:40)
    at Object.<anonymous> (C:\Users\David Stewart\Downloads\o_my_word-main\o_my_word-main\web_app\server\dist\app.js:81:30)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:29724) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:29724) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Environment

Dependency
Version

Operating System
Windows 11

Node.js version
14.6.0

Typescript version
4.7.4

TypeORM version
0.3.11

I initially opened this an issue on the TypeORM github issue tracker but after sleeping on it I'm not so sure that it's a bug with TypeORM.


问:
Flutter: Can you tell how many Google Maps API Calls are being made
In flutter, am using the 'google_maps_flutter' plugin to display a google map, and trying to understand how best to implement a fee structure (through In App Purchases).

In my case, I foresee the app being used infrequently but when used, it would be a high usage of the google maps API.

So I feel a subscription plan wouldn't be appealing, and the best fee structure would be for users to buy consumable credits.

For this to work, I need to be able to know how many API calls a user makes, so I can deduct them from the credit.

But I can't seem to find any documentation to determine how many API calls are being made.


问:
How to store/sanitize HTML from a WYSIWYG (TinyMCE) for storage in MongoDB
I am using MongoDB for a project. I am thinking about incorporating TinyMCE into the site for some text content. I know that I can just store the resulting HTML in MongoDB as a string. However, I am not certain about how to ensure that I do that properly.

What are some consideration for storing HTML in MongoDB? Is it generally fine to store HTML like that in MongoDB?

Also, what about sanitizing the HTML? Are there certain things I need to look out for? Do I need to use libraries for that or can I do it myself? If I need a library, what are some good ones for sanitizing HTML in MongoDB?

Thanks for any advice.


问:
What is the best way to store String arrays or Lists in a database(mysql) and change this lists using Spring Boot and Hibernate?
I want to create a web app in which you can log in and have your own list of todo's where you can add or delete them(a list of strings for every user). I don't know much about SQL so I asked ChatGpt to give me a solution.

His solution was to create a column with datatype json. Btw this how I want my User to look like - click

Then it said to create a class that implements UserType interface like this:

```<code>package com.example.boottestfinal;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.usertype.UserType;

import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class JsonStringType implements UserType{

    @Override
    public int getSqlType() {
        return 0;
    }

    @Override
    public Class returnedClass() {
        return List.class;
    }

    @Override
    public boolean equals(Object x, Object y) throws HibernateException {
        return Objects.equals(x, y);
    }

    @Override
    public int hashCode(Object x) throws HibernateException {
        return Objects.hashCode(x);
    }

    @Override
    public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index, SharedSessionContractImplementor sharedSessionContractImplementor) throws HibernateException, SQLException {
        if (value == null) {
            preparedStatement.setNull(index, Types.VARCHAR);
        } else {
            try {
                preparedStatement.setString(index, new ObjectMapper().writeValueAsString(value));
            } catch (JsonProcessingException e) {
                throw new HibernateException(e);
            }
        }
    }

    @Override
    public Object nullSafeGet(ResultSet resultSet, int columnIndex, SharedSessionContractImplementor sharedSessionContractImplementor, Object owner) throws HibernateException, SQLException {
        String json = resultSet.getString(columnIndex);
        if (json == null) {
            return new ArrayList<>();
        }
        try {
            return new ObjectMapper().readValue(json, List.class);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public Object deepCopy(Object value) throws HibernateException {
        return value;
    }

    @Override
    public boolean isMutable() {
        return true;
    }

    @Override
    public Serializable disassemble(Object value) throws HibernateException {
        return (Serializable) value;
    }

    @Override
    public Object assemble(Serializable cached, Object owner) throws HibernateException {
        return cached;
    }

    @Override
    public Object replace(Object original, Object target, Object owner) throws HibernateException {
        return original;
    }
}
</code>```

And in entity add an annotation @Type
but when Im doing that I recieve such an error
I presume there can be a better way to do this, or there is a way to fix this error.
Hope someone helps!

Body:
I want to create a web app in which you can log in and have your own list of todo's where you can add or delete them(a list of strings for every user). I don't know much about SQL so I asked ChatGpt to give me a solution.

His solution was to create a column with datatype json. Btw this how I want my User to look like - click

Then it said to create a class that implements UserType interface like this:

package com.example.boottestfinal;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.usertype.UserType;

import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class JsonStringType implements UserType{

    @Override
    public int getSqlType() {
        return 0;
    }

    @Override
    public Class returnedClass() {
        return List.class;
    }

    @Override
    public boolean equals(Object x, Object y) throws HibernateException {
        return Objects.equals(x, y);
    }

    @Override
    public int hashCode(Object x) throws HibernateException {
        return Objects.hashCode(x);
    }

    @Override
    public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index, SharedSessionContractImplementor sharedSessionContractImplementor) throws HibernateException, SQLException {
        if (value == null) {
            preparedStatement.setNull(index, Types.VARCHAR);
        } else {
            try {
                preparedStatement.setString(index, new ObjectMapper().writeValueAsString(value));
            } catch (JsonProcessingException e) {
                throw new HibernateException(e);
            }
        }
    }

    @Override
    public Object nullSafeGet(ResultSet resultSet, int columnIndex, SharedSessionContractImplementor sharedSessionContractImplementor, Object owner) throws HibernateException, SQLException {
        String json = resultSet.getString(columnIndex);
        if (json == null) {
            return new ArrayList<>();
        }
        try {
            return new ObjectMapper().readValue(json, List.class);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public Object deepCopy(Object value) throws HibernateException {
        return value;
    }

    @Override
    public boolean isMutable() {
        return true;
    }

    @Override
    public Serializable disassemble(Object value) throws HibernateException {
        return (Serializable) value;
    }

    @Override
    public Object assemble(Serializable cached, Object owner) throws HibernateException {
        return cached;
    }

    @Override
    public Object replace(Object original, Object target, Object owner) throws HibernateException {
        return original;
    }
}

And in entity add an annotation @Type
but when Im doing that I recieve such an error
I presume there can be a better way to do this, or there is a way to fix this error.
Hope someone helps!


问:
How to Solve Understatr: "Invalid char in json text error?"
I scraped data from understat using R a few days ago and it worked just fine and was able to scrape the stats I was looking for, and i exported them into the project directory for more accessibility. I try again, in a different project, a couple of days after and it doesn't work at all.

For example if I scrape using this function: get_player_seasons_stats(player_id = x) it returns "invalid char in json text."
I've loaded jsonlite and curl just to make sure everything was in place but it still returns the same error message no matter what. Here's a reprex:

remotes::install_github('ewenme/understatr')
#> Downloading GitHub repo ewenme/understatr@HEAD
#> Running `R CMD build`...
#> * checking for file 'C:\Users\xxx\AppData\Local\Temp\RtmpUHlVek\remotes4e607ff3b75\ewenme-understatr-dd6e48f/DESCRIPTION' ... OK
#> * preparing 'understatr':
#> * checking DESCRIPTION meta-information ... OK
#> * checking for LF line-endings in source and make files and shell scripts
#> * checking for empty or unneeded directories
#> Omitted 'LazyData' from DESCRIPTION
#> * building 'understatr_1.0.1.9000.tar.gz'
#> Installing package into 'C:/Users/xxx/AppData/Local/R/win-library/4.2'
#> (as 'lib' is unspecified)
library(understatr)

get_player_seasons_stats(player_id = 882)
#> Error: lexical error: invalid char in json text.
#>                                        NA
#>                      (right here) ------^
```
<p>Previously, the function returned a dataframe I could work with. I tried removing and installing tidyverse again but had no luck with that.</p>
<p>If I also try to get available leagues too, R is unable to scrape data at all, resulting in an empty tibble here:</p>
<pre class="lang-r prettyprint-override"><code>library(understatr)

#available leagues
leagues <- get_leagues_meta()

head(leagues, n = 2)
#> # A tibble: 0 × 0
</code>```

I wanted to know is someone has ever had this problem and how they solved it.

Body:
I scraped data from understat using R a few days ago and it worked just fine and was able to scrape the stats I was looking for, and i exported them into the project directory for more accessibility. I try again, in a different project, a couple of days after and it doesn't work at all.

For example if I scrape using this function: get_player_seasons_stats(player_id = x) it returns "invalid char in json text."
I've loaded jsonlite and curl just to make sure everything was in place but it still returns the same error message no matter what. Here's a reprex:

remotes::install_github('ewenme/understatr')
#> Downloading GitHub repo ewenme/understatr@HEAD
#> Running `R CMD build`...
#> * checking for file 'C:\Users\xxx\AppData\Local\Temp\RtmpUHlVek\remotes4e607ff3b75\ewenme-understatr-dd6e48f/DESCRIPTION' ... OK
#> * preparing 'understatr':
#> * checking DESCRIPTION meta-information ... OK
#> * checking for LF line-endings in source and make files and shell scripts
#> * checking for empty or unneeded directories
#> Omitted 'LazyData' from DESCRIPTION
#> * building 'understatr_1.0.1.9000.tar.gz'
#> Installing package into 'C:/Users/xxx/AppData/Local/R/win-library/4.2'
#> (as 'lib' is unspecified)
library(understatr)

get_player_seasons_stats(player_id = 882)
#> Error: lexical error: invalid char in json text.
#>                                        NA
#>                      (right here) ------^

Previously, the function returned a dataframe I could work with. I tried removing and installing tidyverse again but had no luck with that.

If I also try to get available leagues too, R is unable to scrape data at all, resulting in an empty tibble here:

library(understatr)

#available leagues
leagues <- get_leagues_meta()

head(leagues, n = 2)
#> # A tibble: 0 × 0

I wanted to know is someone has ever had this problem and how they solved it.


问:
projection inversion at focal point
im working on making a 3d engine but have an issue with the projection.

when im projecting the x,y points it gets inverted when behind the camera.

the points infront of the camera is normal.

the points behind of the camera is inverted/reflected and goes back onto the screen.

i have found this issue on other formulas, and while deeply searching for a solution i couldn't find any

heres my code for the projection it may be short but i figure this is the issue, if not you may request for more.

my github repository
https://github.com/roberto-e-torres/3d-engine/releases/tag/non-production

see (figure 1) for graph and visual

(figure 1)

```<code>world_coordinate=np.array([[*coordinate,1]])
        camera_coordinate = np.dot(camera.extrinsic, world_coordinate.T)
        camera_coordinate[0] *= 1
        tmp = camera_coordinate[1].copy()
        camera_coordinate[1] = camera_coordinate[2]
        camera_coordinate[2] = tmp
        image_coordinate = np.dot(camera.intrinsic, camera_coordinate)
        image_coordinate /= image_coordinate[2]
        x,y = image_coordinate.tolist()[0][0].__round__(),image_coordinate.tolist()[1][0].__round__()
</code>```

Title: projection inversion at focal point

Body:
im working on making a 3d engine but have an issue with the projection.

when im projecting the x,y points it gets inverted when behind the camera.

the points infront of the camera is normal.

the points behind of the camera is inverted/reflected and goes back onto the screen.

i have found this issue on other formulas, and while deeply searching for a solution i couldn't find any

heres my code for the projection it may be short but i figure this is the issue, if not you may request for more.

my github repository
https://github.com/roberto-e-torres/3d-engine/releases/tag/non-production

see (figure 1) for graph and visual

(figure 1)

world_coordinate=np.array([[*coordinate,1]])
        camera_coordinate = np.dot(camera.extrinsic, world_coordinate.T)
        camera_coordinate[0] *= 1
        tmp = camera_coordinate[1].copy()
        camera_coordinate[1] = camera_coordinate[2]
        camera_coordinate[2] = tmp
        image_coordinate = np.dot(camera.intrinsic, camera_coordinate)
        image_coordinate /= image_coordinate[2]
        x,y = image_coordinate.tolist()[0][0].__round__(),image_coordinate.tolist()[1][0].__round__()