问:
python failed to serialize object by calling pickle.dump
I know that pickle.dump() does not work for paddle.Tensor objects. However, I did the following but pickle.dump still failed:

Define a Python class, A, containing an instance member, x, with type paddle.Tensor

Define a bound method for class A named func

Define a Python class, B, its construct method accepts an typing.Callable argument, and will set this callable object as its member self.func

pickle.dump an instance of class B, which I expected would succeed but actually failed

import paddle
import typing

class A(object):
    def __init__(self):
        self.x = paddle.to_tensor([1, 2, 3])

    def func(self):
        # this bound method will be passed to class B construct method as an argument.
        pass

class B(object):
    def __init__(self, f: typing.Callable):
        self.func = f

# main
def main():
    a = A()
    b = B(f=a.func)

    # try pickle.dump(b) but failed.
    with open("./dumpfile", "wb") as f:
        # TypeError: can't pickle tensor object.
        pickle.dump(b, f)
```

Can anyone let me know how to dump object b successfully?

Given 2 classes A and B, and 2 instance a = A() and `b = B(.

I expect I can pass the a.func bound method to the b.__init__ construct method as an argument, in the meantime, even if the a object has an member a.x which is type of paddle.Tensor, but still I can pickle.dump(b) successfully.

Body:
I know that pickle.dump() does not work for paddle.Tensor objects. However, I did the following but pickle.dump still failed:

Define a Python class, A, containing an instance member, x, with type paddle.Tensor

Define a bound method for class A named func

Define a Python class, B, its construct method accepts an typing.Callable argument, and will set this callable object as its member self.func

pickle.dump an instance of class B, which I expected would succeed but actually failed

import paddle
import typing

class A(object):
    def __init__(self):
        self.x = paddle.to_tensor([1, 2, 3])

    def func(self):
        # this bound method will be passed to class B construct method as an argument.
        pass

class B(object):
    def __init__(self, f: typing.Callable):
        self.func = f

# main
def main():
    a = A()
    b = B(f=a.func)

    # try pickle.dump(b) but failed.
    with open("./dumpfile", "wb") as f:
        # TypeError: can't pickle tensor object.
        pickle.dump(b, f)

Can anyone let me know how to dump object b successfully?

Given 2 classes A and B, and 2 instance a = A() and `b = B(.

I expect I can pass the a.func bound method to the b.__init__ construct method as an argument, in the meantime, even if the a object has an member a.x which is type of paddle.Tensor, but still I can pickle.dump(b) successfully.


来源: stackexchange

问:
Blazor wasm detect if the current page has a visible vertical scrollbar and subscribe to the scroll event
I'm very new to Blazor programming, and I'm trying to perform "little things"... :)

I was looking for How do i subscribe to onscroll event in Blazor? in order to detect if the current window/document (not a particular DIV) is provided with a vertical scrollbar and eventually subscribe to it's scroll...

the provided post indicates a DIV solution, but what about "the whole document"?
TIA

Andrea

ContentLicense: CC BY-SA 4.0


问:
How to get element as space in list of tags using xpath, if the element is not present
I have a use case where my XML is like this

<IR>
        <name>abc</name>
        <Level></Level>

</IR>
<IR>
        <name>xyz</name>
        <Level>LVL00006</Level>
</IR>
```
<p>I am using below code to extract information of level.</p>
<pre class="lang-java prettyprint-override"><code>public class TestUseCases {
 public static void main(String[] args) {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    try {
        factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
    } catch (ParserConfigurationException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    Document document;
    try {
        document = factory.newDocumentBuilder()
                .parse(new InputSource(new StringReader(xml)));

    String xpathExpression = "";
    Map<String, List<String>> iRValues = new LinkedHashMap<String, List<String>>();
    xpathExpression = "(/IR/Level/text())";

        iRValues.put("REQLVL", evaluateXPath(document, xpathExpression));

        System.out.println(iRValues);
    } catch (SupportException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (SAXException | IOException | ParserConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
  }

  private static List<String> evaluateXPath(Document document, String xpathExpression) throws SupportException {
    // Create XPathFactory object
    XPathFactory xpathFactory = XPathFactory.newInstance();

    // Create XPath object
    XPath xpath = xpathFactory.newXPath();

    List<String> values = new ArrayList<>();
    try {
        // Create XPathExpression object
        XPathExpression expr = xpath.compile(xpathExpression);
        // Evaluate expression result on XML document
        NodeList nodes = (NodeList) expr.evaluate(document, XPathConstants.NODESET);
        System.out.println(nodes.getLength());
        for (int i = 0; i < nodes.getLength(); i++) {
            String item = nodes.item(i).getNodeValue();
            System.out.println(item);
            if (item.trim().isEmpty()) {
                values.add(SupportConstants.EMPTY_SPACE);
            } else {
                values.add(nodes.item(i).getNodeValue());
            }
        }

    } catch (XPathExpressionException e) {
        throw new SupportException(SupportExceptionMessage.ERROR_IN_READING_RESPONSE_FROM_CM);
    }
    return values;
  }
}
</code>```

OUTPUT:

1
LVL00006
{REQLVL=[LVL00006]}
```

The problem is because first level tag is empty, I get a list which has only one element and I am not able to know whether the element is of abc or xyz. Is there a way so that I can put space if the tag is empty?

I am expecting list as [" ", LVL00006].

Body:
I have a use case where my XML is like this

<IR>
        <name>abc</name>
        <Level></Level>

</IR>
<IR>
        <name>xyz</name>
        <Level>LVL00006</Level>
</IR>

I am using below code to extract information of level.

public class TestUseCases {
 public static void main(String[] args) {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    try {
        factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
    } catch (ParserConfigurationException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    Document document;
    try {
        document = factory.newDocumentBuilder()
                .parse(new InputSource(new StringReader(xml)));

    String xpathExpression = "";
    Map<String, List<String>> iRValues = new LinkedHashMap<String, List<String>>();
    xpathExpression = "(/IR/Level/text())";

        iRValues.put("REQLVL", evaluateXPath(document, xpathExpression));

        System.out.println(iRValues);
    } catch (SupportException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (SAXException | IOException | ParserConfigurationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
  }

  private static List<String> evaluateXPath(Document document, String xpathExpression) throws SupportException {
    // Create XPathFactory object
    XPathFactory xpathFactory = XPathFactory.newInstance();

    // Create XPath object
    XPath xpath = xpathFactory.newXPath();

    List<String> values = new ArrayList<>();
    try {
        // Create XPathExpression object
        XPathExpression expr = xpath.compile(xpathExpression);
        // Evaluate expression result on XML document
        NodeList nodes = (NodeList) expr.evaluate(document, XPathConstants.NODESET);
        System.out.println(nodes.getLength());
        for (int i = 0; i < nodes.getLength(); i++) {
            String item = nodes.item(i).getNodeValue();
            System.out.println(item);
            if (item.trim().isEmpty()) {
                values.add(SupportConstants.EMPTY_SPACE);
            } else {
                values.add(nodes.item(i).getNodeValue());
            }
        }

    } catch (XPathExpressionException e) {
        throw new SupportException(SupportExceptionMessage.ERROR_IN_READING_RESPONSE_FROM_CM);
    }
    return values;
  }
}

OUTPUT:

1
LVL00006
{REQLVL=[LVL00006]}

The problem is because first level tag is empty, I get a list which has only one element and I am not able to know whether the element is of abc or xyz. Is there a way so that I can put space if the tag is empty?

I am expecting list as [" ", LVL00006].


问:
How can I use Logger (Log4Net or etc.) C#
I am new in C# and I created a simple console app and I want to use logger to logs errors.

I searched in Google how this can be done, but I couldn't find anything useful or at least I can understand it.

Can some one explain me how this logger works?

Thanks in advance.

search in Google and YouTube


问:
syntax highlighting in nvim help files
Any reason why :h lsp doesn't show any syntax highlight, where as h: mason does provide some syntax highlight of embedded LUA code? Within a same session, opened help files in 2 different tabs (you can see in the images below). Below are images for references,

I'm expecting all help files containing embedded code should get syntax highlight.

Title: syntax highlighting in nvim help files


问:
When can st_ino change for a direcory?
I am trying to work with StructStat class in Android. As per android documentation at here

st_ino represents File Serial Number of object

st_blocks represents number of blocks allocated to this object

My query is

Can st_ino which is a number, change for any directory/file, in any situation? or Would it be constant once memory is mounted.

What does st_blocks returns, size of object means what value it has?

Thank you in advance

Title: When can st_ino change for a direcory?


问:
While loop is going to second function without exciting first function
when I use this while loop function its going to the second function without executing the first function please help me out...</p>
```<code>io.on('connection', (socket)=>{
  console.log("Connection With Socket Id "+ socket.id);

  socket.on('runTest', async data => {
    testCaseList = data;
    var i = 0;
    while(i<testCaseList.length && stopTestFlag == false){
      var id = testCaseList[i];
      var test  = await serverFunction.retrieveTestCaseData(id)
      if(test.config.configType === 'Http'){
        httpConfig(test);
        console.log("Test is HTTP Type");
      }

      else if(test.config.configType === 'Udp'){
        udpConfig(test)
        console.log("Test is UDP Type");
      }
      i++;
    }
      socket.emit('runTest', 'Data Received From TestCase');
      socket.emit('status', 'Status Received From Complete TestCase');
      socket.emit('pass', testCasePass);
      socket.emit('failed', testCaseFail);
  });
});
</code>```

Body:
when I use this while loop function its going to the second function without executing the first function please help me out...

io.on('connection', (socket)=>{
  console.log("Connection With Socket Id "+ socket.id);

  socket.on('runTest', async data => {
    testCaseList = data;
    var i = 0;
    while(i<testCaseList.length && stopTestFlag == false){
      var id = testCaseList[i];
      var test  = await serverFunction.retrieveTestCaseData(id)
      if(test.config.configType === 'Http'){
        httpConfig(test);
        console.log("Test is HTTP Type");
      }

      else if(test.config.configType === 'Udp'){
        udpConfig(test)
        console.log("Test is UDP Type");
      }
      i++;
    }
      socket.emit('runTest', 'Data Received From TestCase');
      socket.emit('status', 'Status Received From Complete TestCase');
      socket.emit('pass', testCasePass);
      socket.emit('failed', testCaseFail);
  });
});


问:
Updating fields based on results of a query
So in this scenario a person can order products. I have a query that returns the result of an order ID and give the products that person ordered.
My issue is adapting this to an update query so the quantity from the OrderProduct table/query is then subtracted from the amount of stock in the Product Table.

SQL to create the table supplied below and the query to get the results

```<code>CREATE DATABASE StockControl;

CREATE TABLE Membership (
    MemberID int NOT Null,
    LastName varchar(255),
    FirstName varchar(255),
    Primary Key(MemberID)
);

CREATE TABLE Orders (
    OrderID int NOT Null,
    MemberID int,
    Primary Key(OrderID)
);

CREATE TABLE Product (
    ProductID int NOT Null,
    Price int,
    Stock int,
    Primary Key(ProductID)
);

CREATE TABLE OrderProduct (
    ProductID int,
    OrderID int,
    Quantity int
);

INSERT INTO Membership(MemberID,LastName,FirstName)
VALUES (2,'Me','Too'),(33,'Darren','Kelly');

INSERT INTO Orders(OrderID,MemberID)
VALUES (1,33),(5,2);

INSERT INTO Product(ProductID,Price,Stock)
VALUES (1,30,12),(2,25,12),(3,25,12),(4,25,12),(5,25,12),(6,25,12),(7,25,12),(8,25,12),(9,25,12),(10,25,12);

INSERT INTO OrderProduct(ProductID,OrderID,Quantity)
VALUES (1,5,1),(3,1,4),(9,1,6),(10,1,2);
</code>```

This is the query to return all products as part of orderID 1, in the full version this will be able to be variable.

```<code>SELECT OrderProduct.ProductID, OrderProduct.OrderID, OrderProduct.Quantity, Product.Price, [Quantity]*[Price] AS Cost
FROM Product INNER JOIN OrderProduct ON Product.ProductID = OrderProduct.ProductID
GROUP BY OrderProduct.ProductID, OrderProduct.OrderID, OrderProduct.Quantity, Product.Price, [Quantity]*[Price]
HAVING (((OrderProduct.OrderID)=1))
ORDER BY OrderProduct.OrderID;

</code>```

This returns the correct result but when trying to implement this to an update I get stuck. I want it so it looks through the 3 results and will subtract 4 from product 3, 6 from product 9 and 2 from product 10

Attempt so far

```<code>UPDATE SingleOrder INNER JOIN Product ON SingleOrder.ProductID = Product.ProductID SET Product.Stock = Product.Stock-SingleOrder.Quantity WHERE ((Product.ProductID=SingleOrder.ProductID));
</code>```

If this is not clear I am happy to update the question etc.

Thanks

Body:
So in this scenario a person can order products. I have a query that returns the result of an order ID and give the products that person ordered.
My issue is adapting this to an update query so the quantity from the OrderProduct table/query is then subtracted from the amount of stock in the Product Table.

SQL to create the table supplied below and the query to get the results

CREATE DATABASE StockControl;

CREATE TABLE Membership (
    MemberID int NOT Null,
    LastName varchar(255),
    FirstName varchar(255),
    Primary Key(MemberID)
);

CREATE TABLE Orders (
    OrderID int NOT Null,
    MemberID int,
    Primary Key(OrderID)
);

CREATE TABLE Product (
    ProductID int NOT Null,
    Price int,
    Stock int,
    Primary Key(ProductID)
);

CREATE TABLE OrderProduct (
    ProductID int,
    OrderID int,
    Quantity int
);

INSERT INTO Membership(MemberID,LastName,FirstName)
VALUES (2,'Me','Too'),(33,'Darren','Kelly');

INSERT INTO Orders(OrderID,MemberID)
VALUES (1,33),(5,2);

INSERT INTO Product(ProductID,Price,Stock)
VALUES (1,30,12),(2,25,12),(3,25,12),(4,25,12),(5,25,12),(6,25,12),(7,25,12),(8,25,12),(9,25,12),(10,25,12);

INSERT INTO OrderProduct(ProductID,OrderID,Quantity)
VALUES (1,5,1),(3,1,4),(9,1,6),(10,1,2);

This is the query to return all products as part of orderID 1, in the full version this will be able to be variable.

SELECT OrderProduct.ProductID, OrderProduct.OrderID, OrderProduct.Quantity, Product.Price, [Quantity]*[Price] AS Cost
FROM Product INNER JOIN OrderProduct ON Product.ProductID = OrderProduct.ProductID
GROUP BY OrderProduct.ProductID, OrderProduct.OrderID, OrderProduct.Quantity, Product.Price, [Quantity]*[Price]
HAVING (((OrderProduct.OrderID)=1))
ORDER BY OrderProduct.OrderID;

This returns the correct result but when trying to implement this to an update I get stuck. I want it so it looks through the 3 results and will subtract 4 from product 3, 6 from product 9 and 2 from product 10

Attempt so far

UPDATE SingleOrder INNER JOIN Product ON SingleOrder.ProductID = Product.ProductID SET Product.Stock = Product.Stock-SingleOrder.Quantity WHERE ((Product.ProductID=SingleOrder.ProductID));

If this is not clear I am happy to update the question etc.

Thanks


问:
How to move tables to another postgres schema using liquibase without running queries inside schema again?
I have db-service with all the changelog files. When running db-service for the first time all the tables will be created in the public schema. Then tables will be filled with initial data.

 db-service

 db-service

Now we have decided to split db-service and distribute changelog files between services. So in the microservice I have created the same structure of folders.

I moved changelog files to info-service. And now I need to move tables into a separate schema, but I can't do it until tables aren't filled with init data. So I've created new folder and added additional path in root.changelog.

 info-service

 info-service

My changesets look like:

 230105-initial-changelog.xml

I run this changeset with URL spring.datasource.url=jdbc:postgresql://localhost:5432/postgres and everything works fine, tables are moved to another schema.

But then I modify data source URL to start working in my info-microservice with specific schema:
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres?currentSchema=info_schema

And when I run my service for the second time with currentSchema URL parameter I get ERROR: relation "atm" already exists and ERROR: relation "contacts" already exists. So liquibase wants to start doing all the changes from the beginning in the info-schema. It tries to create, init and alter tables again.

How to let Liquibase know that it shouldn't create tables in my schema? Note that i can't change old changelogfiles from the structure folder


问:
setViewControllers vs removeFromParentViewController
We are building a journey where we need a View Controller to remove the Controller that came before it in the stack.

When we land on that View Controller it will be the 3rd controller in the stack and we need it to remove the Controller that is second (i.e. the Controller that is at index 1).

In ViewDidLoad we tried doing this by getting the current array of View Controllers from the Navigation Controller, removing the Controller at index 1 and then calling SetViewControllers. However when the back button is pressed we end up going back to the View Controller that was supposed to be removed.

If instead we call removeFromParentViewController on the View Controller to be removed then we get the behaviour we expected.

What are the differences between these two approaches? What would cause a View Controller to remain in the stack despite it not being in the array passed to SetViewControllers?


问:
How to start triton server after building the tritonserver Image for custom windows server 2019?
Building the windows-based triton server image.

Building the Dockerfile.win10.min for triton server version 22.11 was not working as base image required for building the server image was not available for downloading.

To build the image downgraded the triton server version to 22.10. Also needed to download the appropriate CUDNN and TENSORT version for building the image.

Successfully built the base image using below command for 22.10 server version.

```<code>docker build -t win10-py3-min -f Dockerfile.win10.min .
</code>```

Once base image is built. To build the triton server image used below command with appropriate container tag and required backend.

```<code>python build.py --cmake-dir=<path/to/repo>/build --build-dir=/tmp/citritonbuild --no-container-pull --image=base,win10-py3-min --enable-logging --enable-stats --enable-tracing --enable-gpu --endpoint=grpc --endpoint=http --repo-tag=common:<container tag> --repo-tag=core:<container tag> --repo-tag=backend:<container tag> --repo-tag=thirdparty:<container tag> --backend=ensemble --backend=tensorrt:<container tag> --backend=onnxruntime:<container tag> --backend=openvino:<container tag>
</code>```

Tried different arguments with build.py command to build the triton server image was unsuccessful. As there were certain issues related to CMAKE, Rapid Json.

Certain issues on github suggested to try with the latest stable release which is 22.12. For building the base image it required the same os as per 22.11. So, to build the base image used the Dockerfile.win10.min file from 22.10 version which worked earlier.

After passing different arguments to build.py file was able to build the tritonserver image. However, initially built images did not have the tritonserver.exe which is required for starting the server. In the end was able to build the tritonserver which had the required tritonserver.exe.

built the image using below command.

```<code>python build.py -v --no-container-pull --image=base,win10-py3-min --enable-logging --enable-stats --enable-tracing --enable-gpu --endpoint=grpc --endpoint=http --repo-tag=common:r22.12 --repo-tag=core:r22.12 --repo-tag=backend:r22.12 --repo-tag=thirdparty:r22.12 --backend=ensemble
</code>```

To start the triton server, need to mount the local model repository to the docker image. Command to start the server is as below.

```<code>docker run -it -v C:/Users/Desktop/model_repository:C:/opt/tritonserver/models tritonserver:latest bin/tritonserver.exe --model-repository=C/opt/tritonserver/models
</code>```

While starting the triton server getting the below error.

failed to resize tty, using default size

Body:
Building the windows-based triton server image.

Building the Dockerfile.win10.min for triton server version 22.11 was not working as base image required for building the server image was not available for downloading.

To build the image downgraded the triton server version to 22.10. Also needed to download the appropriate CUDNN and TENSORT version for building the image.

Successfully built the base image using below command for 22.10 server version.

docker build -t win10-py3-min -f Dockerfile.win10.min .

Once base image is built. To build the triton server image used below command with appropriate container tag and required backend.

python build.py --cmake-dir=<path/to/repo>/build --build-dir=/tmp/citritonbuild --no-container-pull --image=base,win10-py3-min --enable-logging --enable-stats --enable-tracing --enable-gpu --endpoint=grpc --endpoint=http --repo-tag=common:<container tag> --repo-tag=core:<container tag> --repo-tag=backend:<container tag> --repo-tag=thirdparty:<container tag> --backend=ensemble --backend=tensorrt:<container tag> --backend=onnxruntime:<container tag> --backend=openvino:<container tag>

Tried different arguments with build.py command to build the triton server image was unsuccessful. As there were certain issues related to CMAKE, Rapid Json.

Certain issues on github suggested to try with the latest stable release which is 22.12. For building the base image it required the same os as per 22.11. So, to build the base image used the Dockerfile.win10.min file from 22.10 version which worked earlier.

After passing different arguments to build.py file was able to build the tritonserver image. However, initially built images did not have the tritonserver.exe which is required for starting the server. In the end was able to build the tritonserver which had the required tritonserver.exe.

built the image using below command.

python build.py -v --no-container-pull --image=base,win10-py3-min --enable-logging --enable-stats --enable-tracing --enable-gpu --endpoint=grpc --endpoint=http --repo-tag=common:r22.12 --repo-tag=core:r22.12 --repo-tag=backend:r22.12 --repo-tag=thirdparty:r22.12 --backend=ensemble

To start the triton server, need to mount the local model repository to the docker image. Command to start the server is as below.

docker run -it -v C:/Users/Desktop/model_repository:C:/opt/tritonserver/models tritonserver:latest bin/tritonserver.exe --model-repository=C/opt/tritonserver/models

While starting the triton server getting the below error.

failed to resize tty, using default size


问:
Postgresql group into predefined groups where group names come from a database table
I have a database table with data similar to this.

```<code>create table DataTable (
  name text,
  value number
)

insert into DataTable values
('A', 1),('A', 2),('B', 3),('Other', 5),('C', 1);
</code>```

And i have another table

```<code>create table "group" (
  name text,
  default boolean
)

insert into "group" values
('A', false),('B', false),('Other', true);
</code>```

I want to group the data in the first table based on the defined groups in the second table.

Expected output

```<code>Name  | sum
A     |  3
B     |  3
Other |  6
</code>```

Right now I'm using this query:

```<code>select coalesce(g.name, (select name from group where default = true)) name
sum(dt.value)
from DataTable dt
left join group g on dt.name = g.name
group by 1
</code>```

This works but can cause performance tips in some situations. Any better way to do this?

Body:
I have a database table with data similar to this.

create table DataTable (
  name text,
  value number
)

insert into DataTable values
('A', 1),('A', 2),('B', 3),('Other', 5),('C', 1);

And i have another table

create table "group" (
  name text,
  default boolean
)

insert into "group" values
('A', false),('B', false),('Other', true);

I want to group the data in the first table based on the defined groups in the second table.

Expected output

Name  | sum
A     |  3
B     |  3
Other |  6

Right now I'm using this query:

select coalesce(g.name, (select name from group where default = true)) name
sum(dt.value)
from DataTable dt
left join group g on dt.name = g.name
group by 1

This works but can cause performance tips in some situations. Any better way to do this?


问:
Unable to launch WebDriverAgent because of xcodebuild failure: Command 'carthage bootstrap --platform iOS' exited with code 1
I am trying to execute simple java selenium script to automation ios application in Mac, getting error

an unknown server-side error occurred while processing the command.
Original error: Unable to launch WebDriverAgent because of xcodebuild
failure: Command 'carthage bootstrap --platform iOS' exited with code

Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md.
Try to remove the WebDriverAgentRunner application from the device if
it is installed and reboot the device.

Versions of SW used:

Mac OS Ventura 13.1

Appium 1.15.0

NodeJS 11.13

Npm 6.4.1

Java 19.0.1

Xcode 14.2

Eclipse 4.26

Build success in XCode with team id and signing properties set, also was able to execute sample 'IntegrationApp' successfully on real mobile device.

Below are capabilities used:

```<code>`DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability("platformName", "iOS");
cap.setCapability("platformVersion", "15.5");
cap.setCapability("deviceName", "iPhone 13 mini");
cap.setCapability("udid", "00008110-000C714821D0401E");
cap.setCapability("app",
"/Users/devadmin/eclipse/ws2/ts1/src/test/resources/Facebook/Facebook_278.0.ipa");
cap.setCapability("--session-override", true);
cap.setCapability("xcodeOrgId", "Darpan Lad");
cap.setCapability("xcodeSigningId", "iPhone Developer");
cap.setCapability("WDAlaunchTimeOut", Duration.ofSeconds(20));
cap.setCapability("updatedWDABundleId", "com.fb.WebDriverAgentLib");
cap.setCapability("bundleId", "com.facebook.katana");
cap.setCapability("clearSystemFiles", true);
IOSDriver driver = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"),cap);`

</code>```

Getting below error:

```<code>Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: Command 'carthage bootstrap --platform iOS' exited with code 1. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'INGNBHLP01241', ip: '2401:4900:1f26:5475:9ddc:aae0:72e:5356%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.1', java.version: '17.0.5'
Driver info: driver.version: IOSDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: Command 'carthage bootstrap --platform iOS' exited with code 1. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:826:9)
at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:388:37)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'INGNBHLP01241', ip: '2401:4900:1f26:5475:9ddc:aae0:72e:5356%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.1', java.version: '17.0.5'
Driver info: driver.version: IOSDriver
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:336)
at org.openqa.selenium.remote.RemoteWebDriver.\<init\>(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.\<init\>(DefaultGenericMobileDriver.java:37)
at io.appium.java_client.AppiumDriver.\<init\>(AppiumDriver.java:88)
at io.appium.java_client.AppiumDriver.\<init\>(AppiumDriver.java:98)
at io.appium.java_client.ios.IOSDriver.\<init\>(IOSDriver.java:90)
at ts1.iostest1.main(iostest1.java:48)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186)
14 more
Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: Command 'carthage bootstrap --platform iOS' exited with code 1. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'INGNBHLP01241', ip: '2401:4900:1f26:5475:9ddc:aae0:72e:5356%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.1', java.version: '17.0.5'
Driver info: driver.version: IOSDriver
remote stacktrace: **UnknownError: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: Command 'carthage bootstrap --platform iOS' exited with code 1**. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:826:9)
at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:388:37)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
</code>```

Tried changing different versions of Appium 1.22, 1.12, 1.15.
Changed Node JS versions
but no luck in executing script

Body:
I am trying to execute simple java selenium script to automation ios application in Mac, getting error

an unknown server-side error occurred while processing the command.
Original error: Unable to launch WebDriverAgent because of xcodebuild
failure: Command 'carthage bootstrap --platform iOS' exited with code

Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md.
Try to remove the WebDriverAgentRunner application from the device if
it is installed and reboot the device.

Versions of SW used:

Mac OS Ventura 13.1

Appium 1.15.0

NodeJS 11.13

Npm 6.4.1

Java 19.0.1

Xcode 14.2

Eclipse 4.26

Build success in XCode with team id and signing properties set, also was able to execute sample 'IntegrationApp' successfully on real mobile device.

Below are capabilities used:

`DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability("platformName", "iOS");
cap.setCapability("platformVersion", "15.5");
cap.setCapability("deviceName", "iPhone 13 mini");
cap.setCapability("udid", "00008110-000C714821D0401E");
cap.setCapability("app",
"/Users/devadmin/eclipse/ws2/ts1/src/test/resources/Facebook/Facebook_278.0.ipa");
cap.setCapability("--session-override", true);
cap.setCapability("xcodeOrgId", "Darpan Lad");
cap.setCapability("xcodeSigningId", "iPhone Developer");
cap.setCapability("WDAlaunchTimeOut", Duration.ofSeconds(20));
cap.setCapability("updatedWDABundleId", "com.fb.WebDriverAgentLib");
cap.setCapability("bundleId", "com.facebook.katana");
cap.setCapability("clearSystemFiles", true);
IOSDriver driver = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"),cap);`

Getting below error:

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: Command 'carthage bootstrap --platform iOS' exited with code 1. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'INGNBHLP01241', ip: '2401:4900:1f26:5475:9ddc:aae0:72e:5356%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.1', java.version: '17.0.5'
Driver info: driver.version: IOSDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: Command 'carthage bootstrap --platform iOS' exited with code 1. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:826:9)
at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:388:37)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'INGNBHLP01241', ip: '2401:4900:1f26:5475:9ddc:aae0:72e:5356%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.1', java.version: '17.0.5'
Driver info: driver.version: IOSDriver
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:336)
at org.openqa.selenium.remote.RemoteWebDriver.\<init\>(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.\<init\>(DefaultGenericMobileDriver.java:37)
at io.appium.java_client.AppiumDriver.\<init\>(AppiumDriver.java:88)
at io.appium.java_client.AppiumDriver.\<init\>(AppiumDriver.java:98)
at io.appium.java_client.ios.IOSDriver.\<init\>(IOSDriver.java:90)
at ts1.iostest1.main(iostest1.java:48)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186)
14 more
Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: Command 'carthage bootstrap --platform iOS' exited with code 1. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'INGNBHLP01241', ip: '2401:4900:1f26:5475:9ddc:aae0:72e:5356%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '13.1', java.version: '17.0.5'
Driver info: driver.version: IOSDriver
remote stacktrace: **UnknownError: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: Command 'carthage bootstrap --platform iOS' exited with code 1**. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:826:9)
at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:388:37)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)

