问:
MariaDB Optimizing Big Table Selects With Table Partitioning
I have the following table that contains milions of rows (2M-30M)

rowId(int) intElementId(int) timestamp(int) float float

This table gets truncated and filled every time it is used , the primary operation is select using the intElementId that is an integer and the timestamp.
For example

SELECT * from myTable where intElementId = x and timestamp = y
```
<p>Currently im using btree indexes on intElementId and timestamp . The sum of the operations take quite a lot of time when theres is more data on my table.</p>
<p>I have thought of dynamically generating multiple tables based on my intElementId (eg testTable_xxx,testTable_xxx) that is usually bellow a thousand so i can query via the timestamp more effectivly in a smaller sample . While searching about this on different questions i have been discouraged to do this , because as i found out mariaDb is not optimized for something like this.</p>
<p>An alternative solution i have found is partitioning my table , i have seen a couple of applications for this but not many examples of it actually being used.</p>
<p>I have seen solutions partitioning by key seems to be what i want but on the mariaDB wiki its once again discouraged and suggested to use partitioning by range instead.</p>
<p>My questions are :</p>
<ol>
<li>Is partitioning by key okay ?</li>
<li>Is having ~ a 1000 partions okay ?</li>
<li>Is having less partitions than the number of the disting intElementIds bad ? and how does it affect me ?</li>
</ol>
<p>To test my solution i have used the following and it does seem to improve perfomance by about ~ 48%</p>
<pre class="lang-py prettyprint-override"><code>testData = generateTestData()

traditionalInsert(testData)
time = timeit.timeit(benchmarkDbTable, number=20)

partitionedInsert(testData)
time = timeit.timeit(benchmarkDbTable, number=20)

</code>```

Where my tables are generated like so

Traditional

CREATE TABLE testTable (`id` INT NOT NULL AUTO_INCREMENT , PRIMARY KEY (`id`),intElementIdINT, timestamp int, price FLOAT, volume float)

ALTER TABLE testTable ADD INDEX `intElementId` (`intElementId`)
```
<p>Partitioned where the number of partitions equals to the number of unique intElementId (<1000)</p>
<pre class="lang-py prettyprint-override"><code>CREATE TABLE testTable (`id` INT NOT NULL AUTO_INCREMENT , PRIMARY KEY (`id`,`intElementId`),intElementId INT, timestamp int, price FLOAT, volume INT)  PARTITION BY KEY (intElementId) PARTITIONS ?;",
</code>```

Testing Like so

cur.execute("SELECT COUNT(*) FROM testTable ")

cur.execute("SELECT DISTINCT intElementId FROM testTable ")
intElementId = cur.fetchall()

for element in intElementId:
    cur.execute(f"SELECT COUNT(*) FROM testTable WHERE intElementId= {element[0]}")

for element in intElementId:
    cur.execute(f"SELECT MIN(price), MAX(price) FROM testTable WHERE intElementId= {intElementId[0]}")

for elements in intElementId:
    cur.execute(f"SELECT price FROM testTable WHERE intElementId= {intElementId[0]} ORDER BY price DESC LIMIT 10")

```

Body:
I have the following table that contains milions of rows (2M-30M)

rowId(int) intElementId(int) timestamp(int) float float

This table gets truncated and filled every time it is used , the primary operation is select using the intElementId that is an integer and the timestamp.
For example

SELECT * from myTable where intElementId = x and timestamp = y

Currently im using btree indexes on intElementId and timestamp . The sum of the operations take quite a lot of time when theres is more data on my table.

I have thought of dynamically generating multiple tables based on my intElementId (eg testTable_xxx,testTable_xxx) that is usually bellow a thousand so i can query via the timestamp more effectivly in a smaller sample . While searching about this on different questions i have been discouraged to do this , because as i found out mariaDb is not optimized for something like this.

An alternative solution i have found is partitioning my table , i have seen a couple of applications for this but not many examples of it actually being used.

I have seen solutions partitioning by key seems to be what i want but on the mariaDB wiki its once again discouraged and suggested to use partitioning by range instead.

My questions are :

Is partitioning by key okay ?

Is having ~ a 1000 partions okay ?

Is having less partitions than the number of the disting intElementIds bad ? and how does it affect me ?

To test my solution i have used the following and it does seem to improve perfomance by about ~ 48%

testData = generateTestData()

traditionalInsert(testData)
time = timeit.timeit(benchmarkDbTable, number=20)

partitionedInsert(testData)
time = timeit.timeit(benchmarkDbTable, number=20)

Where my tables are generated like so

Traditional

CREATE TABLE testTable (`id` INT NOT NULL AUTO_INCREMENT , PRIMARY KEY (`id`),intElementIdINT, timestamp int, price FLOAT, volume float)

ALTER TABLE testTable ADD INDEX `intElementId` (`intElementId`)

Partitioned where the number of partitions equals to the number of unique intElementId (<1000)

CREATE TABLE testTable (`id` INT NOT NULL AUTO_INCREMENT , PRIMARY KEY (`id`,`intElementId`),intElementId INT, timestamp int, price FLOAT, volume INT)  PARTITION BY KEY (intElementId) PARTITIONS ?;",

Testing Like so

cur.execute("SELECT COUNT(*) FROM testTable ")

cur.execute("SELECT DISTINCT intElementId FROM testTable ")
intElementId = cur.fetchall()

for element in intElementId:
    cur.execute(f"SELECT COUNT(*) FROM testTable WHERE intElementId= {element[0]}")

for element in intElementId:
    cur.execute(f"SELECT MIN(price), MAX(price) FROM testTable WHERE intElementId= {intElementId[0]}")

for elements in intElementId:
    cur.execute(f"SELECT price FROM testTable WHERE intElementId= {intElementId[0]} ORDER BY price DESC LIMIT 10")


来源: stackexchange

问:
How to Display combine APIs using FLATLIST in react Native when we have a problem to merge two different APIs?
```<code>const App=()=>{
  const [name,setname] =useState([]);
  const [post,setpost] =useState([]);
  const fetchData=()=>{
    const APIone='https://jsonplaceholder.typicode.com/posts';
    const APItwo='https://jsonplaceholder.typicode.com/comments';
    const get_api_one=axios.get(API_one);
    const get_api_two=axios.get(API_two);
    axios.all([get_api_one,get_api_two]).then(
      axios.spread((...allData)=>{
        const alldatapost=allData[0]
        const alldatacomment=allData[1]
        console.log(alldatapost);
        console.log(alldatacomment);
      })
    )
  }
  useEffect(()=>{
    fetchData()
  },[])
</code>```

I am facing datadisplay issue with following code which i want to display on screen using flatlist

ContentLicense: CC BY-SA 4.0

Body:
const App=()=>{
  const [name,setname] =useState([]);
  const [post,setpost] =useState([]);
  const fetchData=()=>{
    const APIone='https://jsonplaceholder.typicode.com/posts';
    const APItwo='https://jsonplaceholder.typicode.com/comments';
    const get_api_one=axios.get(API_one);
    const get_api_two=axios.get(API_two);
    axios.all([get_api_one,get_api_two]).then(
      axios.spread((...allData)=>{
        const alldatapost=allData[0]
        const alldatacomment=allData[1]
        console.log(alldatapost);
        console.log(alldatacomment);
      })
    )
  }
  useEffect(()=>{
    fetchData()
  },[])

I am facing datadisplay issue with following code which i want to display on screen using flatlist


问:
Continue event propagation with react-aria button component
The react-aria library disables event bubbling for buttons. I have a button nested inside a div which acts as a file uploader. When my button is clicked the file explorer doesn't pop up because event bubbling is disabled. How do I continue event propagation with my button so when it's clicked it gets treated as the parent div being clicked.</p>


问:
Alternative to multiple instances of pseudo-singleton
I stumbled upon a pseudo-singleton class that is responsible for housing a few collections. It looks something like this:

```<code>public class PseudoSingleton {
    private List<Object> collection1;
    private List<Object> collection2;
    private static PseudoSingleton instance = null;

    public static synchronized PseudoSingleton getInstance() {
        if (instance == null) {
            instance = new PseudoSingleton();
        }
        return instance;
    }

    public static synchronized void reload()  {
        instance = new PseudoSingleton();
    }

    private PseudoSingleton() {
        load();
    }

    private void load() {
        //parse some files from disk and fill collections
    }
}
</code>```

The reason it is coded like this is that in a few places in code a comparison of collection1 before and after reload needs to be done.

However this way seems like a major code smell to me.

I tried to refactor the code slightly by making the reload() method not static:

```<code>public synchronized void reload() {
   //clear collections
   //load collections
}
</code>```

In order to be able to compare collection before reload I added a method that needs to be called before reloading the collection:

```<code>public List<Object> getCollection1Copy() {
   return new LinkedList<>(collection1);
}
</code>```

However, in review I got a comment that the previous way was better and I should leave it as is. I am not convinced. Should I insist to go my way or leave it? Or is there a better way to code it?

Body:
I stumbled upon a pseudo-singleton class that is responsible for housing a few collections. It looks something like this:

public class PseudoSingleton {
    private List<Object> collection1;
    private List<Object> collection2;
    private static PseudoSingleton instance = null;

    public static synchronized PseudoSingleton getInstance() {
        if (instance == null) {
            instance = new PseudoSingleton();
        }
        return instance;
    }

    public static synchronized void reload()  {
        instance = new PseudoSingleton();
    }

    private PseudoSingleton() {
        load();
    }

    private void load() {
        //parse some files from disk and fill collections
    }
}

The reason it is coded like this is that in a few places in code a comparison of collection1 before and after reload needs to be done.

However this way seems like a major code smell to me.

I tried to refactor the code slightly by making the reload() method not static:

public synchronized void reload() {
   //clear collections
   //load collections
}

In order to be able to compare collection before reload I added a method that needs to be called before reloading the collection:

public List<Object> getCollection1Copy() {
   return new LinkedList<>(collection1);
}

However, in review I got a comment that the previous way was better and I should leave it as is. I am not convinced. Should I insist to go my way or leave it? Or is there a better way to code it?


问:
Which Application Programming Interface function does Windows use to translate DNS using nslookup.exe?
Does anyone know which Windows API function does nslookup.exe use for DNS translations?
I tried to search for it on the internet, but I didn't find anything.
Thanks for any answer.</p>


问:
How to show many2many field of another model in form Odoo13?
I need to display many to many field in form view, depending on the related user

modelo que contiene many2many fields:

many2one field where I want to show the many2many of the other model but filtered by user_id(Column: Asesor de servicio) only show records(column:bodegas) by column: Asesor de servicio


问:
Nested loop indexing malfunction
I am writing a code to multiply two matrices, using the equation c[i][j] = (0<k<n)Sigma(a[i][k]*b[k][j])
But in first iteration, my final matrix goes from

```<code>[
    [0,0,0]
    [0,0,0]
]
</code>```

to

```<code>[
    [2,0,0]
    [2,0,0]
]

</code>```

That is an error because according to my code, only the [0][0]th element should be getting changed to 2, not [1][0]th element too. This is a bit hard to explain over text.
Here is my code snippet which doesn't work as meant to

```<code>scaledMatrix = [[0]*3]*n

for i in range(n):
    for j in range(3):
        sum_of_elements = 0
        for k in range(n):
            sum_of_elements += coordinateMatrix[i][k]*otherMatrix[k][j]
        scaledMatrix[i][j] = sum_of_elements
</code>```

Title: Nested loop indexing malfunction

Body:
I am writing a code to multiply two matrices, using the equation c[i][j] = (0<k<n)Sigma(a[i][k]*b[k][j])
But in first iteration, my final matrix goes from

[
    [0,0,0]
    [0,0,0]
]

to

[
    [2,0,0]
    [2,0,0]
]

That is an error because according to my code, only the [0][0]th element should be getting changed to 2, not [1][0]th element too. This is a bit hard to explain over text.
Here is my code snippet which doesn't work as meant to

scaledMatrix = [[0]*3]*n

for i in range(n):
    for j in range(3):
        sum_of_elements = 0
        for k in range(n):
            sum_of_elements += coordinateMatrix[i][k]*otherMatrix[k][j]
        scaledMatrix[i][j] = sum_of_elements


问:
updating hash table while reading excel file failing in powershell
Any idea why below code is failing.

```<code># Open an Excel workbook first:
$ExcelObj = New-Object -comobject Excel.Application
$ExcelWorkBook = $ExcelObj.Workbooks.Open("c:\anil\test.xlsx",2,$true)
$ExcelWorkSheet = $ExcelWorkBook.Sheets.Item("Sheet1")
# Get the number of filled in rows in the XLSX worksheet
$rowcount=$ExcelWorkSheet.UsedRange.Rows.Count
$report = @{}
$outFile = "vm_info.csv"
"VM Name,Vcenter,Disk usage" | Out-File -FilePath $outFile
######
$data = $ExcelWorksheet.Range("A1:Z100000").Value2
for( $row = 2 ; $row -lt $data.GetUpperBound(0); $row++) {
                         $vmname = $data[$row, 1]
                         if ( $vmname -notin $report.keys){
                         $report[$vmname] = @{}
                        $report[$vmname]['vcenter'] = $data[$row, 5]
                        $report[$vmname]['datasize'] = $data[$row, 12]
                                                           }
                         }

$ExcelWorkBook.close($true)
        $report.GetEnumerator()|foreach {

        "$($_.name),$($_.value.vcenter),$($_.value.datasize)" | Out-File -FilePath $outFile -Append
                                        }
</code>```

Message getting

Index operation failed; the array index evaluated to null.
At C:\anil\scripts\get_vm_disk_usage_from_excel.ps1:20 char:26

```<code>                     $report[$vmname] = @{}
</code>```

```<code>                     ~~~~~~~~~~~~~~~~~~~~~~
</code>```

CategoryInfo          : InvalidOperation: (:) [], RuntimeException

FullyQualifiedErrorId : NullArrayIndex

Body:
Any idea why below code is failing.

# Open an Excel workbook first:
$ExcelObj = New-Object -comobject Excel.Application
$ExcelWorkBook = $ExcelObj.Workbooks.Open("c:\anil\test.xlsx",2,$true)
$ExcelWorkSheet = $ExcelWorkBook.Sheets.Item("Sheet1")
# Get the number of filled in rows in the XLSX worksheet
$rowcount=$ExcelWorkSheet.UsedRange.Rows.Count
$report = @{}
$outFile = "vm_info.csv"
"VM Name,Vcenter,Disk usage" | Out-File -FilePath $outFile
######
$data = $ExcelWorksheet.Range("A1:Z100000").Value2
for( $row = 2 ; $row -lt $data.GetUpperBound(0); $row++) {
                         $vmname = $data[$row, 1]
                         if ( $vmname -notin $report.keys){
                         $report[$vmname] = @{}
                        $report[$vmname]['vcenter'] = $data[$row, 5]
                        $report[$vmname]['datasize'] = $data[$row, 12]
                                                           }
                         }

$ExcelWorkBook.close($true)
        $report.GetEnumerator()|foreach {

        "$($_.name),$($_.value.vcenter),$($_.value.datasize)" | Out-File -FilePath $outFile -Append
                                        }

Message getting

Index operation failed; the array index evaluated to null.
At C:\anil\scripts\get_vm_disk_usage_from_excel.ps1:20 char:26

                     $report[$vmname] = @{}

                     ~~~~~~~~~~~~~~~~~~~~~~

CategoryInfo          : InvalidOperation: (:) [], RuntimeException

FullyQualifiedErrorId : NullArrayIndex


问:
@Webservlet annotation and web.xml welcome file
I have a project named balance and this is webservlet annotation of "Security.java" file.
This is my webservlet.

```<code>@WebServlet({
    "/login",
    "/logout"
})
</code>```

and this is my welcome file.

```<code><?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="5.0">
  <display-name>balance</display-name>
    <welcome-file-list>
        <welcome-file>login</welcome-file>
    </welcome-file-list>
</web-app>
</code>```

but they are not connected.Everytime i run on server "localhost/8080/balance/" nothing show. I hope you all have good tips for me.

I want them to connect and execute the code.But nothing happens even error is not happens and just show nothing but white screen is annoyed.

Body:
I have a project named balance and this is webservlet annotation of "Security.java" file.
This is my webservlet.

@WebServlet({
    "/login",
    "/logout"
})

and this is my welcome file.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="5.0">
  <display-name>balance</display-name>
    <welcome-file-list>
        <welcome-file>login</welcome-file>
    </welcome-file-list>
</web-app>

but they are not connected.Everytime i run on server "localhost/8080/balance/" nothing show. I hope you all have good tips for me.

I want them to connect and execute the code.But nothing happens even error is not happens and just show nothing but white screen is annoyed.


问:
Error to compile Sending push notifications to Xamarin.Android apps using Notification Hubs code
I am new to Xamarin Android programming, I followed this Microsoft tutorial to send push notifications to Xamarin.Android apps using Notification Hubs

https://learn.microsoft.com/en-us/azure/notification-hubs/xamarin-notification-hubs-push-notifications-android-gcm

Unfortunately the code does not compile and it gives the errors in this function

```<code>public void OnPushNotificationReceived(Context context, INotificationMessage message)
    {
        var intent = new Intent(this, typeof(MainActivity)); // error here, 'this' is not accepted
        intent.AddFlags(ActivityFlags.ClearTop);
        var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot); // error here, 'this' is not accepted

        var notificationBuilder = new NotificationCompat.Builder(this, MainActivity.CHANNEL_ID); // error here, 'this' is not accepted

        notificationBuilder.SetContentTitle(message.Title)
                    .SetSmallIcon(Resource.Drawable.ic_launcher)
                    .SetContentText(message.Body)
                    .SetAutoCancel(true)
                    .SetShowWhen(false)
                    .SetContentIntent(pendingIntent);

        var notificationManager = NotificationManager.FromContext(this);// error here, 'this' is not accepted

        notificationManager.Notify(0, notificationBuilder.Build());
    }