Tried changing different versions of Appium 1.22, 1.12, 1.15.
Changed Node JS versions
but no luck in executing script


问:
How to get property and object inside OData array JSON results
I want to get entityObject using OData API logic, I was able to get id and name using this ${this.environment.url}/magic?$select=id,name} However when I say ${this.environment.url}/magic?$select=id,name,entityObject} it does not get entityObject. Result from api

```<code>[
   {
      "id":"someId",
      "name":"some Name,",
      "entityObject":{
         "id":"someId",
         "description":"some Description"
      }
   }
]
</code>```

Body:
I want to get entityObject using OData API logic, I was able to get id and name using this ${this.environment.url}/magic?$select=id,name} However when I say ${this.environment.url}/magic?$select=id,name,entityObject} it does not get entityObject. Result from api

[
   {
      "id":"someId",
      "name":"some Name,",
      "entityObject":{
         "id":"someId",
         "description":"some Description"
      }
   }
]


问:
Laravel Sanctum SPA with React js unexpected logout error 401 (Unauthorized)
My application works perfectly (Login and all other apis) using laravel Sanctum SPA authentication with react js. But sometimes the system is logout unexpectedly, api response shows error 401 Unauthorized. Message: Unauthenticated.

Searched the web for this issue but found nothing useful.


问:
How do I deskew the image of a cheque/text in a scanned image?
This is the image I need to deskew

I don't want to run object detection here,
I tried the following script, but that didn't work
what should I do next ?

```<code>import math
from typing import Tuple, Union

import cv2
import numpy as np

from deskew import determine_skew

def rotate(
        image: np.ndarray, angle: float, background: Union[int, Tuple[int, int, int]]
) -> np.ndarray:
    old_width, old_height = image.shape[:2]
    angle_radian = math.radians(angle)
    width = abs(np.sin(angle_radian) * old_height) + abs(np.cos(angle_radian) * old_width)
    height = abs(np.sin(angle_radian) * old_width) + abs(np.cos(angle_radian) * old_height)

    image_center = tuple(np.array(image.shape[1::-1]) / 2)
    rot_mat = cv2.getRotationMatrix2D(image_center, angle, 1.0)
    rot_mat[1, 2] += (width - old_width) / 2
    rot_mat[0, 2] += (height - old_height) / 2
    return cv2.warpAffine(image, rot_mat, (int(round(height)), int(round(width))), borderValue=background)

image = cv2.imread('/content/img.jpg')
grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
angle = determine_skew(grayscale)
rotated = rotate(image

, angle, (0, 0, 1))
cv2_imshow(rotated)
</code>```

and this simpler version too

```<code>import numpy as np
from skimage import io
from skimage.color import rgb2gray
from skimage.transform import rotate

from deskew import determine_skew

image = io.imread('/content/img.jpg')
grayscale = rgb2gray(image)
angle = determine_skew(grayscale)
rotated = rotate(image, angle, resize=True) * 255
# io.imsave('output.png', rotated.astype(np.uint8))
cv2_imshow(rotated.astype(np.uint8))
</code>```