</code>```

The errors are

1>(path removed)\AzureListener .cs(11,33,11,37): error CS1503: Argument 1: cannot convert from 'AzureListener' to 'Android.Content.Context'

1>(path removed)\AzureListener .cs(13,55,13,59): error CS1503: Argument 1: cannot convert from 'AzureListener' to 'Android.Content.Context?'

1>(path removed)\AzureListener .cs(15,66,15,70): error CS1503: Argument 1: cannot convert from 'AzureListener' to 'Android.Content.Context'

1>(path removed)\AzureListener .cs(24,67,24,71): error CS1503: Argument 1: cannot convert from 'AzureListener' to 'Android.Content.Context'

I have tried to go through the tutorial three times but with same errors.
Could anyone help to solve these errors? Thank you.

UPDATE: I am able to fix the errors by replacing 'this' with either 'context' or an object of MainActivity. After applying either one of them, I can run the app and receive a test notification from Azure (good news!) however the code is still not working (bad news!). It does not raise a notification, this bug was reported by another stackoverflow member here

Xamarin Forms using Azure Hubs. Push notifications not showing on android when app is running/active

Finally a message to Microsoft: please test your code before publish it, thanks!

Body:
I am new to Xamarin Android programming, I followed this Microsoft tutorial to send push notifications to Xamarin.Android apps using Notification Hubs

https://learn.microsoft.com/en-us/azure/notification-hubs/xamarin-notification-hubs-push-notifications-android-gcm

Unfortunately the code does not compile and it gives the errors in this function

public void OnPushNotificationReceived(Context context, INotificationMessage message)
    {
        var intent = new Intent(this, typeof(MainActivity)); // error here, 'this' is not accepted
        intent.AddFlags(ActivityFlags.ClearTop);
        var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot); // error here, 'this' is not accepted

        var notificationBuilder = new NotificationCompat.Builder(this, MainActivity.CHANNEL_ID); // error here, 'this' is not accepted

        notificationBuilder.SetContentTitle(message.Title)
                    .SetSmallIcon(Resource.Drawable.ic_launcher)
                    .SetContentText(message.Body)
                    .SetAutoCancel(true)
                    .SetShowWhen(false)
                    .SetContentIntent(pendingIntent);

        var notificationManager = NotificationManager.FromContext(this);// error here, 'this' is not accepted

        notificationManager.Notify(0, notificationBuilder.Build());
    }

The errors are

1>(path removed)\AzureListener .cs(11,33,11,37): error CS1503: Argument 1: cannot convert from 'AzureListener' to 'Android.Content.Context'

1>(path removed)\AzureListener .cs(13,55,13,59): error CS1503: Argument 1: cannot convert from 'AzureListener' to 'Android.Content.Context?'

1>(path removed)\AzureListener .cs(15,66,15,70): error CS1503: Argument 1: cannot convert from 'AzureListener' to 'Android.Content.Context'

1>(path removed)\AzureListener .cs(24,67,24,71): error CS1503: Argument 1: cannot convert from 'AzureListener' to 'Android.Content.Context'

I have tried to go through the tutorial three times but with same errors.
Could anyone help to solve these errors? Thank you.

UPDATE: I am able to fix the errors by replacing 'this' with either 'context' or an object of MainActivity. After applying either one of them, I can run the app and receive a test notification from Azure (good news!) however the code is still not working (bad news!). It does not raise a notification, this bug was reported by another stackoverflow member here

Xamarin Forms using Azure Hubs. Push notifications not showing on android when app is running/active

Finally a message to Microsoft: please test your code before publish it, thanks!


问:
Pytest is not detecting tests when the test class extends Base class
tests are not detected by pytest when test class extends Base class.
result is same when triggering tests with pycharm or from command line.

what changes should be done so that pytest detects tests in an extended class?

Below error is shown and displays the message "Empty Suite"

python: 3.8.14

pytest: 7.2.0

ERROR: not found: /Users/a/Documents/new/src/test/hsse/test_a.py::Test::test_a
(no name '/Users/a/Documents/new/src/test/hsse/test_a.py::Test::test_a' in any of [])

file: src/main/base/base.py

```<code>class Base():
    def some(self):
        return "a"
</code>```

file: src/test/dira/test_a.py

```<code>class Test_A(Base):
    def test_a(self):
        assert something
</code>```

If i do not extend Test_A from Base, then pytest is detecting tests and running them.
i tried searching online and few posts. but didn't find any such problem.

Body:
tests are not detected by pytest when test class extends Base class.
result is same when triggering tests with pycharm or from command line.

what changes should be done so that pytest detects tests in an extended class?

Below error is shown and displays the message "Empty Suite"

python: 3.8.14

pytest: 7.2.0

ERROR: not found: /Users/a/Documents/new/src/test/hsse/test_a.py::Test::test_a
(no name '/Users/a/Documents/new/src/test/hsse/test_a.py::Test::test_a' in any of [])

file: src/main/base/base.py

class Base():
    def some(self):
        return "a"

file: src/test/dira/test_a.py

class Test_A(Base):
    def test_a(self):
        assert something

If i do not extend Test_A from Base, then pytest is detecting tests and running them.
i tried searching online and few posts. but didn't find any such problem.


问:
ERROR Error: Uncaught (in promise): FirebaseError: Firebase: Error (auth/missing-email). FirebaseError: Firebase: Error (auth/missing-email)
When I try to use the method signInWithEmailAndPassword, I get the following error:

(PS, I have imported the AngularFireAuthModule and created a user on Firebase
import { AngularFireAuthModule } from '@angular/fire/compat/auth';)

```<code>POST https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=AIzaSyAdy0AH46hWcBLMFXR57-FrruspopK-0ao 400
2core.mjs:7643 ERROR Error: Uncaught (in promise): FirebaseError: Firebase: Error (auth/missing-email).
FirebaseError: Firebase: Error (auth/missing-email).
    at createErrorInternal (index-6bd8d405.js:474:41)
    at _fail (index-6bd8d405.js:445:11)
    at index-6bd8d405.js:976:17
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (asyncToGenerator.js:3:1)
    at _next (asyncToGenerator.js:25:1)
    at _ZoneDelegate.invoke (zone.js:372:26)
    at Object.onInvoke (core.mjs:26291:33)
    at _ZoneDelegate.invoke (zone.js:371:52)
    at Zone.run (zone.js:134:43)
    at resolvePromise (zone.js:1211:31)
    at resolvePromise (zone.js:1165:17)
    at zone.js:1278:17
    at _ZoneDelegate.invokeTask (zone.js:406:31)
    at Object.onInvokeTask (core.mjs:26278:33)
    at _ZoneDelegate.invokeTask (zone.js:405:60)
    at Zone.runTask (zone.js:178:47)
    at drainMicroTaskQueue (zone.js:585:35)
</code>```

Here is the Auth Service.ts file:

```<code>export class AuthService {

  constructor( private afAuth: AngularFireAuth, private toastr: ToastrService) { }

  login(email, password) {
    this.afAuth.signInWithEmailAndPassword(email, password).then(logRef => {
      this.toastr.success('Logged in Succesfully');
    });
  }
}
</code>```

And here is the login component.ts file

```<code>  constructor(private authService: AuthService) { }

  ngOnInit(): void {
  }

  onSubmit(formValue) {
    this.authService.login(formValue.email, formValue.password);

  }
}
</code>```

I believe that for some reason FireBase DB is not connecting to my Angular app. Help please.

Body:
When I try to use the method signInWithEmailAndPassword, I get the following error:

(PS, I have imported the AngularFireAuthModule and created a user on Firebase
import { AngularFireAuthModule } from '@angular/fire/compat/auth';)

POST https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=AIzaSyAdy0AH46hWcBLMFXR57-FrruspopK-0ao 400
2core.mjs:7643 ERROR Error: Uncaught (in promise): FirebaseError: Firebase: Error (auth/missing-email).
FirebaseError: Firebase: Error (auth/missing-email).
    at createErrorInternal (index-6bd8d405.js:474:41)
    at _fail (index-6bd8d405.js:445:11)
    at index-6bd8d405.js:976:17
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (asyncToGenerator.js:3:1)
    at _next (asyncToGenerator.js:25:1)
    at _ZoneDelegate.invoke (zone.js:372:26)
    at Object.onInvoke (core.mjs:26291:33)
    at _ZoneDelegate.invoke (zone.js:371:52)
    at Zone.run (zone.js:134:43)
    at resolvePromise (zone.js:1211:31)
    at resolvePromise (zone.js:1165:17)
    at zone.js:1278:17
    at _ZoneDelegate.invokeTask (zone.js:406:31)
    at Object.onInvokeTask (core.mjs:26278:33)
    at _ZoneDelegate.invokeTask (zone.js:405:60)
    at Zone.runTask (zone.js:178:47)
    at drainMicroTaskQueue (zone.js:585:35)

Here is the Auth Service.ts file:

export class AuthService {

  constructor( private afAuth: AngularFireAuth, private toastr: ToastrService) { }

  login(email, password) {
    this.afAuth.signInWithEmailAndPassword(email, password).then(logRef => {
      this.toastr.success('Logged in Succesfully');
    });
  }
}

And here is the login component.ts file

  constructor(private authService: AuthService) { }

  ngOnInit(): void {
  }

  onSubmit(formValue) {
    this.authService.login(formValue.email, formValue.password);

  }
}

I believe that for some reason FireBase DB is not connecting to my Angular app. Help please.


问:
cookies only shown in application tab after beeing sent
Currently running a nodejs server on localhost with a selfsigned cert to be able to use https, when logging is done the back end responds like this

```<code>var token = jwt.sign(
      {
        id: user.id,
      },
      process.env.API_SECRET,
      {
        expiresIn: "10 days",
      }
    );

    //responding to client request with user profile success message and  access token
    res.cookie("jwt", token, {
      httpOnly: true,
      secure: true,
      sameSite: "None",
      maxAge: 24 * 60 * 60 * 1000,
      domain: "localhost",
    }); //send token as a cookie when logging in
    res.status(200).send({
      message: "Login successfull",
    });
</code>```

the cookie is visable in the application tab on chrome dev tools but when i refresh this page the cookie dissapears. Url for login = "http://127.0.0.1:5500/src/html/login.html"

now comes the mystery, the cookie is not visalbe but whenever i make any type of request to the backend server the cookie show upp, for example i make a GET request from another page "http://127.0.0.1:5500/src/html/work-list.html" the cookie shows up. this get request dose not have "credentials:include"

i tried to change the domain several times and i have also tried to include a path:"/" in the res.cookie parameters, the cookie still behaves the same, its like the cookie dosent exist untill i make any type of request, what i did notice was that i can still use the cookie to validate my token since i do have a function for POST data that requiers a valid JWT, even tho i can not see it in the applications tab i can still use it to send said POST request

```<code>fetch("https://localhost:8000/wiki", {
    credentials: "include",
    method: "POST",
    body: CreateFormData(),
  })
</code>```
```<code>app.post("/wiki", verifyToken, upload.array("files"), CheckFiles); //creates req.files array
</code>```

im not sure if this is how its supposed to work but when googeling this issue the past 2 days i cant seem to find much. i will include github links to both frontend and backend here

the cookies are not visable in the url bar at all

the cookies are set from a fetch POST request to https://localhost:8000/login

Front-end:https://github.com/EliasJovancicPersson/GymnasieArbete
Back-end:https://github.com/EliasJovancicPersson/gymnasie-arbete-backend

Body:
Currently running a nodejs server on localhost with a selfsigned cert to be able to use https, when logging is done the back end responds like this

var token = jwt.sign(
      {
        id: user.id,
      },
      process.env.API_SECRET,
      {
        expiresIn: "10 days",
      }
    );

    //responding to client request with user profile success message and  access token
    res.cookie("jwt", token, {
      httpOnly: true,
      secure: true,
      sameSite: "None",
      maxAge: 24 * 60 * 60 * 1000,
      domain: "localhost",
    }); //send token as a cookie when logging in
    res.status(200).send({
      message: "Login successfull",
    });

the cookie is visable in the application tab on chrome dev tools but when i refresh this page the cookie dissapears. Url for login = "http://127.0.0.1:5500/src/html/login.html"

now comes the mystery, the cookie is not visalbe but whenever i make any type of request to the backend server the cookie show upp, for example i make a GET request from another page "http://127.0.0.1:5500/src/html/work-list.html" the cookie shows up. this get request dose not have "credentials:include"

i tried to change the domain several times and i have also tried to include a path:"/" in the res.cookie parameters, the cookie still behaves the same, its like the cookie dosent exist untill i make any type of request, what i did notice was that i can still use the cookie to validate my token since i do have a function for POST data that requiers a valid JWT, even tho i can not see it in the applications tab i can still use it to send said POST request

fetch("https://localhost:8000/wiki", {
    credentials: "include",
    method: "POST",
    body: CreateFormData(),
  })

app.post("/wiki", verifyToken, upload.array("files"), CheckFiles); //creates req.files array

im not sure if this is how its supposed to work but when googeling this issue the past 2 days i cant seem to find much. i will include github links to both frontend and backend here

the cookies are not visable in the url bar at all

the cookies are set from a fetch POST request to https://localhost:8000/login

Front-end:https://github.com/EliasJovancicPersson/GymnasieArbete
Back-end:https://github.com/EliasJovancicPersson/gymnasie-arbete-backend


问:
collapse programatically in BS5
in some old version with jquery i can run this:

```<code>function changes()
{
   $('#demo').collapse('toggle');
}
</code>```

to toggle programatically the collase view of and element in BS5 not exists and example of how to do and run this:

https://getbootstrap.com/docs/5.3/components/collapse/#how-it-works

Even in the little documentation for javascript it says the following:
Via JavaScript
Enable manually...

I understand that this means that it is given or enabled to an example that can be collapsible... but it is not explained or explained how the effect is triggered together with the animation or without the animation.

Can someone clarify if this can no longer be done? Since I have a div that at the end of the load and execution of the script over an input of type text... shows a div that was collapsed.

another alternative was before to use show/hidden but with the abandonment of jquery... this can no longer be done programmatically (without buttons or user click)

Title: collapse programatically in BS5

Body:
in some old version with jquery i can run this:

function changes()
{
   $('#demo').collapse('toggle');
}

to toggle programatically the collase view of and element in BS5 not exists and example of how to do and run this:

https://getbootstrap.com/docs/5.3/components/collapse/#how-it-works

Even in the little documentation for javascript it says the following:
Via JavaScript
Enable manually...

I understand that this means that it is given or enabled to an example that can be collapsible... but it is not explained or explained how the effect is triggered together with the animation or without the animation.

Can someone clarify if this can no longer be done? Since I have a div that at the end of the load and execution of the script over an input of type text... shows a div that was collapsed.

another alternative was before to use show/hidden but with the abandonment of jquery... this can no longer be done programmatically (without buttons or user click)


问:
Grails module inside maven archetype parent project not able to load grails plugins inside grails module
I have a parent maven archetype reactor project having a grails 2.4.4 project as submodule (standalone grails 2.4.4 project in process to a multimodule project), all build phases are working fine only during integration test (the grails project is using functional-test-1.2.7 grails plugin for it's integration test failsafe is not used here) it is not able to load the plugins below is the error.

```<code>[ERROR] ProjectBuildingException for org.grails.plugins:easyb:zip:2.0.5:test: Some problems were encountered while processing the POMs:
[ERROR] Unknown packaging: zip @ line 6, column 14

[ERROR] ProjectBuildingException for org.grails.plugins:functional-test:zip:1.2.7:test: Some problems were encountered while processing the POMs:
[ERROR] Unknown packaging: zip @ line 6, column 14