Body:
This is the image I need to deskew

I don't want to run object detection here,
I tried the following script, but that didn't work
what should I do next ?

import math
from typing import Tuple, Union

import cv2
import numpy as np

from deskew import determine_skew

def rotate(
        image: np.ndarray, angle: float, background: Union[int, Tuple[int, int, int]]
) -> np.ndarray:
    old_width, old_height = image.shape[:2]
    angle_radian = math.radians(angle)
    width = abs(np.sin(angle_radian) * old_height) + abs(np.cos(angle_radian) * old_width)
    height = abs(np.sin(angle_radian) * old_width) + abs(np.cos(angle_radian) * old_height)

    image_center = tuple(np.array(image.shape[1::-1]) / 2)
    rot_mat = cv2.getRotationMatrix2D(image_center, angle, 1.0)
    rot_mat[1, 2] += (width - old_width) / 2
    rot_mat[0, 2] += (height - old_height) / 2
    return cv2.warpAffine(image, rot_mat, (int(round(height)), int(round(width))), borderValue=background)

image = cv2.imread('/content/img.jpg')
grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
angle = determine_skew(grayscale)
rotated = rotate(image

, angle, (0, 0, 1))
cv2_imshow(rotated)

and this simpler version too

import numpy as np
from skimage import io
from skimage.color import rgb2gray
from skimage.transform import rotate

from deskew import determine_skew

image = io.imread('/content/img.jpg')
grayscale = rgb2gray(image)
angle = determine_skew(grayscale)
rotated = rotate(image, angle, resize=True) * 255
# io.imsave('output.png', rotated.astype(np.uint8))
cv2_imshow(rotated.astype(np.uint8))


问:
Helium_python_ig_scrapper
I have problem with helium. Because working in 20 minutes and now showing this error anyone help??
error:
Exception has occurred: AttributeError
'FirefoxProfile' object has no attribute 'binary'

my code:

```<code>def chbrowser(browser):
    global ig
    if browser=="f":

        fprof = webdriver.FirefoxProfile()
        fprof.set_preference('intl.accept_languages', 'en-US')
        ig = start_firefox(options=fprof)
    if browser=="ch":
        chopt = webdriver.ChromeOptions()
        chopt.add_argument("--lang=en-US")
        ig = start_chrome(options=chopt)
if __name__=="__main__":
    chbrowser(input("put browser,firefox=f,chrome=ch:
</code>```

"))

Title: Helium_python_ig_scrapper

Body:
I have problem with helium. Because working in 20 minutes and now showing this error anyone help??
error:
Exception has occurred: AttributeError
'FirefoxProfile' object has no attribute 'binary'

my code:

def chbrowser(browser):
    global ig
    if browser=="f":

        fprof = webdriver.FirefoxProfile()
        fprof.set_preference('intl.accept_languages', 'en-US')
        ig = start_firefox(options=fprof)
    if browser=="ch":
        chopt = webdriver.ChromeOptions()
        chopt.add_argument("--lang=en-US")
        ig = start_chrome(options=chopt)
if __name__=="__main__":
    chbrowser(input("put browser,firefox=f,chrome=ch:

"))


问:
npx mocha tests was failure from network issue
I have a stage in GitLab where I test dev commit for valid
I use gitlab-runner in docker and in runner I use docker for docker

My stage:

```<code>test-dev:
  stage: test
  image: docker:19.03.12
  services:
    - docker:dind
  script:
    - apk add --update npm
    - docker run --rm -d --name=browser_$CI_JOB_ID -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-chrome
    - npx mocha tests/js/screenshots-* --timeout 50000
    - npx playwright test tests/js/pw_*
    - php artisan test
    - docker stop browser_$CI_JOB_ID
</code>```

And I have next output in failure job:

```<code>$ npx mocha tests/js/screenshots-* --timeout 50000
[INFO] Searching for WebDriver executables installed on the current system...
[INFO] ... located chrome
[INFO] Running tests against [chrome]
  [chrome]
    Instagram screenshots
      1) "before all" hook for "Instagram Back to list"
      2) "after all" hook for "Instagram Emoji in comments scrolling"
  [chrome]
    Дополнительные НЕскриншот тесты
      3) "before all" hook for "Подсветка логина во всплывашке"
      4) "after all" hook for "Подсветка логина во всплывашке"
  [chrome]
    TikTok screenshots
      5) "before all" hook for "Back to list"
      6) "after all" hook for "HINT: Here are the main indicators of the channel"
  [chrome]
    Youtube screenshots
      7) "before all" hook for "Back to list"
      8) "after all" hook for "HINT: Here are the main indicators of the channel"
  0 passing (214ms)
  8 failing
  1) [chrome]
       Instagram screenshots
         "before all" hook for "Instagram Back to list":
     Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
      at ClientRequest.<anonymous> (node_modules/selenium-webdriver/http/index.js:295:15)
      at Socket.socketErrorListener (_http_client.js:427:9)
      at emitErrorNT (internal/streams/destroy.js:92:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)
  2) [chrome]
       Instagram screenshots
         "after all" hook for "Instagram Emoji in comments scrolling":
     TypeError: Cannot read property 'quit' of undefined
      at Context.<anonymous> (tests/js/screenshots-instagram.spec.js:33:40)
      at processImmediate (internal/timers.js:461:21)
  3) [chrome]
       Дополнительные НЕскриншот тесты
         "before all" hook for "Подсветка логина во всплывашке":
     Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
      at ClientRequest.<anonymous> (node_modules/selenium-webdriver/http/index.js:295:15)
      at Socket.socketErrorListener (_http_client.js:427:9)
      at emitErrorNT (internal/streams/destroy.js:92:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)
  4) [chrome]
       Дополнительные НЕскриншот тесты
         "after all" hook for "Подсветка логина во всплывашке":
     TypeError: Cannot read property 'quit' of undefined
      at Context.<anonymous> (tests/js/screenshots-nonscreen_instagram.spec.js:33:40)
      at processImmediate (internal/timers.js:461:21)
  5) [chrome]
       TikTok screenshots
         "before all" hook for "Back to list":
     Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
      at ClientRequest.<anonymous> (node_modules/selenium-webdriver/http/index.js:295:15)
      at Socket.socketErrorListener (_http_client.js:427:9)
      at emitErrorNT (internal/streams/destroy.js:92:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)
  6) [chrome]
       TikTok screenshots
         "after all" hook for "HINT: Here are the main indicators of the channel":
     TypeError: Cannot read property 'quit' of undefined
      at Context.<anonymous> (tests/js/screenshots-tiktok.spec.js:32:40)
      at processImmediate (internal/timers.js:461:21)
  7) [chrome]
       Youtube screenshots
         "before all" hook for "Back to list":
     Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
      at ClientRequest.<anonymous> (node_modules/selenium-webdriver/http/index.js:295:15)
      at Socket.socketErrorListener (_http_client.js:427:9)
      at emitErrorNT (internal/streams/destroy.js:92:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)
  8) [chrome]
       Youtube screenshots
         "after all" hook for "HINT: Here are the main indicators of the channel":
     TypeError: Cannot read property 'quit' of undefined
      at Context.<anonymous> (tests/js/screenshots-youtube.spec.js:32:40)
      at processImmediate (internal/timers.js:461:21)
</code>```

How I can share network between containers for npx mocha test?
And why is it waiting for a response from localhost?

Body:
I have a stage in GitLab where I test dev commit for valid
I use gitlab-runner in docker and in runner I use docker for docker

My stage:

test-dev:
  stage: test
  image: docker:19.03.12
  services:
    - docker:dind
  script:
    - apk add --update npm
    - docker run --rm -d --name=browser_$CI_JOB_ID -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-chrome
    - npx mocha tests/js/screenshots-* --timeout 50000
    - npx playwright test tests/js/pw_*
    - php artisan test
    - docker stop browser_$CI_JOB_ID

And I have next output in failure job:

$ npx mocha tests/js/screenshots-* --timeout 50000
[INFO] Searching for WebDriver executables installed on the current system...
[INFO] ... located chrome
[INFO] Running tests against [chrome]
  [chrome]
    Instagram screenshots
      1) "before all" hook for "Instagram Back to list"
      2) "after all" hook for "Instagram Emoji in comments scrolling"
  [chrome]
    Дополнительные НЕскриншот тесты
      3) "before all" hook for "Подсветка логина во всплывашке"
      4) "after all" hook for "Подсветка логина во всплывашке"
  [chrome]
    TikTok screenshots
      5) "before all" hook for "Back to list"
      6) "after all" hook for "HINT: Here are the main indicators of the channel"
  [chrome]
    Youtube screenshots
      7) "before all" hook for "Back to list"
      8) "after all" hook for "HINT: Here are the main indicators of the channel"
  0 passing (214ms)
  8 failing
  1) [chrome]
       Instagram screenshots
         "before all" hook for "Instagram Back to list":
     Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
      at ClientRequest.<anonymous> (node_modules/selenium-webdriver/http/index.js:295:15)
      at Socket.socketErrorListener (_http_client.js:427:9)
      at emitErrorNT (internal/streams/destroy.js:92:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)
  2) [chrome]
       Instagram screenshots
         "after all" hook for "Instagram Emoji in comments scrolling":
     TypeError: Cannot read property 'quit' of undefined
      at Context.<anonymous> (tests/js/screenshots-instagram.spec.js:33:40)
      at processImmediate (internal/timers.js:461:21)
  3) [chrome]
       Дополнительные НЕскриншот тесты
         "before all" hook for "Подсветка логина во всплывашке":
     Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
      at ClientRequest.<anonymous> (node_modules/selenium-webdriver/http/index.js:295:15)
      at Socket.socketErrorListener (_http_client.js:427:9)
      at emitErrorNT (internal/streams/destroy.js:92:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)
  4) [chrome]
       Дополнительные НЕскриншот тесты
         "after all" hook for "Подсветка логина во всплывашке":
     TypeError: Cannot read property 'quit' of undefined
      at Context.<anonymous> (tests/js/screenshots-nonscreen_instagram.spec.js:33:40)
      at processImmediate (internal/timers.js:461:21)
  5) [chrome]
       TikTok screenshots
         "before all" hook for "Back to list":
     Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
      at ClientRequest.<anonymous> (node_modules/selenium-webdriver/http/index.js:295:15)
      at Socket.socketErrorListener (_http_client.js:427:9)
      at emitErrorNT (internal/streams/destroy.js:92:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)
  6) [chrome]
       TikTok screenshots
         "after all" hook for "HINT: Here are the main indicators of the channel":
     TypeError: Cannot read property 'quit' of undefined
      at Context.<anonymous> (tests/js/screenshots-tiktok.spec.js:32:40)
      at processImmediate (internal/timers.js:461:21)
  7) [chrome]
       Youtube screenshots
         "before all" hook for "Back to list":
     Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444
      at ClientRequest.<anonymous> (node_modules/selenium-webdriver/http/index.js:295:15)
      at Socket.socketErrorListener (_http_client.js:427:9)
      at emitErrorNT (internal/streams/destroy.js:92:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
      at processTicksAndRejections (internal/process/task_queues.js:84:21)
  8) [chrome]
       Youtube screenshots
         "after all" hook for "HINT: Here are the main indicators of the channel":
     TypeError: Cannot read property 'quit' of undefined
      at Context.<anonymous> (tests/js/screenshots-youtube.spec.js:32:40)
      at processImmediate (internal/timers.js:461:21)