[ERROR] ProjectBuildingException for org.grails.plugins:tomcat:zip:7.0.54:test: Some problems were encountered while processing the POMs:
[ERROR] Unknown packaging: zip @ line 6, column 14
</code>```

It started the Integration test but after 4-5 scenarios it fails like below:

```<code>SCENARIO the login form should reject invalid credentials, such as_an empty domain
GIVEN functional testing DSL is initalized
WHEN the client accesses the login form
WHEN supplies invalid credentials, such as_an empty domain
WHEN submits the form
Clicked [Login] which resolved to a [class com.gargoylesoftware.htmlunit.html.HtmlSubmitInput]
THEN login rejects the credentials and returns the client to the login form with an error message
THEN tear down functional testing DSL
THEN enable login form
Error |
Error running easyb tests: null (Use --stacktrace to see the full trace)
</code>```

The old non-module grails project is working fine, and all IT tests are getting passed in local but in case of the multimodule project it is getting failed after 4-5 scenarios (it had total 251 test scenarios)
I've made sure both of them are identical.

Body:
I have a parent maven archetype reactor project having a grails 2.4.4 project as submodule (standalone grails 2.4.4 project in process to a multimodule project), all build phases are working fine only during integration test (the grails project is using functional-test-1.2.7 grails plugin for it's integration test failsafe is not used here) it is not able to load the plugins below is the error.

[ERROR] ProjectBuildingException for org.grails.plugins:easyb:zip:2.0.5:test: Some problems were encountered while processing the POMs:
[ERROR] Unknown packaging: zip @ line 6, column 14

[ERROR] ProjectBuildingException for org.grails.plugins:functional-test:zip:1.2.7:test: Some problems were encountered while processing the POMs:
[ERROR] Unknown packaging: zip @ line 6, column 14

[ERROR] ProjectBuildingException for org.grails.plugins:tomcat:zip:7.0.54:test: Some problems were encountered while processing the POMs:
[ERROR] Unknown packaging: zip @ line 6, column 14

It started the Integration test but after 4-5 scenarios it fails like below:

SCENARIO the login form should reject invalid credentials, such as_an empty domain
GIVEN functional testing DSL is initalized
WHEN the client accesses the login form
WHEN supplies invalid credentials, such as_an empty domain
WHEN submits the form
Clicked [Login] which resolved to a [class com.gargoylesoftware.htmlunit.html.HtmlSubmitInput]
THEN login rejects the credentials and returns the client to the login form with an error message
THEN tear down functional testing DSL
THEN enable login form
Error |
Error running easyb tests: null (Use --stacktrace to see the full trace)

The old non-module grails project is working fine, and all IT tests are getting passed in local but in case of the multimodule project it is getting failed after 4-5 scenarios (it had total 251 test scenarios)
I've made sure both of them are identical.


问:
Making a CountDownTimer not pause when activity is paused/backgrounded - Kotlin
I'm making an app in Android Studio that includes a CountDownTimer in MainActivity. I have some other activites to show other stuff but when I start the other activities, the CountDownTimer in MainActivity pauses. I need it to keep counting, how can I do that?

I haven't tried anything because I couldn't find any suitable solution to my problem and I'm not a Kotlin expert either.


问:
Running electron-forge app without webpack dev server
I've been creating an electron app template using the command

```<code>npx create-electron-app myapp --template=webpack
</code>```

This will create a folder with the files / directories:

```<code>forge.config.js
node_modules/
package.json
src/
webpack.main.config.js
webpack.renderer.config.js
webpack.rules.js
yarn.lock
</code>```

After running the app using npm start, it will start the app using the webpack-dev-server. But in the mode, it will load the files via http protocol. Then it's not allowed to load audio files from the local file system.

I need to start the app without using the http server. How can I disable the dev server, and just run webpack? I can reload the files using the F5 key, too.

Body:
I've been creating an electron app template using the command

npx create-electron-app myapp --template=webpack

This will create a folder with the files / directories:

forge.config.js
node_modules/
package.json
src/
webpack.main.config.js
webpack.renderer.config.js
webpack.rules.js
yarn.lock

After running the app using npm start, it will start the app using the webpack-dev-server. But in the mode, it will load the files via http protocol. Then it's not allowed to load audio files from the local file system.

I need to start the app without using the http server. How can I disable the dev server, and just run webpack? I can reload the files using the F5 key, too.


问:
I'm trying to store multiple elements into an Array/variable, then make an Assertion to verify those element text as expected using JavaScriptfunction
I need help: Using JavaScript function, I need to performed Store multiple element and get the Text  from each element and assert using loop. I'm unable to crate JS function as I'm beginner for JS function.

```<code>xpath = "//ui-table-1/div/following-sibling::div[@role='title']";
</code>```

this Xpath will get 4 element which are: Economy, Business, Latitude, Premium

I need to create JavaScript function where I should get those 4elemnt text and verify in same function. Could anyone please help me on that. Thank you.

function javaScriptStep() {
  let result = 'sample';
  callback(result);
}```

Body:
I need help: Using JavaScript function, I need to performed Store multiple element and get the Text  from each element and assert using loop. I'm unable to crate JS function as I'm beginner for JS function.

xpath = "//ui-table-1/div/following-sibling::div[@role='title']";

this Xpath will get 4 element which are: Economy, Business, Latitude, Premium

I need to create JavaScript function where I should get those 4elemnt text and verify in same function. Could anyone please help me on that. Thank you.

function javaScriptStep() {
  let result = 'sample';
  callback(result);
}


问:
GCC GIMPLE C++ API, how to insert a call to a member-function from another member-function?
I'm trying to write a plugin that adds support for [[invariant]] contracts in classes/structs to complete the Contracts support that was added recently in GCC.

This boils down to basically translating something like the below:

class Heap {
private:
    // ... fields

    [[invariant]]
    void check_invariants()
    {
        assert(size >= 0);
        assert(capacity >= 0);
        assert(size <= capacity);
    }

public:
    // constructor, push, pop, etc
};
```
<p>Into a form where calls to <code>this->invariant();</code> are made on the entry/exit of every member function that is not the <code>[[invariant]]</code> method itself.</p>
<p>So e.g., <code>push()</code> becomes:</p>
<pre class="lang-cpp prettyprint-override"><code>void push(int value)
{
    this->check_invariants(); // AUTO-GENERATED
    data[size] = value;
    size++;
    this->check_invariants(); // AUTO-GENERATED
}
</code>```

Now, I've managed to get most of this functionality I think, but I'm running into an issue where I can't seem to get the insertion of the call to this->check_invariants(); to work.

What I have is:

/**
 * Create a function call to 'this->invariant()' and insert it before the given
 */
static void
insert_instrumentation_fn(gimple* curr_stmt)
{
  tree ctype   = DECL_CONTEXT(current_function_decl);
  tree fn_decl = lookup_member(ctype,                       // class type
                               get_identifier("invariant"), // function name
                               1,                           // allow protected access
                               0,                           // do not raise error if not found
                               tf_warning_or_error          // error handling
  );

  // Extract the function declaration from the member function
  if (TREE_CODE(fn_decl) == BASELINK)
  {
    fn_decl = BASELINK_FUNCTIONS(fn_decl);
  }

  // build new method call
  // call is of the form: this->invariant()
  // Get the 'this' pointer
  tree              this_ptr = cp_build_fold_indirect_ref(DECL_ARGUMENTS(current_function_decl));
  vec<tree, va_gc>* args     = make_tree_vector_single(this_ptr);

  tree call = build_new_method_call(this_ptr,  // object
                                    fn_decl,   // function
                                    &args,     // arguments
                                    NULL_TREE, // conversion function
                                    LOOKUP_NORMAL,
                                    NULL,      // function decl
                                    tf_warning_or_error);

  // build gimple call
  gimple* call_stmt = gimple_build_call(call, 0);
  // insert call before current statement
  gimple_stmt_iterator gsi = gsi_for_stmt(curr_stmt);
  gsi_insert_before(&gsi, call_stmt, GSI_SAME_STMT);
}
```
<p>The issue is that this code produces an error like the below:</p>
```[build] > Inspecting function '__ct_base '
[build]      Found invariant attribute: invariant
[build]      adding function call before *this_3(D) ={v} {CLOBBER};
[build] /home/user/projects/gcc-invariant-plugin/test/test.cpp: In constructor 'Heap::Heap(int)':
[build] /home/user/projects/gcc-invariant-plugin/test/test.cpp:66:1: error: call to non-function 'void Heap::invariant()'
```
<hr />
<p>NOTE: I based this code off of examples in the GCC <code>gcc/cp/coroutines.cc</code> code generator I found:</p>
<pre class="lang-cpp prettyprint-override"><code>tree ash_m = lookup_member (coro_frame_type, coro_self_handle_id, 1,
                0, tf_warning_or_error);
tree ash = build_class_member_access_expr (actor_frame, ash_m, NULL_TREE,
                       false, tf_warning_or_error);
/* So construct the self-handle from the frame address.  */
tree hfa_m = lookup_member (handle_type, coro_from_address_identifier, 1,
                0, tf_warning_or_error);
r = build1 (CONVERT_EXPR, build_pointer_type (void_type_node), actor_fp);
vec<tree, va_gc> *args = make_tree_vector_single (r);
tree hfa = build_new_method_call (ash, hfa_m, &args, NULL_TREE, LOOKUP_NORMAL,
                  NULL, tf_warning_or_error)
</code>```

Body:
I'm trying to write a plugin that adds support for [[invariant]] contracts in classes/structs to complete the Contracts support that was added recently in GCC.

This boils down to basically translating something like the below:

class Heap {
private:
    // ... fields

    [[invariant]]
    void check_invariants()
    {
        assert(size >= 0);
        assert(capacity >= 0);
        assert(size <= capacity);
    }

public:
    // constructor, push, pop, etc
};

Into a form where calls to this->invariant(); are made on the entry/exit of every member function that is not the [[invariant]] method itself.

So e.g., push() becomes:

void push(int value)
{
    this->check_invariants(); // AUTO-GENERATED
    data[size] = value;
    size++;
    this->check_invariants(); // AUTO-GENERATED
}

Now, I've managed to get most of this functionality I think, but I'm running into an issue where I can't seem to get the insertion of the call to this->check_invariants(); to work.

What I have is:

/**
 * Create a function call to 'this->invariant()' and insert it before the given
 */
static void
insert_instrumentation_fn(gimple* curr_stmt)
{
  tree ctype   = DECL_CONTEXT(current_function_decl);
  tree fn_decl = lookup_member(ctype,                       // class type
                               get_identifier("invariant"), // function name
                               1,                           // allow protected access
                               0,                           // do not raise error if not found
                               tf_warning_or_error          // error handling
  );

  // Extract the function declaration from the member function
  if (TREE_CODE(fn_decl) == BASELINK)
  {
    fn_decl = BASELINK_FUNCTIONS(fn_decl);
  }

  // build new method call
  // call is of the form: this->invariant()
  // Get the 'this' pointer
  tree              this_ptr = cp_build_fold_indirect_ref(DECL_ARGUMENTS(current_function_decl));
  vec<tree, va_gc>* args     = make_tree_vector_single(this_ptr);

  tree call = build_new_method_call(this_ptr,  // object
                                    fn_decl,   // function
                                    &args,     // arguments
                                    NULL_TREE, // conversion function
                                    LOOKUP_NORMAL,
                                    NULL,      // function decl
                                    tf_warning_or_error);

  // build gimple call
  gimple* call_stmt = gimple_build_call(call, 0);
  // insert call before current statement
  gimple_stmt_iterator gsi = gsi_for_stmt(curr_stmt);
  gsi_insert_before(&gsi, call_stmt, GSI_SAME_STMT);
}

The issue is that this code produces an error like the below:

[build] > Inspecting function '__ct_base '
[build]      Found invariant attribute: invariant
[build]      adding function call before *this_3(D) ={v} {CLOBBER};
[build] /home/user/projects/gcc-invariant-plugin/test/test.cpp: In constructor 'Heap::Heap(int)':
[build] /home/user/projects/gcc-invariant-plugin/test/test.cpp:66:1: error: call to non-function 'void Heap::invariant()'

NOTE: I based this code off of examples in the GCC gcc/cp/coroutines.cc code generator I found:

tree ash_m = lookup_member (coro_frame_type, coro_self_handle_id, 1,
                0, tf_warning_or_error);
tree ash = build_class_member_access_expr (actor_frame, ash_m, NULL_TREE,
                       false, tf_warning_or_error);
/* So construct the self-handle from the frame address.  */
tree hfa_m = lookup_member (handle_type, coro_from_address_identifier, 1,
                0, tf_warning_or_error);
r = build1 (CONVERT_EXPR, build_pointer_type (void_type_node), actor_fp);
vec<tree, va_gc> *args = make_tree_vector_single (r);
tree hfa = build_new_method_call (ash, hfa_m, &args, NULL_TREE, LOOKUP_NORMAL,
                  NULL, tf_warning_or_error)


问:
SvelteKit how to handle authenticated WebSocket connections
I have a Django backend that accepts WebSocket connections under a given url. The url takes a JWT token as parameter to authenticate users trying to use a certain websocket.

I'm trying to connect to a WebSocket from my SvelteKit frontend. The problem I'm having is that I can only access the Http-Only cookies containing my access & refresh key from within my +page.server.ts endpoint files. How would I go about authenticating the connection while also establishing a connection from the client side to access messages being sent via the WebSocket?

Currently I've been following this tutorial using a custom vite plugin as well as socket.io but it doesn't seem to be trying to achieve what I'm trying to work towards.

Any help, code samples and ideas on how to handle this problem would be very appreciated!


问:
HTTPS Gateway API Proxying Requests over HTTP
I have a question regarding network traffic.

I have an express node API acting as an HTTPS Gateway API (listening on port 443) that proxies requests to various express microservices on the same computer listening on various other ports.

The microservices are all http, and only the HTTPS gateway API can communicate to them via the proxied requests.

Is the traffic from the gateway API to the microservices still encrypted because the initial request had to pass through the HTTPS gateway before being proxied to the microservice?

I'm just curious what's going on under the hood there and whether or not this is bad practice.
Again, due to various firewall protections, none of the http microservices are accessible unless the first pass through the HTTPS gateway.

Here is a very basic illustration of the flow as I understand it:

If this is bad practice, I'd like to know what I can do to better secure these proxy communications. I've tried making the microservices HTTPS by having them apply the same cert the gateway API is using, but then I run into certificate chain issues.

Thanks for any help!


问:
Performance issues when raycasting/boxcasting in Ursina
In my game I need to cast rays to see which blocks are in the FirstPersonPlayer's field of view. Here is my code before implementing:

```<code>
    from ursina import \*
    from ursina.prefabs.first_person_controller import FirstPersonController

    app = Ursina()

    from load_assets import \*
    import menu

    block_pick = 1
    block = 'grass'
    equipped = 0
    dev_menu = False

    def update():
    global block_pick
    global block
    global equipped
    global hit
    hit = \[\]

    #cast rays from here.

    if held_keys['1']: block_pick = 1
    if held_keys['2']: block_pick = 2
    if held_keys['3']: block_pick = 3
    if held_keys['4']: block_pick = 4
    if held_keys['5']: block_pick = 5
    if held_keys['6']: block_pick = 6

    if block_pick == 1:
        block = 'grass'
    if block_pick == 2:
        block = 'dirt'
    if block_pick == 3:
        block = 'stone'
    if block_pick == 4:
        block = 'bricks'
    if block_pick == 5:
        block = 'stone bricks'
    if block_pick == 6:
        block = 'snow'

    if held_keys['left mouse'] or held_keys['right mouse']:
        hand.active()
    else:
        hand.passive()

    if held_keys['f3']:
        if not dev_menu:
            dev_menu = True
        else:
            dev_menu = False

    destroy(equipped)
    equipped = Equipped()

class Voxel(Button):
def __init__(self, position = (0,0,0), texture = grass_texture):
super().__init__(
parent = scene,
position = position,
model = block_model,
origin_y = 0.5,
texture = texture,
color = color.color(0,0,random.uniform(0.9,1)),
highlight_color = color.light_gray,
scale = 0.5,
collider = 'box'
)

    def input(self,key):
        if self.hovered:
            if key == 'right mouse down':
                punch_sound.play()
                if block_pick == 1:
                    voxel = Voxel(position = self.position + mouse.normal, texture = grass_texture)
                if block_pick == 2:
                    voxel = Voxel(position = self.position + mouse.normal, texture = dirt_texture)
                if block_pick == 3:
                    voxel = Voxel(position = self.position + mouse.normal, texture = stone_texture)
                if block_pick == 4:
                    voxel = Voxel(position = self.position + mouse.normal, texture = brick_texture)
                if block_pick == 5:
                    voxel = Voxel(position = self.position + mouse.normal, texture = stone_bricks_texture)
                if block_pick == 6:
                    voxel = Voxel(position = self.position + mouse.normal, texture = snow_texture)
            if key == 'left mouse down':
                punch_sound.play()
                destroy(self)

for z in range(16):
for x in range(16):
voxel = Voxel(position = (x,0,z))
for z in range(16):
for x in range(16):
voxel = Voxel(position = (x,-1,z),texture = stone_texture)

global player
player = FirstPersonController()
sky = Sky()
hand = Hand()
equipped = Equipped()

app.run()
</code>```

I decided to add a raycast within the update loop, like this:
hit.extend(raycast(player.world_position, direction=player.forward, distance=math.inf).entities)

I also added an update function in the Voxel class:

```<code>
def update(self):
if self in hit:
 self.color = color.red
else:
 self.color = color.white
</code>```

I needed all the blocks in the player's view red, not just a single line of blocks like this:
A single line of blocks are red!
I tried using a boxcast(), like this:
hit.extend(boxcast(player.world_position, direction=player.forward, distance=math.inf, thickness = (4,4)).entities)
It resulted in an Assertion error, which is apparently caused by the computer's lack of computing power. Using a for loop to create multiple rays instead of just one ray resulted in a significant drop of performance.

```<code>
for z in range(0,6):
print(player.forward/5)
hit.extend(raycast(player.world_position, direction=player.forward+(0,0,z/5), distance=math.inf).entities)
</code>```

Check the top-right corner
7 FPS average.
Anybody know how I can find all the blocks in the field of view of the player without an incredible drop of performance?
Sorry about the indenting issues :/

Body:
In my game I need to cast rays to see which blocks are in the FirstPersonPlayer's field of view. Here is my code before implementing:

    from ursina import \*
    from ursina.prefabs.first_person_controller import FirstPersonController

    app = Ursina()

    from load_assets import \*
    import menu

    block_pick = 1
    block = 'grass'
    equipped = 0
    dev_menu = False

    def update():
    global block_pick
    global block
    global equipped
    global hit
    hit = \[\]

    #cast rays from here.

    if held_keys['1']: block_pick = 1
    if held_keys['2']: block_pick = 2
    if held_keys['3']: block_pick = 3
    if held_keys['4']: block_pick = 4
    if held_keys['5']: block_pick = 5
    if held_keys['6']: block_pick = 6

    if block_pick == 1:
        block = 'grass'
    if block_pick == 2:
        block = 'dirt'
    if block_pick == 3:
        block = 'stone'
    if block_pick == 4:
        block = 'bricks'
    if block_pick == 5:
        block = 'stone bricks'
    if block_pick == 6:
        block = 'snow'

    if held_keys['left mouse'] or held_keys['right mouse']:
        hand.active()
    else:
        hand.passive()

    if held_keys['f3']:
        if not dev_menu:
            dev_menu = True
        else:
            dev_menu = False

    destroy(equipped)
    equipped = Equipped()