How I can share network between containers for npx mocha test?
And why is it waiting for a response from localhost?


问:
PyQt6 with UI File
How can I solve the error:

"AttributeError: 'Widget' object has no attribute...".

I'm learning python and PyQt6. I would like to be capable to use the .ui file for my window app, however I can run the script but I cannot connect the objects such as button.

Here is the code:

```<code># This Python file uses the following encoding: utf-8
import os
from pathlib import Path
import sys

from PySide6.QtWidgets import QApplication, QWidget, QPushButton, QLabel
from PySide6.QtCore import QFile
from PySide6.QtUiTools import QUiLoader

class Widget(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.load_ui()

    def load_ui(self):
        loader = QUiLoader()
        path = Path(__file__).resolve().parent / "form.ui"
        ui_file = QFile(path)
        ui_file.open(QFile.ReadOnly)
        loader.load(ui_file, self)
        ui_file.close()
        self.bottone.clicked.connect(self.cliccami) #here the problem, cannot find 'bottone' which is the button objectName in my UI file

    def cliccami(self):
        print("il bottone è stato cliccato")

if __name__ == "__main__":
    app = QApplication(sys.argv)
    widget = Widget()
    widget.show()
    sys.exit(app.exec())
</code>```

here is my UI file:

```<code><?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Widget</class>
 <widget class="QWidget" name="Widget">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>674</width>
    <height>269</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Widget</string>
  </property>
  <widget class="QPushButton" name="bottone">
   <property name="enabled">
    <bool>true</bool>
   </property>
   <property name="geometry">
    <rect>
     <x>230</x>
     <y>160</y>
     <width>100</width>
     <height>32</height>
    </rect>
   </property>
   <property name="text">
    <string>premimi</string>
   </property>
  </widget>
  <widget class="QLabel" name="testo">
   <property name="geometry">
    <rect>
     <x>230</x>
     <y>100</y>
     <width>121</width>
     <height>16</height>
    </rect>
   </property>
   <property name="text">
    <string>cambiami</string>
   </property>
  </widget>
 </widget>
 <resources/>
 <connections/>
</ui>
</code>```

here the output

```<code>12:49:11: Starting /usr/bin/python3 -u widget.py...
qt.pysideplugin: Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out.
qt.pysideplugin: No instance of QPyDesignerCustomWidgetCollection was found.
Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute and QSGRendererInterface::OpenGLRhi using QQuickWindow::setGraphicsApi before constructing QGuiApplication.
Traceback (most recent call last):
  File "/Users/giulio/Projects/QtProjects/provaprova/widget.py", line 29, in <module>
    widget = Widget()
  File "/Users/giulio/Projects/QtProjects/provaprova/widget.py", line 13, in __init__
    self.load_ui()
  File "/Users/giulio/Projects/QtProjects/provaprova/widget.py", line 22, in load_ui
    self.bottone.clicked.connect(self.cliccami)
AttributeError: 'Widget' object has no attribute 'bottone'
</code>```

tried several commands, but cannot find the solution

Title: PyQt6 with UI File

Body:
How can I solve the error:

"AttributeError: 'Widget' object has no attribute...".

I'm learning python and PyQt6. I would like to be capable to use the .ui file for my window app, however I can run the script but I cannot connect the objects such as button.

Here is the code:

# This Python file uses the following encoding: utf-8
import os
from pathlib import Path
import sys

from PySide6.QtWidgets import QApplication, QWidget, QPushButton, QLabel
from PySide6.QtCore import QFile
from PySide6.QtUiTools import QUiLoader