class Voxel(Button):
def __init__(self, position = (0,0,0), texture = grass_texture):
super().__init__(
parent = scene,
position = position,
model = block_model,
origin_y = 0.5,
texture = texture,
color = color.color(0,0,random.uniform(0.9,1)),
highlight_color = color.light_gray,
scale = 0.5,
collider = 'box'
)

    def input(self,key):
        if self.hovered:
            if key == 'right mouse down':
                punch_sound.play()
                if block_pick == 1:
                    voxel = Voxel(position = self.position + mouse.normal, texture = grass_texture)
                if block_pick == 2:
                    voxel = Voxel(position = self.position + mouse.normal, texture = dirt_texture)
                if block_pick == 3:
                    voxel = Voxel(position = self.position + mouse.normal, texture = stone_texture)
                if block_pick == 4:
                    voxel = Voxel(position = self.position + mouse.normal, texture = brick_texture)
                if block_pick == 5:
                    voxel = Voxel(position = self.position + mouse.normal, texture = stone_bricks_texture)
                if block_pick == 6:
                    voxel = Voxel(position = self.position + mouse.normal, texture = snow_texture)
            if key == 'left mouse down':
                punch_sound.play()
                destroy(self)

for z in range(16):
for x in range(16):
voxel = Voxel(position = (x,0,z))
for z in range(16):
for x in range(16):
voxel = Voxel(position = (x,-1,z),texture = stone_texture)

global player
player = FirstPersonController()
sky = Sky()
hand = Hand()
equipped = Equipped()

app.run()

I decided to add a raycast within the update loop, like this:
hit.extend(raycast(player.world_position, direction=player.forward, distance=math.inf).entities)

I also added an update function in the Voxel class:

def update(self):
if self in hit:
 self.color = color.red
else:
 self.color = color.white

I needed all the blocks in the player's view red, not just a single line of blocks like this:
A single line of blocks are red!
I tried using a boxcast(), like this:
hit.extend(boxcast(player.world_position, direction=player.forward, distance=math.inf, thickness = (4,4)).entities)
It resulted in an Assertion error, which is apparently caused by the computer's lack of computing power. Using a for loop to create multiple rays instead of just one ray resulted in a significant drop of performance.

for z in range(0,6):
print(player.forward/5)
hit.extend(raycast(player.world_position, direction=player.forward+(0,0,z/5), distance=math.inf).entities)

Check the top-right corner
7 FPS average.
Anybody know how I can find all the blocks in the field of view of the player without an incredible drop of performance?
Sorry about the indenting issues :/


问:
How to perform shapiro_test, levene_test, anova_test and cohens_d in a time course experiment with two grupoing variables?
I am performing the analysis of a time course experiment with two factors and a response variable.

My data frame has this schematic structure:

```<code>           Individuals|    Time     | Sex |  Gen   |    Response

        1,2,3,4...44  | 0,5,10...55 | M-F | WT-Mut | Numeric variable to analyze
</code>```

Each of the 44 individuals is measured at each time point and is clasified according to Sex and Gen, which are dichotomous variables.

I want to analyze if there are statistically significant differences due to Sex and Gen at each time point. I am using the functions shapiro_test, levene_test, anova_test, pairwise_t_test and cohens_d from rstatix package.

I think that my problem is in how these functions interpret the variable "Time", because I have another tests with the same structure (but without time) and it works fine.

I have tried many different things, and with all of them I obtain an error. Here you have my last and simple trial:

```<code>WORK %>% group_by(Time, Sex, Gen) %>% shapiro_test(Response)
WORK %>% levene_test(Response ~ Time*Sex*Gen, center = 'mean')
WORK %>% anova_test(Response ~ Time*Sex*Gen)
WORK %>% group_by(Time,Sex) %>% pairwise_t_test(Response~Gen, p.adjust.method = "holm") #Actually this is is the only one that works
WORK %>% group_by(Time, Sex) %>% cohens_d(Response~Gen, hedges.correction = TRUE)
</code>```

Please, can anyone provide any idea on how to solve it in an easy way?

Thanks in advance!

Body:
I am performing the analysis of a time course experiment with two factors and a response variable.

My data frame has this schematic structure:

           Individuals|    Time     | Sex |  Gen   |    Response

        1,2,3,4...44  | 0,5,10...55 | M-F | WT-Mut | Numeric variable to analyze

Each of the 44 individuals is measured at each time point and is clasified according to Sex and Gen, which are dichotomous variables.

I want to analyze if there are statistically significant differences due to Sex and Gen at each time point. I am using the functions shapiro_test, levene_test, anova_test, pairwise_t_test and cohens_d from rstatix package.

I think that my problem is in how these functions interpret the variable "Time", because I have another tests with the same structure (but without time) and it works fine.

I have tried many different things, and with all of them I obtain an error. Here you have my last and simple trial:

WORK %>% group_by(Time, Sex, Gen) %>% shapiro_test(Response)
WORK %>% levene_test(Response ~ Time*Sex*Gen, center = 'mean')
WORK %>% anova_test(Response ~ Time*Sex*Gen)
WORK %>% group_by(Time,Sex) %>% pairwise_t_test(Response~Gen, p.adjust.method = "holm") #Actually this is is the only one that works
WORK %>% group_by(Time, Sex) %>% cohens_d(Response~Gen, hedges.correction = TRUE)

Please, can anyone provide any idea on how to solve it in an easy way?

Thanks in advance!


问:
How to setup C++ compiler in CLion IDE for macOS
I try to setup C++ compiler in CLion for macOS X.
But I've got stuck with the installation of configuration of compiler and debugger.
Every time when I try to execute code, I catch an error

```<code>file iostream is not found
Undeclared identifier std
</code>```

Who can help me to get started with CLion C++ compiler
Thanks in advance

Body:
I try to setup C++ compiler in CLion for macOS X.
But I've got stuck with the installation of configuration of compiler and debugger.
Every time when I try to execute code, I catch an error

file iostream is not found
Undeclared identifier std

Who can help me to get started with CLion C++ compiler
Thanks in advance


问:
Android Studio: Read timed out for "dl.google.com"
I currently cannot setup my Android Studio since it seems not to be able to download packages from google, particularly from "https://dl.google.com/...".

Details:

Updating the IDE, download SDKs, etc. does not work and ends in a "Read timed out" error

According to the idea.log file, it looks like this

```<code>2022-12-30 08:19:42,842 [ 132503]   INFO - er.configure.SourcesTableModel - Downloading https://dl.google.com/android/repository/addons_list-5.xml
2022-12-30 08:19:43,143 [ 132804]   INFO - s.RepoProgressIndicatorAdapter - Downloading https://dl.google.com/android/repository/addons_list-5.xml
2022-12-30 08:21:02,106 [ 211767]   INFO - er.configure.SourcesTableModel - IOException: https://dl.google.com/android/repository/addons_list-5.xml
2022-12-30 08:21:02,106 [ 211767]   INFO - er.configure.SourcesTableModel - java.net.SocketTimeoutException: Read timed out
2022-12-30 08:21:02,417 [ 212078]   INFO - s.RepoProgressIndicatorAdapter - IOException: https://dl.google.com/android/repository/addons_list-5.xml
2022-12-30 08:21:02,418 [ 212079]   INFO - s.RepoProgressIndicatorAdapter - java.net.SocketTimeoutException: Read timed out
</code>```

The file IS accessible from within my regular browser

I do not require any proxy, nor there is any proxy set up in my network setup

If I go to Setting > Appearance & Behavior > System Settings > HTTP Proxy and do "Check Connection"

it perfectly works for "https://www.google.com"

but it does NOT work for "https://dl.google.com"

Does anyone have an idea what that could be? Android Studio behaves as if it would deal differently with this domain AND/OR "dl.google.com" acts differently for the built-in HTTPS client in contrast to a regular browser.

I tried

Uninstalling/Reinstalling various versions of Android Studio (-> same issue)

I also made sure that there are no leftovers of any configuration between the different versions

I also removed anything that has to do with gradle

Accessing the domain from within different browsers (-> no issue at all)

Deactivated the Windows firewall (-> same issue)

Started Android Studio with administrator privileges

Body:
I currently cannot setup my Android Studio since it seems not to be able to download packages from google, particularly from "https://dl.google.com/...".

Details:

Updating the IDE, download SDKs, etc. does not work and ends in a "Read timed out" error

According to the idea.log file, it looks like this

2022-12-30 08:19:42,842 [ 132503]   INFO - er.configure.SourcesTableModel - Downloading https://dl.google.com/android/repository/addons_list-5.xml
2022-12-30 08:19:43,143 [ 132804]   INFO - s.RepoProgressIndicatorAdapter - Downloading https://dl.google.com/android/repository/addons_list-5.xml
2022-12-30 08:21:02,106 [ 211767]   INFO - er.configure.SourcesTableModel - IOException: https://dl.google.com/android/repository/addons_list-5.xml
2022-12-30 08:21:02,106 [ 211767]   INFO - er.configure.SourcesTableModel - java.net.SocketTimeoutException: Read timed out
2022-12-30 08:21:02,417 [ 212078]   INFO - s.RepoProgressIndicatorAdapter - IOException: https://dl.google.com/android/repository/addons_list-5.xml
2022-12-30 08:21:02,418 [ 212079]   INFO - s.RepoProgressIndicatorAdapter - java.net.SocketTimeoutException: Read timed out