class Widget(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.load_ui()

    def load_ui(self):
        loader = QUiLoader()
        path = Path(__file__).resolve().parent / "form.ui"
        ui_file = QFile(path)
        ui_file.open(QFile.ReadOnly)
        loader.load(ui_file, self)
        ui_file.close()
        self.bottone.clicked.connect(self.cliccami) #here the problem, cannot find 'bottone' which is the button objectName in my UI file

    def cliccami(self):
        print("il bottone è stato cliccato")

if __name__ == "__main__":
    app = QApplication(sys.argv)
    widget = Widget()
    widget.show()
    sys.exit(app.exec())

here is my UI file:

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Widget</class>
 <widget class="QWidget" name="Widget">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>674</width>
    <height>269</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Widget</string>
  </property>
  <widget class="QPushButton" name="bottone">
   <property name="enabled">
    <bool>true</bool>
   </property>
   <property name="geometry">
    <rect>
     <x>230</x>
     <y>160</y>
     <width>100</width>
     <height>32</height>
    </rect>
   </property>
   <property name="text">
    <string>premimi</string>
   </property>
  </widget>
  <widget class="QLabel" name="testo">
   <property name="geometry">
    <rect>
     <x>230</x>
     <y>100</y>
     <width>121</width>
     <height>16</height>
    </rect>
   </property>
   <property name="text">
    <string>cambiami</string>
   </property>
  </widget>
 </widget>
 <resources/>
 <connections/>
</ui>

here the output

12:49:11: Starting /usr/bin/python3 -u widget.py...
qt.pysideplugin: Environment variable PYSIDE_DESIGNER_PLUGINS is not set, bailing out.
qt.pysideplugin: No instance of QPyDesignerCustomWidgetCollection was found.
Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute and QSGRendererInterface::OpenGLRhi using QQuickWindow::setGraphicsApi before constructing QGuiApplication.
Traceback (most recent call last):
  File "/Users/giulio/Projects/QtProjects/provaprova/widget.py", line 29, in <module>
    widget = Widget()
  File "/Users/giulio/Projects/QtProjects/provaprova/widget.py", line 13, in __init__
    self.load_ui()
  File "/Users/giulio/Projects/QtProjects/provaprova/widget.py", line 22, in load_ui
    self.bottone.clicked.connect(self.cliccami)
AttributeError: 'Widget' object has no attribute 'bottone'

tried several commands, but cannot find the solution


问:
Send over MPI_Bcast an MPI_PACKED message
I have a message that I want to send in broadcast by using MPI_Bcast.
I have two structs with, near the others, dynamic arrays, and because of that I decided to use MPI_Pack and MPI_Unpack.

Here below my solution.

```<code>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mpi.h>
#include <stddef.h>

#define DEBUG 0

typedef struct Code {
  char character;
  int length;
  char *code;
} Code;

typedef struct CodeDictionary {
  int codesNr;
  Code *codes;
} CodeDictionary;

typedef struct Header {
  int size; // size of the message in bytes
  MPI_Datatype *type; // message type
  int position; // position in the buffer
} Header;

typedef unsigned char BYTE;

int getRand(const int from, const int to)
{
  int num = (rand() % (to - from + 1)) + from;
  return num;
}

void buildCodeDictionaryType(MPI_Datatype *CodeDictType) {
    int blockLengths[] = {1, 1};
  MPI_Datatype types[] = {MPI_CHAR, MPI_INT};
  MPI_Aint offsets[2];

  offsets[0] = offsetof(Code, character);
  offsets[1] = offsetof(Code, length);

  MPI_Type_create_struct(2, blockLengths, offsets, types, CodeDictType);
  MPI_Type_commit(CodeDictType);
}

BYTE* buildCodeDictionaryMsg(Header *header, CodeDictionary *dict) {
    header->size = sizeof(int);
    BYTE *buffer = malloc(sizeof(BYTE) * (header->size));

    MPI_Pack(&dict->codesNr, 1, MPI_INT, buffer, header->size, &header->position, MPI_COMM_WORLD);

  if (DEBUG == 1) {
    printf("\ndict->codesNr = %d\n", dict->codesNr);
    printf("header->size = %d\n", header->size);
    printf("header->position = %d\n\n", header->position);
  }

    for (int i = 0; i < dict->codesNr; i++) {
        header->size += sizeof(char) + sizeof(int) + (sizeof(char) * (dict->codes[i].length+1));
        buffer = realloc(buffer, header->size);

        MPI_Pack(&dict->codes[i], 1, *header->type, buffer, header->size, &header->position, MPI_COMM_WORLD);

    if (DEBUG == 1) {
      printf("before pack array - header->size = %d\n", header->size);
      printf("before pack array - header->position = %d\n", header->position);
    }

        MPI_Pack(dict->codes[i].code, (dict->codes[i].length+1), MPI_CHAR, buffer, header->size, &header->position, MPI_COMM_WORLD);

    if (DEBUG == 1) {
      printf("after pack array - header->size = %d\n", header->size);
      printf("after pack array - header->position = %d\n", header->position);
      printf("\n");
    }
    }

    return buffer;
}

void buildCodeDictionary(Header *header, CodeDictionary *dict, BYTE* buffer) {
    MPI_Unpack(buffer, header->size, &header->position, &dict->codesNr, 1, MPI_INT, MPI_COMM_WORLD);

  if (DEBUG == 1) {
    printf("dict->codesNr = %d\n", dict->codesNr);
    printf("header->size = %d\n", header->size);
    printf("header->position = %d\n\n", header->position);
  }

  dict->codes = malloc(sizeof(Code) * dict->codesNr);

  // I do it just for the first element because of test
  MPI_Unpack(buffer, header->size, &header->position, &dict->codes[0], 1, *header->type, MPI_COMM_WORLD);

  if (DEBUG == 1) {
    printf("before unpack - header->size = %d\n", header->size);
    printf("before unpack - header->position = %d\n", header->position);
  }

  dict->codes[0].code = malloc(sizeof(char) * (dict->codes[0].length+1));
  MPI_Unpack(buffer, header->size, &header->position, &dict->codes[0].code, (dict->codes[0].length+1), MPI_CHAR, MPI_COMM_WORLD);

  if (DEBUG == 1) {
    printf("after unpack - header->size = %d\n", header->size);
    printf("after unpack - header->position = %d\n", header->position);
  }

  // just for test
  printf("character: %c\tlength: %d\tcode: ",
    dict->codes[0].character,
    dict->codes[0].length);
  printf("%s\n",  dict->codes[0].code); // it crashes here

  // if it works do a for in order to unpack all the data
  // ...
}

int main(int argc, char** argv) {
  MPI_Init(NULL, NULL);

  // Get the number of processes
  int world_size;
  MPI_Comm_size(MPI_COMM_WORLD, &world_size);

  // Get the rank of the process
  int world_rank;
  MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);

  // Create a CodeDictionary variable
  CodeDictionary dict;

  if (world_rank == 0)
    printf("sending\n\n");

  if (world_rank == 0) {
    dict.codesNr = getRand(5, 9);
    dict.codes = malloc(sizeof(Code) * dict.codesNr);

    // create some fake values
    for (int i = 0; i < dict.codesNr; i++) {
      dict.codes[i].character = 'a' + i;
      dict.codes[i].length = getRand(1, 9);
      dict.codes[i].code = malloc(sizeof(char) * (dict.codes[i].length+1));

      for (int j = 0; j < dict.codes[i].length; j++) {
        int randChar = getRand('a', 'z');
        dict.codes[i].code[j] = randChar + j;
      }

      dict.codes[i].code[dict.codes[i].length] = '\0';

      if (DEBUG == 1)
        printf("strlen(dict.charEncoding[%d].encoding): %d\n", i, strlen(dict.codes[i].code));
    }

        printf("source data\n");
        for (int i = 0; i < dict.codesNr; i++) {
      printf("codes[%d]:\n\t", i);

      printf("character: %c\tlength: %d\tcode: ", dict.codes[i].character, dict.codes[i].length);
      for (int j = 0; j < dict.codes[i].length; j++)
        printf("%c", dict.codes[i].code[j]);

            printf("\n");
    }
  }

  MPI_Datatype codeDictType;
  buildCodeDictionaryType(&codeDictType);

  Header header = {.size = 0, .position = 0, .type = NULL};
  header.type = &codeDictType;

  BYTE *buffer = NULL;

  if (world_rank == 0)
    buffer = buildCodeDictionaryMsg(&header, &dict);

  MPI_Bcast(&header.size, 1, MPI_INT, 0, MPI_COMM_WORLD);

  if (DEBUG == 1)
    printf("rank %d: header.size = %d\n", world_rank, header.size);

  if (world_rank != 0)
    buffer = calloc(header.size, sizeof(BYTE));

  MPI_Bcast(buffer, header.size, MPI_PACKED, 0, MPI_COMM_WORLD);

  if (world_rank != 0) {
    printf("\nreceiving\n\n");

    buildCodeDictionary(&header, &dict, buffer);

        // printf("received data\n");
        // for (int i = 0; i < dict.codesNr; i++) {
    //   printf("codes[%d]:\n\t", i);

    //   printf("character: %c\tlength: %d\tcode: ", dict.codes[i].character, dict.codes[i].length);
    //   for (int j = 0; j < dict.codes[i].length; j++)
    //     printf("%c", dict.codes[i].code[j]);

        //  printf("\n");
    // }
  }

  free(buffer);

  MPI_Type_free(&codeDictType);

  for (int i = 0; i < dict.codesNr; i++)
    free(dict.codes[i].code);

  free(dict.codes);

  MPI_Finalize();

  return 0;
}
</code>```

For some reason this line of code doesn't work MPI_Unpack(buffer, header->size, &header->position, &dict->codes[0].code, (dict->codes[0].length+1), MPI_CHAR, MPI_COMM_WORLD); because if I try to print the received array, the run crashes with segmentation fault as error.

I don't understand why it happens, I take care of the memory by allocating the right size, \0 character included.

Do you know what is the problem?

Body:
I have a message that I want to send in broadcast by using MPI_Bcast.
I have two structs with, near the others, dynamic arrays, and because of that I decided to use MPI_Pack and MPI_Unpack.

Here below my solution.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mpi.h>
#include <stddef.h>

#define DEBUG 0

typedef struct Code {
  char character;
  int length;
  char *code;
} Code;

typedef struct CodeDictionary {
  int codesNr;
  Code *codes;
} CodeDictionary;

typedef struct Header {
  int size; // size of the message in bytes
  MPI_Datatype *type; // message type
  int position; // position in the buffer
} Header;

typedef unsigned char BYTE;

int getRand(const int from, const int to)
{
  int num = (rand() % (to - from + 1)) + from;
  return num;
}

void buildCodeDictionaryType(MPI_Datatype *CodeDictType) {
    int blockLengths[] = {1, 1};
  MPI_Datatype types[] = {MPI_CHAR, MPI_INT};
  MPI_Aint offsets[2];

  offsets[0] = offsetof(Code, character);
  offsets[1] = offsetof(Code, length);

  MPI_Type_create_struct(2, blockLengths, offsets, types, CodeDictType);
  MPI_Type_commit(CodeDictType);
}

BYTE* buildCodeDictionaryMsg(Header *header, CodeDictionary *dict) {
    header->size = sizeof(int);
    BYTE *buffer = malloc(sizeof(BYTE) * (header->size));

    MPI_Pack(&dict->codesNr, 1, MPI_INT, buffer, header->size, &header->position, MPI_COMM_WORLD);

  if (DEBUG == 1) {
    printf("\ndict->codesNr = %d\n", dict->codesNr);
    printf("header->size = %d\n", header->size);
    printf("header->position = %d\n\n", header->position);
  }

    for (int i = 0; i < dict->codesNr; i++) {
        header->size += sizeof(char) + sizeof(int) + (sizeof(char) * (dict->codes[i].length+1));
        buffer = realloc(buffer, header->size);

        MPI_Pack(&dict->codes[i], 1, *header->type, buffer, header->size, &header->position, MPI_COMM_WORLD);

    if (DEBUG == 1) {
      printf("before pack array - header->size = %d\n", header->size);
      printf("before pack array - header->position = %d\n", header->position);
    }

        MPI_Pack(dict->codes[i].code, (dict->codes[i].length+1), MPI_CHAR, buffer, header->size, &header->position, MPI_COMM_WORLD);

    if (DEBUG == 1) {
      printf("after pack array - header->size = %d\n", header->size);
      printf("after pack array - header->position = %d\n", header->position);
      printf("\n");
    }
    }

    return buffer;
}

void buildCodeDictionary(Header *header, CodeDictionary *dict, BYTE* buffer) {
    MPI_Unpack(buffer, header->size, &header->position, &dict->codesNr, 1, MPI_INT, MPI_COMM_WORLD);

  if (DEBUG == 1) {
    printf("dict->codesNr = %d\n", dict->codesNr);
    printf("header->size = %d\n", header->size);
    printf("header->position = %d\n\n", header->position);
  }

  dict->codes = malloc(sizeof(Code) * dict->codesNr);

  // I do it just for the first element because of test
  MPI_Unpack(buffer, header->size, &header->position, &dict->codes[0], 1, *header->type, MPI_COMM_WORLD);

  if (DEBUG == 1) {
    printf("before unpack - header->size = %d\n", header->size);
    printf("before unpack - header->position = %d\n", header->position);
  }

  dict->codes[0].code = malloc(sizeof(char) * (dict->codes[0].length+1));
  MPI_Unpack(buffer, header->size, &header->position, &dict->codes[0].code, (dict->codes[0].length+1), MPI_CHAR, MPI_COMM_WORLD);

  if (DEBUG == 1) {
    printf("after unpack - header->size = %d\n", header->size);
    printf("after unpack - header->position = %d\n", header->position);
  }

  // just for test
  printf("character: %c\tlength: %d\tcode: ",
    dict->codes[0].character,
    dict->codes[0].length);
  printf("%s\n",  dict->codes[0].code); // it crashes here

  // if it works do a for in order to unpack all the data
  // ...
}

int main(int argc, char** argv) {
  MPI_Init(NULL, NULL);

  // Get the number of processes
  int world_size;
  MPI_Comm_size(MPI_COMM_WORLD, &world_size);

  // Get the rank of the process
  int world_rank;
  MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);

  // Create a CodeDictionary variable
  CodeDictionary dict;

  if (world_rank == 0)
    printf("sending\n\n");

  if (world_rank == 0) {
    dict.codesNr = getRand(5, 9);
    dict.codes = malloc(sizeof(Code) * dict.codesNr);

    // create some fake values
    for (int i = 0; i < dict.codesNr; i++) {
      dict.codes[i].character = 'a' + i;
      dict.codes[i].length = getRand(1, 9);
      dict.codes[i].code = malloc(sizeof(char) * (dict.codes[i].length+1));

      for (int j = 0; j < dict.codes[i].length; j++) {
        int randChar = getRand('a', 'z');
        dict.codes[i].code[j] = randChar + j;
      }

      dict.codes[i].code[dict.codes[i].length] = '\0';

      if (DEBUG == 1)
        printf("strlen(dict.charEncoding[%d].encoding): %d\n", i, strlen(dict.codes[i].code));
    }

        printf("source data\n");
        for (int i = 0; i < dict.codesNr; i++) {
      printf("codes[%d]:\n\t", i);

      printf("character: %c\tlength: %d\tcode: ", dict.codes[i].character, dict.codes[i].length);
      for (int j = 0; j < dict.codes[i].length; j++)
        printf("%c", dict.codes[i].code[j]);

            printf("\n");
    }
  }

  MPI_Datatype codeDictType;
  buildCodeDictionaryType(&codeDictType);

  Header header = {.size = 0, .position = 0, .type = NULL};
  header.type = &codeDictType;

  BYTE *buffer = NULL;

  if (world_rank == 0)
    buffer = buildCodeDictionaryMsg(&header, &dict);

  MPI_Bcast(&header.size, 1, MPI_INT, 0, MPI_COMM_WORLD);

  if (DEBUG == 1)
    printf("rank %d: header.size = %d\n", world_rank, header.size);

  if (world_rank != 0)
    buffer = calloc(header.size, sizeof(BYTE));

  MPI_Bcast(buffer, header.size, MPI_PACKED, 0, MPI_COMM_WORLD);

  if (world_rank != 0) {
    printf("\nreceiving\n\n");

    buildCodeDictionary(&header, &dict, buffer);

        // printf("received data\n");
        // for (int i = 0; i < dict.codesNr; i++) {
    //   printf("codes[%d]:\n\t", i);

    //   printf("character: %c\tlength: %d\tcode: ", dict.codes[i].character, dict.codes[i].length);
    //   for (int j = 0; j < dict.codes[i].length; j++)
    //     printf("%c", dict.codes[i].code[j]);

        //  printf("\n");
    // }
  }

  free(buffer);

  MPI_Type_free(&codeDictType);

  for (int i = 0; i < dict.codesNr; i++)
    free(dict.codes[i].code);

  free(dict.codes);

  MPI_Finalize();

  return 0;
}