The file IS accessible from within my regular browser

I do not require any proxy, nor there is any proxy set up in my network setup

If I go to Setting > Appearance & Behavior > System Settings > HTTP Proxy and do "Check Connection"

it perfectly works for "https://www.google.com"

but it does NOT work for "https://dl.google.com"

Does anyone have an idea what that could be? Android Studio behaves as if it would deal differently with this domain AND/OR "dl.google.com" acts differently for the built-in HTTPS client in contrast to a regular browser.

I tried

Uninstalling/Reinstalling various versions of Android Studio (-> same issue)

I also made sure that there are no leftovers of any configuration between the different versions

I also removed anything that has to do with gradle

Accessing the domain from within different browsers (-> no issue at all)

Deactivated the Windows firewall (-> same issue)

Started Android Studio with administrator privileges


问:
Laravel Eloquent: Where Clause on combined columns (or custom attribute)
I am trying to find a solution for this use case.

I have a users table with the fields first_name and last_name as well as a custom attribute called full_name.

```<code> public function getFullNameAttribute()
 {
    return ucfirst($this->name) . ' ' . ucfirst($this->last_name);
 }
</code>```

Now I am looking for a way to filter through first_name and last_name or full_name at the same time.
Example:

Searching for Sebastian Mendez should find users like the following examples:

first_name
last_name
found

Juan Sebastian
Mendez Tellez
true

Sebastian Mendez
Tellez
true

Juan
Sebastian Mendez
true

Sebastian
Tellez
false

Juan
Mendez
false

I can't get my head around it, I tried to split the search text into separate strings like this:

```<code>public function scopeSearch($query, $search){
 $str = "Sebastian Mendez";
 $str = explode(" ",$search);
 $query->whereIn('first_name', $str)->andWhereIn('last_name', $str);
}
</code>```

But then it returns as well the other results or none.
I guess the problem is the following:

I don't know which part of the string is part of the first or last name...

Body:
I am trying to find a solution for this use case.

I have a users table with the fields first_name and last_name as well as a custom attribute called full_name.

 public function getFullNameAttribute()
 {
    return ucfirst($this->name) . ' ' . ucfirst($this->last_name);
 }

Now I am looking for a way to filter through first_name and last_name or full_name at the same time.
Example:

Searching for Sebastian Mendez should find users like the following examples:

first_name
last_name
found

Juan Sebastian
Mendez Tellez
true

Sebastian Mendez
Tellez
true

Juan
Sebastian Mendez
true

Sebastian
Tellez
false

Juan
Mendez
false

I can't get my head around it, I tried to split the search text into separate strings like this:

public function scopeSearch($query, $search){
 $str = "Sebastian Mendez";
 $str = explode(" ",$search);
 $query->whereIn('first_name', $str)->andWhereIn('last_name', $str);
}

But then it returns as well the other results or none.
I guess the problem is the following:

I don't know which part of the string is part of the first or last name...


问:
svg SMIL animation transform origin question
I cannot figure out where to put the transform origin and with what values at the second path (#tran) to resemble the first path (#drop). I want them both to move the same way. The path #tran is the one that I need to behave like the smooth d-animated #drop. Here is the code:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
  <defs>
<path id="drop">
  <animate attributeName="d" begin="0s" dur="3s" values="M 50 0 Q 48 4 50 4 Q 52 4 50 0 Z; M 50 10 Q 48 6 50 6 Q 52 6 50 10 Z; M 50 0 Q 48 4 50 4 Q 52 4 50 0 Z;" repeatCount="indefinite"/>
</path>
<path id="tran" d="M 50 0 Q 48 4 50 4 Q 52 4 50 0 Z"  transform="translate(4,0)"/>
  </defs>
  <use href="#drop"/>
  <use href="#tran" >
<animateTransform
  attributeName="transform"
  attributeType="XML"
  type="scale"
  values="1 1;1 -1; 1 1"
  dur="3s"
  repeatCount="indefinite" />
<animateTransform
  attributeName="transform"
  attributeType="XML"
  type="translate"
  values="0 0; 0 -10; 0 0"
  dur="3s"
  repeatCount="indefinite" additive="sum"/>
  </use>
</svg>```

I tried putting origin-transform all over the place, including css madness - but i prefer non-css - seems transform-origin does not work inside the animate tags. Okay, in a few days I might figure out the values with keysplines or something but I want a neat solution with few calculations. I'm trying to build a whole animation with a mandala being built rotated and mirrored so I need clean logic with as little math as possible -no javascript-.

Body:
I cannot figure out where to put the transform origin and with what values at the second path (#tran) to resemble the first path (#drop). I want them both to move the same way. The path #tran is the one that I need to behave like the smooth d-animated #drop. Here is the code:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
  <defs>
<path id="drop">
  <animate attributeName="d" begin="0s" dur="3s" values="M 50 0 Q 48 4 50 4 Q 52 4 50 0 Z; M 50 10 Q 48 6 50 6 Q 52 6 50 10 Z; M 50 0 Q 48 4 50 4 Q 52 4 50 0 Z;" repeatCount="indefinite"/>
</path>
<path id="tran" d="M 50 0 Q 48 4 50 4 Q 52 4 50 0 Z"  transform="translate(4,0)"/>
  </defs>
  <use href="#drop"/>
  <use href="#tran" >
<animateTransform
  attributeName="transform"
  attributeType="XML"
  type="scale"
  values="1 1;1 -1; 1 1"
  dur="3s"
  repeatCount="indefinite" />
<animateTransform
  attributeName="transform"
  attributeType="XML"
  type="translate"
  values="0 0; 0 -10; 0 0"
  dur="3s"
  repeatCount="indefinite" additive="sum"/>
  </use>
</svg>

I tried putting origin-transform all over the place, including css madness - but i prefer non-css - seems transform-origin does not work inside the animate tags. Okay, in a few days I might figure out the values with keysplines or something but I want a neat solution with few calculations. I'm trying to build a whole animation with a mandala being built rotated and mirrored so I need clean logic with as little math as possible -no javascript-.


问:
npm workspaces - skip `src` folder when importing source files from symlinked shared package
I have a typescript monorepo setup that uses npm workspaces and I want to be able to import subpaths down to any individual typescript file of  @package/shared in @package/client and @package/server while skipping the src folder. One solution is simply removing the src folder and moving every subfolder up the hierarchy but that feels like a hacky solution. I tried using wildcards in the exports (e.g. "./*": "./src/*", "./": "./src/*.ts") but either they're not working or they only work partially (moduleResolution is set to "NodeNext")

For example, with the following folder structure of the monorepo

```<code>.
├── package.json
└── packages/
    ├── shared/
    │   ├── package.json
    │   └── src/
    │       ├── index.ts
    │       ├── types/
    │       │   ├── index.ts
    │       │   ├── foo-type.ts
    │       │   └── bar-type.ts
    │       └── constants/
    │           ├── index.ts
    │           ├── foo-const.ts
    │           └── bar-const.ts
    ├── client/
    │   └── ...
    └── server/
        └── ...
</code>```

I want to be able to import any typescript file in the shared package while skipping src

```<code>import { ... } from "@package/shared"
import { ... } from "@package/shared/types"
import { ... } from "@package/shared/types/foo-type"
import { ... } from "@package/shared/types/bar-type"
import { ... } from "@package/shared"
import { ... } from "@package/shared/constants"
import { ... } from "@package/shared/constants/foo-const"
import { ... } from "@package/shared/constants/bar-const"

// shouldn't work!
import { ... } from "@package/src/shared/..."
</code>```

Body:
I have a typescript monorepo setup that uses npm workspaces and I want to be able to import subpaths down to any individual typescript file of  @package/shared in @package/client and @package/server while skipping the src folder. One solution is simply removing the src folder and moving every subfolder up the hierarchy but that feels like a hacky solution. I tried using wildcards in the exports (e.g. "./*": "./src/*", "./": "./src/*.ts") but either they're not working or they only work partially (moduleResolution is set to "NodeNext")

For example, with the following folder structure of the monorepo

.
├── package.json
└── packages/
    ├── shared/
    │   ├── package.json
    │   └── src/
    │       ├── index.ts
    │       ├── types/
    │       │   ├── index.ts
    │       │   ├── foo-type.ts
    │       │   └── bar-type.ts
    │       └── constants/
    │           ├── index.ts
    │           ├── foo-const.ts
    │           └── bar-const.ts
    ├── client/
    │   └── ...
    └── server/
        └── ...

I want to be able to import any typescript file in the shared package while skipping src

import { ... } from "@package/shared"
import { ... } from "@package/shared/types"
import { ... } from "@package/shared/types/foo-type"
import { ... } from "@package/shared/types/bar-type"
import { ... } from "@package/shared"
import { ... } from "@package/shared/constants"
import { ... } from "@package/shared/constants/foo-const"
import { ... } from "@package/shared/constants/bar-const"

// shouldn't work!
import { ... } from "@package/src/shared/..."