For some reason this line of code doesn't work MPI_Unpack(buffer, header->size, &header->position, &dict->codes[0].code, (dict->codes[0].length+1), MPI_CHAR, MPI_COMM_WORLD); because if I try to print the received array, the run crashes with segmentation fault as error.

I don't understand why it happens, I take care of the memory by allocating the right size, \0 character included.

Do you know what is the problem?


问:
Difference between spring.session.timeout property and <session-timeout> tag in web.xml
Trying to store my HttpSession using Redis in Spring Boot. All guides mention session timeout properties - like spring.session.timeout - and previously I used to define timeout in web.xml. Can't figure\find out the difference between those two.

When I comment out timeout in web.xml and use property - for example 1 minute timeout - it is not being 1 minute after deploy. Are those two ways connected somehow? Or those are completely different things?

UPD 1: Also I am using @EnableRedisHttpSession with no args, if that affects it


问:
Dynamic Subdomains in Nuxt3
We have an interesting challenge with our Nuxt3 based statically generated sites.

Essentially, we are a SaaS platform, and generate a website for each user, with the url pattern - xyz.example.com.

We have managed to make this work quite well. However, facing one challenge that we are unable to fix currently -- hmr has stopped working in our development stack.

Console is full of the following error:

```<code>web-socket.mjs?v=2e7270bf:56 WebSocket connection to 'ws://localhost:4000/ws' failed:
connect @ web-socket.mjs?v=2e7270bf:56
web-socket.mjs?v=2e7270bf:5 [Content] WS Error: Event {isTrusted: true, type: 'error', target: WebSocket, currentTarget: WebSocket, eventPhase: 2, …}
warn @ web-socket.mjs?v=2e7270bf:5
onError @ web-socket.mjs?v=2e7270bf:30
error (async)
connect @ web-socket.mjs?v=2e7270bf:59
setTimeout (async)
connect @ web-socket.mjs?v=2e7270bf:44
onClose @ web-socket.mjs?v=2e7270bf:38
web-socket.mjs?v=2e7270bf:4 [Content] WS reconnecting..
web-socket.mjs?v=2e7270bf:4 [Content] WS connect to ws://localhost:4000/ws
</code>```

Any ideas on how to go about fixing this?

Currently -- to get nuxt to work in local dev stack, we have to add

xyz.example.com 127.0.0.1

in our /etc/hosts file. However, unable to figure out to get the WS connection failure errors to stop.

Any help would be much appreciated.

Title: Dynamic Subdomains in Nuxt3

Body:
We have an interesting challenge with our Nuxt3 based statically generated sites.

Essentially, we are a SaaS platform, and generate a website for each user, with the url pattern - xyz.example.com.

We have managed to make this work quite well. However, facing one challenge that we are unable to fix currently -- hmr has stopped working in our development stack.

Console is full of the following error:

web-socket.mjs?v=2e7270bf:56 WebSocket connection to 'ws://localhost:4000/ws' failed:
connect @ web-socket.mjs?v=2e7270bf:56
web-socket.mjs?v=2e7270bf:5 [Content] WS Error: Event {isTrusted: true, type: 'error', target: WebSocket, currentTarget: WebSocket, eventPhase: 2, …}
warn @ web-socket.mjs?v=2e7270bf:5
onError @ web-socket.mjs?v=2e7270bf:30
error (async)
connect @ web-socket.mjs?v=2e7270bf:59
setTimeout (async)
connect @ web-socket.mjs?v=2e7270bf:44
onClose @ web-socket.mjs?v=2e7270bf:38
web-socket.mjs?v=2e7270bf:4 [Content] WS reconnecting..
web-socket.mjs?v=2e7270bf:4 [Content] WS connect to ws://localhost:4000/ws

Any ideas on how to go about fixing this?

Currently -- to get nuxt to work in local dev stack, we have to add

xyz.example.com 127.0.0.1

in our /etc/hosts file. However, unable to figure out to get the WS connection failure errors to stop.

Any help would be much appreciated.


问:
Linq with two tables and an excel file
I have a file that where I have rows that need to be inserted into a destination_table. The destination_table is related in the database with another table, we will call it head_table.
I am using a DataTable class to get the data.
I have the following code but I don't get the expected result.
The query returns zero and this must not be so, it must be greater than zero

If someone could guide me a little, thank you very much.

var query =
    from file in ta.AsEnumerable()
    join head_table in tc.AsEnumerable()
        on file["ID"] equals head_table["ID"]
    join destination_table in td.AsEnumerable()
        on new { ID = file["ID"].ToString().Trim() } equals new { ID = destination_table["ID"].ToString().Trim() }
    into gj
    from result in gj.DefaultIfEmpty()
    select new { line = file, destination_table_key = (result == null ? null : result["ID"]) };

var insertValues = query.Where(a => a.destination_table_key == null);

//It has to return greater than zero and currently I can't get it
if (insertValues.Count() > 0)
{
    foreach (var re in insertValues)
    {
        InsertRow... //Here is the part of the insert
    }
}
```

Title: Linq with two tables and an excel file


问:
Flutter: How to set an Instagram story like spotify In Flutter?(I want to share image with app url as story)

I want to share an Image with my app link as an Instagram story when the user clicks on that link it's should redirect to my app. from Spotify app it's possible but I'm not able to do this. from the below code I can show the only image but I need to show an image with URL

```<code>var value = await SocialShare.shareInstagramStory(
backgroundTopColor: "#EA2A86",
backgroundBottomColor: "#000000",
backgroundResourcePath: bgImage.path,
appId: '1613497035',
imagePath: file.path,
attributionURL:
url);
</code>```

Body:
I want to share an Image with my app link as an Instagram story when the user clicks on that link it's should redirect to my app. from Spotify app it's possible but I'm not able to do this. from the below code I can show the only image but I need to show an image with URL

var value = await SocialShare.shareInstagramStory(
backgroundTopColor: "#EA2A86",
backgroundBottomColor: "#000000",
backgroundResourcePath: bgImage.path,
appId: '1613497035',
imagePath: file.path,
attributionURL:
url);


问:
Karate: Facing OAuth token issues after upgrading from 1.2.0 to 1.3.0
My scenarios were working fine until version 1.2.0. Since I wanted to use @setup for data driven testing I bumped the version to 1.3.0. After that I started getting the following error while fetching OAuth token. Can someone please help.</p>
```<code>
    Given url 'https://oauth2***'
#    And retry until responseStatus == 200
    And header Content-Type = 'application/x-www-form-urlencoded'
    And form field grant_type = "client_credentials"
    And form field client_id = clientId
    And form field client_secret = clientSecret
    When method POST
    Then status 200
</code>```
```<code>{"error_description":"Malformed client ID or secret in payload","error":"invalid_client"}
</code>```

Body:
My scenarios were working fine until version 1.2.0. Since I wanted to use @setup for data driven testing I bumped the version to 1.3.0. After that I started getting the following error while fetching OAuth token. Can someone please help.

    Given url 'https://oauth2***'
#    And retry until responseStatus == 200
    And header Content-Type = 'application/x-www-form-urlencoded'
    And form field grant_type = "client_credentials"
    And form field client_id = clientId
    And form field client_secret = clientSecret
    When method POST
    Then status 200

{"error_description":"Malformed client ID or secret in payload","error":"invalid_client"}


问:
SQL: UIDs is in main table and table that I need to join. But I need to print those ones that are not in the second table
I've an excercise to do for university class (SQL). It goes like this: 'Write a query that prints the addresses of library members, who have children born before 1 January 1996. The records that intrest us are ones of the members who don't have any book borrowed currently'.

Here's the diagram of the database

I need to join a couple tables here. I managed to write the first part and it works:

```<code>select member.member_no, member.firstname, member.middleinitial, member.lastname, adult.street, adult.city
from member
  join adult on member.member_no = adult.member_no
  join juvenile on juvenile.adult_member_no = member.member_no
where juvenile.birth_date < '1/1/1996'
</code>```

However, I'm struggling with the last part. Obviously, the 'loan' table shows only the books that are borrowed and I need to print UIDs of those library members, who don't hold any book at the moment. How to perform join on something that doesn't exsist in the table? I think the columns 'isbn', 'copy', 'title', 'out date' and 'due date' are irrelevant for this query, therefore I must work with 'member no'. But how?

I thought about something like: 'join loan on member.member_no = loan.member_no where member.member_no not like loan.member_no', but it didn't work. Please help.

I'd be also very grateful if someone could describe how the solution proposed works. Thanks!

Body:
I've an excercise to do for university class (SQL). It goes like this: 'Write a query that prints the addresses of library members, who have children born before 1 January 1996. The records that intrest us are ones of the members who don't have any book borrowed currently'.

Here's the diagram of the database

I need to join a couple tables here. I managed to write the first part and it works:

select member.member_no, member.firstname, member.middleinitial, member.lastname, adult.street, adult.city
from member
  join adult on member.member_no = adult.member_no
  join juvenile on juvenile.adult_member_no = member.member_no
where juvenile.birth_date < '1/1/1996'

However, I'm struggling with the last part. Obviously, the 'loan' table shows only the books that are borrowed and I need to print UIDs of those library members, who don't hold any book at the moment. How to perform join on something that doesn't exsist in the table? I think the columns 'isbn', 'copy', 'title', 'out date' and 'due date' are irrelevant for this query, therefore I must work with 'member no'. But how?

I thought about something like: 'join loan on member.member_no = loan.member_no where member.member_no not like loan.member_no', but it didn't work. Please help.

I'd be also very grateful if someone could describe how the solution proposed works. Thanks!


问:
SwiftUI -- Handling Interactions in Form
I'm creating a more complex UI that consists of several sub-parts, each sub-part is enclosed in a Section and all sections have to go in one Form
As soon as several Buttons belong to one Section, each action of the Buttons is triggered as soon as one Button is clicked.

In the following code

struct ContentView: View {
    @State private var cnt = 0
    var body: some View {
        Form {
            Section (header: Text("Counter")){
                HStack {
                    Button("Increment"){
                        print("Inc")
                        cnt += 1
                    }
                    Spacer()
                    Button("Decrement"){
                        print("Dec")
                        cnt -= 1}
                }
                Text("Counter : \(cnt)")
            }
        }
    }
}
```

a tab one one of the two Buttons triggers both actions. By adding .buttonStyle(PlainButtonStyle()) to each Button or by removing the Form everything works as expected. Unfortunately the real UI is more complex and relies on the Form widget. The .buttonStyle(PlainButtonStyle()) removes the visual hint that the elements are active.

Is there a different way to solve my problem?

Body:
I'm creating a more complex UI that consists of several sub-parts, each sub-part is enclosed in a Section and all sections have to go in one Form
As soon as several Buttons belong to one Section, each action of the Buttons is triggered as soon as one Button is clicked.

In the following code

struct ContentView: View {
    @State private var cnt = 0
    var body: some View {
        Form {
            Section (header: Text("Counter")){
                HStack {
                    Button("Increment"){
                        print("Inc")
                        cnt += 1
                    }
                    Spacer()
                    Button("Decrement"){
                        print("Dec")
                        cnt -= 1}
                }
                Text("Counter : \(cnt)")
            }
        }
    }
}

a tab one one of the two Buttons triggers both actions. By adding .buttonStyle(PlainButtonStyle()) to each Button or by removing the Form everything works as expected. Unfortunately the real UI is more complex and relies on the Form widget. The .buttonStyle(PlainButtonStyle()) removes the visual hint that the elements are active.

Is there a different way to solve my problem?


问:
When using Visual Studio custom templates with parameters, how can you get the actual root namespace?
I am attempting to set up a template to create a unit test class with some basic structure and default using statements. I have created a VS2010 custom template to do this and almost everything works correctly.

The issue I have encountered is that I am attempting to reference my project's base namespace in my using statements, and am unable to determine whether there is a parameter that will let me do this.

An example of what I want, assuming my project is called MyProduct.Test:

```<code>using NUnit.Framework;
using MyProduct.Test.Base;

namespace MyProduct.Test.BLL.Services.MyService
{
    [TestFixture]
    public class MyServiceTest : TestBase
    {
        [SetUp]
        public void Setup()
        etc...
</code>```

I can generate everything except for using MyProduct.Test.Base with the template below:

```<code>using NUnit.Framework;
using $safeprojectname$.Base;

namespace $rootnamespace$
{
    [TestFixture]
    public class $safeitemname$ : TestBase
    {
        [SetUp]
        public void Setup()
        etc...
</code>```

Unfortunately, $safeprojectname$ is only available for Project templates, not Item templates.

This template results in the following output:

```<code>using NUnit.Framework;
using $safeprojectname$.Base;

namespace MyProduct.Test.BLL.Services.MyService
{
    [TestFixture]
    public class MyServiceTest : TestBase
    {
        [SetUp]
        public void Setup()
        etc...
</code>```

Is there any way for me to get the actual root namespace of my project (since $rootnamespace$ actually outputs the namespace for the file being added based on its location)?

Note: Obviously I can set this up to work fine for one project, but it would be much more useful to have a template that works for all projects.

ContentLicense: CC BY-SA 3.0

Body:
I am attempting to set up a template to create a unit test class with some basic structure and default using statements. I have created a VS2010 custom template to do this and almost everything works correctly.

The issue I have encountered is that I am attempting to reference my project's base namespace in my using statements, and am unable to determine whether there is a parameter that will let me do this.

An example of what I want, assuming my project is called MyProduct.Test:

using NUnit.Framework;
using MyProduct.Test.Base;

namespace MyProduct.Test.BLL.Services.MyService
{
    [TestFixture]
    public class MyServiceTest : TestBase
    {
        [SetUp]
        public void Setup()
        etc...

I can generate everything except for using MyProduct.Test.Base with the template below:

using NUnit.Framework;
using $safeprojectname$.Base;

namespace $rootnamespace$
{
    [TestFixture]
    public class $safeitemname$ : TestBase
    {
        [SetUp]
        public void Setup()
        etc...

Unfortunately, $safeprojectname$ is only available for Project templates, not Item templates.

This template results in the following output:

using NUnit.Framework;
using $safeprojectname$.Base;

namespace MyProduct.Test.BLL.Services.MyService
{
    [TestFixture]
    public class MyServiceTest : TestBase
    {
        [SetUp]
        public void Setup()
        etc...

Is there any way for me to get the actual root namespace of my project (since $rootnamespace$ actually outputs the namespace for the file being added based on its location)?

Note: Obviously I can set this up to work fine for one project, but it would be much more useful to have a template that works for all projects.


问:
QGIS can't load and edit MSSQL layers anymore
I have QGIS 3.4 Madeira LTR connected to my Microsoft SQL Server Management Studio 17. I have a lot of data on the SQL Server and since the start of the new year I can't edit my layers in QGIS anymore. I can load the data but it doesn't visualize and I can't zoom on the Layer Extent (In Options it says Extent=Empty but thats not true, because I checked the tables on the Server and they are structured like before). The weird thing is, when I load a layer from my harddrive everything works just fine. The loaded layers from my SQL Server show up but I can't open the attribute table or select features. In some cases Im able to open the attribute table but it only shows one entry (no filters activated). I was thinking that something is wrong with the geometry or the CRS but I did not update the software or change anything in the SQL tables. QGIS even crashes when trying to open attribute tables. It gave me the option "try to repair the map document" but after trying it the connected SQL Table disappeared on the Server but is still visible in the MSSQL dropdown menu on the left (but the data on the SQL Server is definitely gone). Also weird is that saved map documents show the data when I open them but when I add a new SQL layer the data doesn't show up. I would really appreciate some help.

I checked the SQL tables if maybe some primary keys were missing or the geometry column. I checked my update history but nothing was updated. I'm a bit lost where to start and scared to lose more of my data.


问:
Unsupported GOOS/GOARCH pair mingw64_nt-10.0-19044/amd64
I am trying to build Go docker image Windows 10 with build 19044.2130 but giving below error
cmd/go: unsupported GOOS/GOARCH pair mingw64_nt-10.0-19044/amd64, in current GOOS list mingw64 is not listed as per list. Below is the dockerfile

```<code>ARG OS=linux
FROM golang as build_base
ARG OS
WORKDIR /tmp/auditcompile

COPY go.mod .

RUN go mod download

COPY . .

RUN GOOS=$OS go build -o out/audit .
</code>```

Body:
I am trying to build Go docker image Windows 10 with build 19044.2130 but giving below error
cmd/go: unsupported GOOS/GOARCH pair mingw64_nt-10.0-19044/amd64, in current GOOS list mingw64 is not listed as per list. Below is the dockerfile

ARG OS=linux
FROM golang as build_base
ARG OS
WORKDIR /tmp/auditcompile

COPY go.mod .

RUN go mod download

COPY . .

RUN GOOS=$OS go build -o out/audit .