问:
OpenAPI v3, how to hide objects in "Schemas" section
I'm using OpenAPI v3 to create my API docs and having them hosted on app.swaggerhub.com

Is there a way to hide an item from showing up in the Schemas section at the bottom? The real API has dozens of Schema objects, so it'd be very helpful to hide some of them.

Example:

Running this on https://editor-next.swagger.io/

```<code>{
  "openapi": "3.0.3",
  "info": {
    "title": "Swagger Petstore - OpenAPI 3.0",
    "description": "example",
    "version": "1.0.11"
  },
  "servers": [
    {
      "url": "https://petstore3.swagger.io/api/v3"
    }
  ],
  "paths": {
    "/pet": {
      "post": {
        "summary": "Add a new pet to the store",
        "description": "Add a new pet to the store",
        "operationId": "addPet",
        "requestBody": {
          "description": "Create a new pet in the store",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Pet"
              }
            },
            "application/xml": {
              "schema": {
                "$ref": "#/components/schemas/Pet"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/Pet"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pet"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Pet"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 10
          },
          "petId": {
            "type": "integer",
            "format": "int64",
            "example": 198772
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "example": 7
          },
          "shipDate": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "description": "Order Status",
            "example": "approved",
            "enum": [
              "placed",
              "approved",
              "delivered"
            ]
          },
          "complete": {
            "type": "boolean"
          }
        },
        "xml": {
          "name": "order"
        }
      },
      "Customer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 100000
          },
          "username": {
            "type": "string",
            "example": "fehguy"
          },
          "address": {
            "type": "array",
            "xml": {
              "name": "addresses",
              "wrapped": true
            },
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          }
        },
        "xml": {
          "name": "customer"
        }
      },
      "Address": {
        "type": "object",
        "properties": {
          "street": {
            "type": "string",
            "example": "437 Lytton"
          },
          "city": {
            "type": "string",
            "example": "Palo Alto"
          },
          "state": {
            "type": "string",
            "example": "CA"
          },
          "zip": {
            "type": "string",
            "example": "94301"
          }
        },
        "xml": {
          "name": "address"
        }
      },
      "Category": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 1
          },
          "name": {
            "type": "string",
            "example": "Dogs"
          }
        },
        "xml": {
          "name": "category"
        }
      },
      "User": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 10
          },
          "username": {
            "type": "string",
            "example": "theUser"
          },
          "firstName": {
            "type": "string",
            "example": "John"
          },
          "lastName": {
            "type": "string",
            "example": "James"
          },
          "email": {
            "type": "string",
            "example": "john@email.com"
          },
          "password": {
            "type": "string",
            "example": "12345"
          },
          "phone": {
            "type": "string",
            "example": "12345"
          },
          "userStatus": {
            "type": "integer",
            "description": "User Status",
            "format": "int32",
            "example": 1
          }
        },
        "xml": {
          "name": "user"
        }
      },
      "Tag": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          }
        },
        "xml": {
          "name": "tag"
        }
      },
      "Pet": {
        "required": [
          "name",
          "photoUrls"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 10
          },
          "name": {
            "type": "string",
            "example": "doggie"
          },
          "category": {
            "$ref": "#/components/schemas/Category"
          },
          "photoUrls": {
            "type": "array",
            "xml": {
              "wrapped": true
            },
            "items": {
              "type": "string",
              "xml": {
                "name": "photoUrl"
              }
            }
          },
          "tags": {
            "type": "array",
            "xml": {
              "wrapped": true
            },
            "items": {
              "$ref": "#/components/schemas/Tag"
            }
          },
          "status": {
            "type": "string",
            "description": "pet status in the store",
            "enum": [
              "available",
              "pending",
              "sold"
            ]
          }
        },
        "xml": {
          "name": "pet"
        }
      },
      "ApiResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "format": "int32"
          },
          "type": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "xml": {
          "name": "##default"
        }
      }
    },
    "requestBodies": {
      "Pet": {
        "description": "Pet object that needs to be added to the store",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Pet"
            }
          },
          "application/xml": {
            "schema": {
              "$ref": "#/components/schemas/Pet"
            }
          }
        }
      },
      "UserArray": {
        "description": "List of user object",
        "content": {
          "application/json": {
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/User"
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "petstore_auth": {
        "type": "oauth2",
        "flows": {
          "implicit": {
            "authorizationUrl": "https://petstore3.swagger.io/oauth/authorize",
            "scopes": {
              "write:pets": "modify pets in your account",
              "read:pets": "read your pets"
            }
          }
        }
      },
      "api_key": {
        "type": "apiKey",
        "name": "api_key",
        "in": "header"
      }
    }
  }
}
</code>```

...this gets generated:

In this example, I'd like to hide a few of the schema items from view (like Customer or Address).

Note: I'm not self-hosting, so I'm hoping there's a tag I can put into the YAML or JSON.

Thanks,
Ryan

Body:
I'm using OpenAPI v3 to create my API docs and having them hosted on app.swaggerhub.com

Is there a way to hide an item from showing up in the Schemas section at the bottom? The real API has dozens of Schema objects, so it'd be very helpful to hide some of them.

Example:

Running this on https://editor-next.swagger.io/

{
  "openapi": "3.0.3",
  "info": {
    "title": "Swagger Petstore - OpenAPI 3.0",
    "description": "example",
    "version": "1.0.11"
  },
  "servers": [
    {
      "url": "https://petstore3.swagger.io/api/v3"
    }
  ],
  "paths": {
    "/pet": {
      "post": {
        "summary": "Add a new pet to the store",
        "description": "Add a new pet to the store",
        "operationId": "addPet",
        "requestBody": {
          "description": "Create a new pet in the store",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Pet"
              }
            },
            "application/xml": {
              "schema": {
                "$ref": "#/components/schemas/Pet"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/Pet"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Pet"
                }
              },
              "application/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Pet"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 10
          },
          "petId": {
            "type": "integer",
            "format": "int64",
            "example": 198772
          },
          "quantity": {
            "type": "integer",
            "format": "int32",
            "example": 7
          },
          "shipDate": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "type": "string",
            "description": "Order Status",
            "example": "approved",
            "enum": [
              "placed",
              "approved",
              "delivered"
            ]
          },
          "complete": {
            "type": "boolean"
          }
        },
        "xml": {
          "name": "order"
        }
      },
      "Customer": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 100000
          },
          "username": {
            "type": "string",
            "example": "fehguy"
          },
          "address": {
            "type": "array",
            "xml": {
              "name": "addresses",
              "wrapped": true
            },
            "items": {
              "$ref": "#/components/schemas/Address"
            }
          }
        },
        "xml": {
          "name": "customer"
        }
      },
      "Address": {
        "type": "object",
        "properties": {
          "street": {
            "type": "string",
            "example": "437 Lytton"
          },
          "city": {
            "type": "string",
            "example": "Palo Alto"
          },
          "state": {
            "type": "string",
            "example": "CA"
          },
          "zip": {
            "type": "string",
            "example": "94301"
          }
        },
        "xml": {
          "name": "address"
        }
      },
      "Category": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 1
          },
          "name": {
            "type": "string",
            "example": "Dogs"
          }
        },
        "xml": {
          "name": "category"
        }
      },
      "User": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 10
          },
          "username": {
            "type": "string",
            "example": "theUser"
          },
          "firstName": {
            "type": "string",
            "example": "John"
          },
          "lastName": {
            "type": "string",
            "example": "James"
          },
          "email": {
            "type": "string",
            "example": "john@email.com"
          },
          "password": {
            "type": "string",
            "example": "12345"
          },
          "phone": {
            "type": "string",
            "example": "12345"
          },
          "userStatus": {
            "type": "integer",
            "description": "User Status",
            "format": "int32",
            "example": 1
          }
        },
        "xml": {
          "name": "user"
        }
      },
      "Tag": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "name": {
            "type": "string"
          }
        },
        "xml": {
          "name": "tag"
        }
      },
      "Pet": {
        "required": [
          "name",
          "photoUrls"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 10
          },
          "name": {
            "type": "string",
            "example": "doggie"
          },
          "category": {
            "$ref": "#/components/schemas/Category"
          },
          "photoUrls": {
            "type": "array",
            "xml": {
              "wrapped": true
            },
            "items": {
              "type": "string",
              "xml": {
                "name": "photoUrl"
              }
            }
          },
          "tags": {
            "type": "array",
            "xml": {
              "wrapped": true
            },
            "items": {
              "$ref": "#/components/schemas/Tag"
            }
          },
          "status": {
            "type": "string",
            "description": "pet status in the store",
            "enum": [
              "available",
              "pending",
              "sold"
            ]
          }
        },
        "xml": {
          "name": "pet"
        }
      },
      "ApiResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "format": "int32"
          },
          "type": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "xml": {
          "name": "##default"
        }
      }
    },
    "requestBodies": {
      "Pet": {
        "description": "Pet object that needs to be added to the store",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Pet"
            }
          },
          "application/xml": {
            "schema": {
              "$ref": "#/components/schemas/Pet"
            }
          }
        }
      },
      "UserArray": {
        "description": "List of user object",
        "content": {
          "application/json": {
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/User"
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "petstore_auth": {
        "type": "oauth2",
        "flows": {
          "implicit": {
            "authorizationUrl": "https://petstore3.swagger.io/oauth/authorize",
            "scopes": {
              "write:pets": "modify pets in your account",
              "read:pets": "read your pets"
            }
          }
        }
      },
      "api_key": {
        "type": "apiKey",
        "name": "api_key",
        "in": "header"
      }
    }
  }
}

...this gets generated:

In this example, I'd like to hide a few of the schema items from view (like Customer or Address).

Note: I'm not self-hosting, so I'm hoping there's a tag I can put into the YAML or JSON.

Thanks,
Ryan


来源: stackexchange

问:
Swift making network call with generics and multiple different params passed to the function
In my SwiftUI app, I make 4 different .POST requests. I have 4 functions and im trying to make into a generic function to handle all 4 requests. The thing I cant wrap my head around is passing different params for different post requests efficiently.
Here are my current requests and what the functions take as params.

I have 1 similar param and then 8 others depending on the request.

```<code>func pushAppInfoToSF()

func sendHoaSurveyToSF(hasHoa: Bool, companyName: String, companyEmail: String, companyPhone: String, opportunityId: String, completion: @escaping(Result<Bool,SfErrorRes>) -> Void )

func sendInstallSurveyToSF( opportunityId: String, confirmedInstallDate:Bool?, requestedNewInstallDate:Bool?, completion: @escaping(Result<Bool,SfErrorRes>) -> Void )

func fileUploadPostRequest(doc:UploadDocument, oppId:String, projId:String, completion:@escaping(Result<UploadDocument, CustomerAppDataError>) -> Void)
</code>```

My initial thought was pass all args as optional and nil check them and send then data if !nil. It seems like a dirty way to do this.

```<code>func makePOSTRequest<T: Codable>(oppId:String, hasHoa: Bool?,
                                 companyName: Bool?,copmanyEmail: String?,
                                 companyPhone: String?, confirmedInstallDate: Bool?,
                                 requestedNewInstallDate: Bool?, doc: UploadDocument?,
                                 projId: String?, completion:@escaping(Result<T, T>) -> Void) -> T {
    let headers: HTTPHeaders = [
        "AuthKey": "myAuthKey",
        "Accept": "application/json",
    ]
    let params: Parameters = [
        // all params go here
    ]
    let request = AF.request(fullUrl, method: .post, parameters: params, encoding: JSONEncoding.default, headers: headers).response { res in
        switch res.response?.statusCode {
            // do work with response data

        }
    }
}
</code>```

curious if anyone can offer any ideas to make this better and or if this will work as expected.
I am using alamo fire for network requests.

ContentLicense: CC BY-SA 4.0

Body:
In my SwiftUI app, I make 4 different .POST requests. I have 4 functions and im trying to make into a generic function to handle all 4 requests. The thing I cant wrap my head around is passing different params for different post requests efficiently.
Here are my current requests and what the functions take as params.

I have 1 similar param and then 8 others depending on the request.

func pushAppInfoToSF()

func sendHoaSurveyToSF(hasHoa: Bool, companyName: String, companyEmail: String, companyPhone: String, opportunityId: String, completion: @escaping(Result<Bool,SfErrorRes>) -> Void )

func sendInstallSurveyToSF( opportunityId: String, confirmedInstallDate:Bool?, requestedNewInstallDate:Bool?, completion: @escaping(Result<Bool,SfErrorRes>) -> Void )

func fileUploadPostRequest(doc:UploadDocument, oppId:String, projId:String, completion:@escaping(Result<UploadDocument, CustomerAppDataError>) -> Void)

My initial thought was pass all args as optional and nil check them and send then data if !nil. It seems like a dirty way to do this.

func makePOSTRequest<T: Codable>(oppId:String, hasHoa: Bool?,
                                 companyName: Bool?,copmanyEmail: String?,
                                 companyPhone: String?, confirmedInstallDate: Bool?,
                                 requestedNewInstallDate: Bool?, doc: UploadDocument?,
                                 projId: String?, completion:@escaping(Result<T, T>) -> Void) -> T {
    let headers: HTTPHeaders = [
        "AuthKey": "myAuthKey",
        "Accept": "application/json",
    ]
    let params: Parameters = [
        // all params go here
    ]
    let request = AF.request(fullUrl, method: .post, parameters: params, encoding: JSONEncoding.default, headers: headers).response { res in
        switch res.response?.statusCode {
            // do work with response data

        }
    }
}

curious if anyone can offer any ideas to make this better and or if this will work as expected.
I am using alamo fire for network requests.


问:
Elasticsearch - generating nested field from foreach expression using grok
I am creating an ingest pipeline to generate a nested field called "information_nested" (elasticsearch version 6.8). The minimal working example is the following.

Sample input:

```<code>"info": Information: [Books:0    Pencils:387    Pens:8, Books:15    Pencils:3147    Pens:8, Books:0    Pencils:3    Pens:845] end.
</code>```

Desired output:

```<code>information_nested : {
  {
   Books: 0,
   Pencils: 387,
   Pens: 8
  },
  {
   Books: 15,
   Pencils: 3147,
   Pens: 8
  },
  {
   Books: 0,
   Pencils: 3,
   Pens: 845
  }
}
</code>```

Here is what I tried so far:

```<code>PUT _ingest/pipeline/info_pipeline
{
  "description": "",
  "processors": [
    {
      "grok": {
        "field": "_source.info",
        "patterns": [
          "Information: \\[%{DATA:information}\\] end"
        ]
      }
    },
    {
      "split": {
        "field": "information",
        "separator": ", "
      }
    },
    {
      "foreach": {
        "field": "information",
        "processor": {
          "grok": {
            "field": "_ingest._value",
            "patterns": [
              "Books:%{NUMBER:books:int}\\tPencils:%{NUMBER:pencils}\\tPens:%{NUMBER:pens}"
            ]
          }
        }
      }
    },
    {
      "remove": {
        "field": "information"
      }
    },
    {
      "set": {
        "field": "information_nested",
        "value": [
          {
            "books": "{{books}}",
            "pencils": "{{pencils}}",
            "pens": "{{pens}}"
          }
        ]
      }
    }
  ]
}
</code>```

The problem is that I only get the last item in the nested field "information_nested".

I know that this is due to the foreach but I don't know how to solve it.

Body:
I am creating an ingest pipeline to generate a nested field called "information_nested" (elasticsearch version 6.8). The minimal working example is the following.

Sample input:

"info": Information: [Books:0    Pencils:387    Pens:8, Books:15    Pencils:3147    Pens:8, Books:0    Pencils:3    Pens:845] end.

Desired output:

information_nested : {
  {
   Books: 0,
   Pencils: 387,
   Pens: 8
  },
  {
   Books: 15,
   Pencils: 3147,
   Pens: 8
  },
  {
   Books: 0,
   Pencils: 3,
   Pens: 845
  }
}

Here is what I tried so far:

PUT _ingest/pipeline/info_pipeline
{
  "description": "",
  "processors": [
    {
      "grok": {
        "field": "_source.info",
        "patterns": [
          "Information: \\[%{DATA:information}\\] end"
        ]
      }
    },
    {
      "split": {
        "field": "information",
        "separator": ", "
      }
    },
    {
      "foreach": {
        "field": "information",
        "processor": {
          "grok": {
            "field": "_ingest._value",
            "patterns": [
              "Books:%{NUMBER:books:int}\\tPencils:%{NUMBER:pencils}\\tPens:%{NUMBER:pens}"
            ]
          }
        }
      }
    },
    {
      "remove": {
        "field": "information"
      }
    },
    {
      "set": {
        "field": "information_nested",
        "value": [
          {
            "books": "{{books}}",
            "pencils": "{{pencils}}",
            "pens": "{{pens}}"
          }
        ]
      }
    }
  ]
}

The problem is that I only get the last item in the nested field "information_nested".

I know that this is due to the foreach but I don't know how to solve it.


问:
How does ui.tabs.stretchyTabs.js Library work in jquery?
I am using ui.tabs.stretchyTabs.jslibrary but I can't use it properly.
Its sample code is as follows:

Tab 1

Tab 2

Tab 3

Content 1

Content 2

Content 3

$( ".tabpanel" ).tabs({
  closable: true,
  addTab:true
}).tabs('stretchyTabs')
.find( ".ui-tabs-nav" ).sortable({
  distance: 10
});
```
<p>Now I want to enter a tab with the properties I want when the button is clicked</p>
<p>This is my code :</p>
<pre class="lang-js prettyprint-override"><code>var tb = $(".tabpanel").tabs({
    closable: true,
    addTab: true,
}).tabs('stretchyTabs')
$('.addTab').on('click', (e) => {
    tb.tabs("add", "sample tab", "content goes here");
})
</code>```

But after clicking on the button 2 tabs are created.
Can you help me?

Body:
I am using ui.tabs.stretchyTabs.jslibrary but I can't use it properly.
Its sample code is as follows:

Tab 1

Tab 2

Tab 3

Content 1

Content 2

Content 3

$( ".tabpanel" ).tabs({
  closable: true,
  addTab:true
}).tabs('stretchyTabs')
.find( ".ui-tabs-nav" ).sortable({
  distance: 10
});

Now I want to enter a tab with the properties I want when the button is clicked

This is my code :

var tb = $(".tabpanel").tabs({
    closable: true,
    addTab: true,
}).tabs('stretchyTabs')
$('.addTab').on('click', (e) => {
    tb.tabs("add", "sample tab", "content goes here");
})

But after clicking on the button 2 tabs are created.
Can you help me?


问:
Running concurrent code on the current thread
I am trying to run concurrent C# code on a single thread.

My goal is to call two or more functions simultaneously. Those functions consist in a long treatment which is not CPU-bound, i.e., fetching data from a database. I would like to start executing those functions at the same moment so that they all reach the point when they call (synchronously) a deeper part of the backend and "wait" for the backend's result (which can take up to several seconds). Those functions are not dependant on one another.

My work environment is very restricted and I cannot write code which could lead to spawning additional threads, and I am provided with synchronous functions which execute a database fetch by waiting until it's finished.

I've tried searching for a similar problem and could only find one post which relates. Most searches revolved around Tasks, custom thread pools and custom job scheduler.

Does anybody have a solution to my initial problem, and/or can anybody confirm whether it's even possible in C# to dispatch slices of execution time between several functions on the same thread the way an operating system round-robin scheduler would?

To illustrate with tasks, the expected behaviour would be to start all three tasks at the same time to reach the Thead.Sleep(1000) instruction as soon as possible, the difference being that the sleeping timer would tick whether the enclosing task is active or not.

    public static void Main()
    {
        var task1 = new Task(() =>
        {
            Console.WriteLine("Task {0} (syncTask) executing on Thread {1}", Task.CurrentId, Thread.CurrentThread.ManagedThreadId);
            Thread.Sleep(1000); // this would be the backend call, which would resolve in about one second whether this code actively waits for it or not
            Console.WriteLine("Task {0} (syncTask) executing on Thread {1}", Task.CurrentId, Thread.CurrentThread.ManagedThreadId);
        });
        var task2 = new Task(() =>
        {
            Console.WriteLine("Task {0} (syncTask) executing on Thread {1}", Task.CurrentId, Thread.CurrentThread.ManagedThreadId);
            Thread.Sleep(1000); // this would be the backend call, which would resolve in about one second whether this code actively waits for it or not
            Console.WriteLine("Task {0} (syncTask) executing on Thread {1}", Task.CurrentId, Thread.CurrentThread.ManagedThreadId);
        });
        var task3 = new Task(() =>
        {
            Console.WriteLine("Task {0} (syncTask) executing on Thread {1}", Task.CurrentId, Thread.CurrentThread.ManagedThreadId);
            Thread.Sleep(1000); // this would be the backend call, which would resolve in about one second whether this code actively waits for it or not
            Console.WriteLine("Task {0} (syncTask) executing on Thread {1}", Task.CurrentId, Thread.CurrentThread.ManagedThreadId);
        });
        // note: comment out either method 1 or method 2
        // method 1: is single threaded but synchronous
        task1.RunSynchronously();
        task2.RunSynchronously();
        task3.RunSynchronously();
        // method 2: is async but multithreaded
        task1.Start();
        task2.Start();
        task3.Start();
    }
```


问:
How to Save selected radio button value into custom object from Visualforce page
Need to save the selected radio button value into custom object.

enter image description here

`
If I select "Excellent" radio button and click submit button. Need to save Excellent value into custom object. But my code is not save the value into custom object. Below is my code and please suggest where i am doing wrong.

VF Code:

```<code><apex:page  controller="RadioBtn_table_Apex" showHeader="false" applyHtmlTag="true" applyBodyTag="false">
<style>
    .fswrapper{
            width:800px;
            margin:0 auto;
            border:3CCF4E 30px;
        }

    .headerTitle
        {
            font-family:arial,sans-serif;
            font-size:16px;
            font-weight:600;
            color: #fff!important;
            text-align:left;
            text-transform:UPPERCASE;
            background:#4e75a3;
            Padding:10px;
            display:block;
            margin:0;

        }

    input[type=radio] {margin-left: 40px;}
    .radioClass {margin-left: 5%;}

    .big {line-height: 2.8;}

</style>
    <apex:form styleClass="fswrapper" id="frm">
        <head>
            <apex:slds />
        </head>
        <center>
            <img src="{!$Resource.ForceDotCom}"/>
        </center>
        <apex:pageBlock >
            <h1 class="headerTitle"> Application Feedback </h1>
                 <apex:pageBlockButtons location="bottom">
                      <apex:commandButton value="Submit" action="{!savefeedback}" reRender="frm"/>
                      <apex:commandButton value="Exit" action="{!feedbackexit}" reRender="frm"/>
                 </apex:pageBlockButtons>

            <apex:actionRegion >

                <Table width="100%" border="0" cellpadding="0" cellspacing="0" columns="0" >
                    <tr >
                        <td colspan="5" class="fieldLabel">
                            <p style="font-size: 20px;">
                               <b> How likely are you with our Application </b>
                            </p>

                            <!--<apex:selectRadio id="selectRb" value="{!selectedAnswer}" immediate="true"> -->
                            <apex:selectRadio id="selectRb" value="{!ratobj.Application_Rating__c}">
                                <apex:selectOption value="{!items}"/>
                            </apex:selectRadio>

                        </td>
                     </tr>
                 </Table>
           </apex:actionRegion>
        </apex:pageBlock>
    </apex:form>
</apex:page>
</code>```

APEX Code :

```<code>public  class RadioBtn_table_Apex
{

    public RB_Rating__c ratobj{get;set;}
    public string SelectedAnswer {get;set;}

    public RadioBtn_table_Apex()
    {
      ratobj = new RB_Rating__c();
    }

    public pagereference savefeedback()
    {

        insert ratobj;

       return Auth.SessionManagement.FinishLoginflow('/'+ratobj.Id);
    }

    public List<SelectOption> getItems() {
    List<SelectOption> options = new List<SelectOption>();
    options.add(new SelectOption('Excellent','Excellent'));
    options.add(new SelectOption('Great','Great'));
    options.add(new SelectOption('Good','Good'));
    options.add(new SelectOption('Medium','Medium'));
    options.add(new SelectOption('Poor','Poor'));
    options.add(new SelectOption('Very Bad','Very Bad'));
    return options;
}

    public pagereference feedbackexit()
    {

       return Auth.SessionManagement.FinishLoginflow('/');
    }

}
</code>```

Please suggest and where i am doing wrong.

Thanks

```<code>

i am trying to save my selected radio button values into custom object
</code>```

Body:
Need to save the selected radio button value into custom object.

enter image description here

`
If I select "Excellent" radio button and click submit button. Need to save Excellent value into custom object. But my code is not save the value into custom object. Below is my code and please suggest where i am doing wrong.

VF Code:

<apex:page  controller="RadioBtn_table_Apex" showHeader="false" applyHtmlTag="true" applyBodyTag="false">

    <apex:form styleClass="fswrapper" id="frm">

            <apex:slds />

        <apex:pageBlock >

 Application Feedback

                 <apex:pageBlockButtons location="bottom">
                      <apex:commandButton value="Submit" action="{!savefeedback}" reRender="frm"/>
                      <apex:commandButton value="Exit" action="{!feedbackexit}" reRender="frm"/>
                 </apex:pageBlockButtons>

            <apex:actionRegion >

                                How likely are you with our Application

                            <apex:selectRadio id="selectRb" value="{!ratobj.Application_Rating__c}">
                                <apex:selectOption value="{!items}"/>
                            </apex:selectRadio>

           </apex:actionRegion>
        </apex:pageBlock>
    </apex:form>
</apex:page>

APEX Code :

public  class RadioBtn_table_Apex
{

    public RB_Rating__c ratobj{get;set;}
    public string SelectedAnswer {get;set;}

    public RadioBtn_table_Apex()
    {
      ratobj = new RB_Rating__c();
    }

    public pagereference savefeedback()
    {

        insert ratobj;

       return Auth.SessionManagement.FinishLoginflow('/'+ratobj.Id);
    }

    public List<SelectOption> getItems() {
    List<SelectOption> options = new List<SelectOption>();
    options.add(new SelectOption('Excellent','Excellent'));
    options.add(new SelectOption('Great','Great'));
    options.add(new SelectOption('Good','Good'));
    options.add(new SelectOption('Medium','Medium'));
    options.add(new SelectOption('Poor','Poor'));
    options.add(new SelectOption('Very Bad','Very Bad'));
    return options;
}

    public pagereference feedbackexit()
    {

       return Auth.SessionManagement.FinishLoginflow('/');
    }

}

Please suggest and where i am doing wrong.

Thanks

i am trying to save my selected radio button values into custom object


问:
Solved* Waitpid (unix) modifying other processes status in a loop if the process it checks is finished
So I wanna create a loop that checks all the processes stored in a list and prints information about them, the most important thing is their status.

It works normally, but the problem comes when a process is finished, it shows up on the list but the processes that come after it show they were finished as well even if they weren't.

I think it might be something about the status variable, maybe I gotta reset it somehow, i've tried doing it with a pointer and then freeing it but it had the same outcome. It only happens with finished and not with stopped or signaled though.

This is the function:

```<code>void cmdListJobs(){
    int i;
    int status; //No borrar más de aquí
    int pid;

    for(i=0;i<nprocesos;i++){
        printf("--- El pid de histprocesoelemento es %d\n",HistProcesosElemento(i)->PID);
        pid=waitpid(HistProcesosElemento(i)->PID,&status,WNOHANG| WUNTRACED| WCONTINUED);
        printf("----waitpid es %d y senal es %d\n",pid,HistProcesosElemento(i)->senal);

        if(strcmp("FINISHED",HistProcesosElemento(i)->status)!=0 && pid != -1){
            if(WIFEXITED(status)){
                strcpy(HistProcesosElemento(i)->status,"FINISHED");
                HistProcesos[i]->prioridad=-1;
                printf("Terminado con WIFEXITED(status)=%d\n",WIFEXITED(status));
            }else if(WIFSIGNALED(status) && (pid!=0 || HistProcesosElemento(i)->senal !=0)){
                printf("Entra\n");
                if(WTERMSIG(status)<=31){
                    strcpy(HistProcesosElemento(i)->status,"SIGNALED");
                    HistProcesos[i]->prioridad=-1;
                    HistProcesosElemento(i)->senal=WTERMSIG(status);
                    printf("----senal es %d\n",HistProcesosElemento(i)->senal);
                    printf("Terminado con WIFSIGNALED(status)=%d\n",WIFSIGNALED(status));
                }
            }else if(WIFSTOPPED(status)){
                strcpy(HistProcesosElemento(i)->status,"STOPPED");
                HistProcesosElemento(i)->senal=WSTOPSIG(status);
                printf("----senal es %d\n",HistProcesosElemento(i)->senal);
                printf("Terminado con WIFSTOPPED(status)=%d\n",WIFSTOPPED(status));
            }else if(HistProcesosElemento(i)->senal==0 && pid==0){
                strcpy(HistProcesosElemento(i)->status,"ACTIVE");
            }
        }

        printf("Status es %d\n",status);
        if(HistProcesosElemento(i)->senal!=0){
            printf("%d \t %s p=%d  %s  %d  %d:%02d  %s  (%s)  %s\n",HistProcesosElemento(i)->PID,HistProcesosElemento(i)->usuario, HistProcesos[i]->prioridad,nombreMes(HistProcesosElemento(i)->month), HistProcesosElemento(i)->dia, HistProcesosElemento(i)->hora, HistProcesosElemento(i)->min, HistProcesosElemento(i)->status, NombreSenal(HistProcesosElemento(i)->senal),HistProcesosElemento(i)->nombre);
        }else printf("%d \t %s p=%d  %s  %d  %d:%02d  %s  (%03d)  %s\n",HistProcesosElemento(i)->PID,HistProcesosElemento(i)->usuario, HistProcesos[i]->prioridad,nombreMes(HistProcesosElemento(i)->month), HistProcesosElemento(i)->dia, HistProcesosElemento(i)->hora, HistProcesosElemento(i)->min, HistProcesosElemento(i)->status, HistProcesosElemento(i)->senal,HistProcesosElemento(i)->nombre);
    }

}
</code>```

I tried using pointers and freeing the status variable but it didn't work out, it keeps making processes after the finished one show as finished, while they're not.

Solved: I had to assign status to the result of the macro it entered

Body:
So I wanna create a loop that checks all the processes stored in a list and prints information about them, the most important thing is their status.

It works normally, but the problem comes when a process is finished, it shows up on the list but the processes that come after it show they were finished as well even if they weren't.

I think it might be something about the status variable, maybe I gotta reset it somehow, i've tried doing it with a pointer and then freeing it but it had the same outcome. It only happens with finished and not with stopped or signaled though.

This is the function:

void cmdListJobs(){
    int i;
    int status; //No borrar más de aquí
    int pid;

    for(i=0;i<nprocesos;i++){
        printf("--- El pid de histprocesoelemento es %d\n",HistProcesosElemento(i)->PID);
        pid=waitpid(HistProcesosElemento(i)->PID,&status,WNOHANG| WUNTRACED| WCONTINUED);
        printf("----waitpid es %d y senal es %d\n",pid,HistProcesosElemento(i)->senal);

        if(strcmp("FINISHED",HistProcesosElemento(i)->status)!=0 && pid != -1){
            if(WIFEXITED(status)){
                strcpy(HistProcesosElemento(i)->status,"FINISHED");
                HistProcesos[i]->prioridad=-1;
                printf("Terminado con WIFEXITED(status)=%d\n",WIFEXITED(status));
            }else if(WIFSIGNALED(status) && (pid!=0 || HistProcesosElemento(i)->senal !=0)){
                printf("Entra\n");
                if(WTERMSIG(status)<=31){
                    strcpy(HistProcesosElemento(i)->status,"SIGNALED");
                    HistProcesos[i]->prioridad=-1;
                    HistProcesosElemento(i)->senal=WTERMSIG(status);
                    printf("----senal es %d\n",HistProcesosElemento(i)->senal);
                    printf("Terminado con WIFSIGNALED(status)=%d\n",WIFSIGNALED(status));
                }
            }else if(WIFSTOPPED(status)){
                strcpy(HistProcesosElemento(i)->status,"STOPPED");
                HistProcesosElemento(i)->senal=WSTOPSIG(status);
                printf("----senal es %d\n",HistProcesosElemento(i)->senal);
                printf("Terminado con WIFSTOPPED(status)=%d\n",WIFSTOPPED(status));
            }else if(HistProcesosElemento(i)->senal==0 && pid==0){
                strcpy(HistProcesosElemento(i)->status,"ACTIVE");
            }
        }

        printf("Status es %d\n",status);
        if(HistProcesosElemento(i)->senal!=0){
            printf("%d \t %s p=%d  %s  %d  %d:%02d  %s  (%s)  %s\n",HistProcesosElemento(i)->PID,HistProcesosElemento(i)->usuario, HistProcesos[i]->prioridad,nombreMes(HistProcesosElemento(i)->month), HistProcesosElemento(i)->dia, HistProcesosElemento(i)->hora, HistProcesosElemento(i)->min, HistProcesosElemento(i)->status, NombreSenal(HistProcesosElemento(i)->senal),HistProcesosElemento(i)->nombre);
        }else printf("%d \t %s p=%d  %s  %d  %d:%02d  %s  (%03d)  %s\n",HistProcesosElemento(i)->PID,HistProcesosElemento(i)->usuario, HistProcesos[i]->prioridad,nombreMes(HistProcesosElemento(i)->month), HistProcesosElemento(i)->dia, HistProcesosElemento(i)->hora, HistProcesosElemento(i)->min, HistProcesosElemento(i)->status, HistProcesosElemento(i)->senal,HistProcesosElemento(i)->nombre);
    }

}

I tried using pointers and freeing the status variable but it didn't work out, it keeps making processes after the finished one show as finished, while they're not.

Solved: I had to assign status to the result of the macro it entered


问:
how to use request module to handle cloudflare "checking if connection to site is secure"
I get 403 status code because i have to do a checkbox verification from cloudflare security middleware. How can I tell cloudflare that I am secure ?

```<code> url.net needs to review the security of your connection before proceeding.
</code>```

I know i need to have a session for that, or use some cookie handler, or whatever it does really. Can somebody give me insight ?

```<code>const request = require('request')
var fs = require('fs')
// Request URL

var url = 'https://www.url.net/';

request(url, (error, response, body)=>{

      // Printing the error if occurred
    if(error) console.log(error)

      // Printing status code
    console.log(response.statusCode);

    fs.writeFile("index.html", body, (err) => {
      if (err)
        console.log(err);
      else {
        console.log("File written successfully\n");
        console.log("The written has the following contents:");
        console.log(fs.readFileSync("index.html", "utf8"));
      }
    });
      // Printing body
    console.log(body);
});
</code>```

Body:
I get 403 status code because i have to do a checkbox verification from cloudflare security middleware. How can I tell cloudflare that I am secure ?

 url.net needs to review the security of your connection before proceeding.

I know i need to have a session for that, or use some cookie handler, or whatever it does really. Can somebody give me insight ?

const request = require('request')
var fs = require('fs')
// Request URL

var url = 'https://www.url.net/';

request(url, (error, response, body)=>{

      // Printing the error if occurred
    if(error) console.log(error)

      // Printing status code
    console.log(response.statusCode);

    fs.writeFile("index.html", body, (err) => {
      if (err)
        console.log(err);
      else {
        console.log("File written successfully\n");
        console.log("The written has the following contents:");
        console.log(fs.readFileSync("index.html", "utf8"));
      }
    });
      // Printing body
    console.log(body);
});


问:
How can I fill google map markers ? flutter, custom icon
enter image description here
enter image description here

It looks like this. The center is supposed to be filled with white, but it's transparent.
How can I fill this marker?

I used this code. It's from this link.

I wanted to set the marker's color to black.
So I used this code.

`

```<code>import 'dart:math';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

class MarkerGenerator {
  final _markerSize;
  double _circleStrokeWidth = 0;
  double _circleOffset = 0;
  double _outlineCircleWidth = 0;
  double _fillCircleWidth = 0;
  double _iconSize = 0;
  double _iconOffset = 0;

  MarkerGenerator(this._markerSize) {
    // calculate marker dimensions
    _circleStrokeWidth = _markerSize / 10.0;
    _circleOffset = _markerSize / 2;
    _outlineCircleWidth = _circleOffset - (_circleStrokeWidth / 2);
    _fillCircleWidth = _markerSize / 3;
    final outlineCircleInnerWidth = _markerSize - (2 * _circleStrokeWidth);
    _iconSize = sqrt(pow(outlineCircleInnerWidth, 2) / 2);
    final rectDiagonal = sqrt(2 * pow(_markerSize, 2));
    final circleDistanceToCorners =
        (rectDiagonal - outlineCircleInnerWidth) / 2;
    _iconOffset = sqrt(pow(circleDistanceToCorners, 2) / 2);
  }

  /// Creates a BitmapDescriptor from an IconData
  Future<BitmapDescriptor> createBitmapDescriptorFromIconData(IconData iconData,
      Color iconColor, Color circleColor, Color backgroundColor) async {
    final pictureRecorder = PictureRecorder();
    final canvas = Canvas(pictureRecorder);

    // _paintCircleFill(canvas, backgroundColor);
    // _paintCircleStroke(canvas, circleColor);
    _paintIcon(canvas, iconColor, iconData);

    final picture = pictureRecorder.endRecording();
    final image =
        await picture.toImage(_markerSize.round(), _markerSize.round());
    final bytes = await image.toByteData(format: ImageByteFormat.png);

    return BitmapDescriptor.fromBytes(bytes!.buffer.asUint8List());
  }

  /// Paints the icon background
  void _paintCircleFill(Canvas canvas, Color color) {
    final paint = Paint()
      ..style = PaintingStyle.fill
      ..color = color;
    canvas.drawCircle(
        Offset(_circleOffset, _circleOffset), _fillCircleWidth, paint);
  }

  /// Paints a circle around the icon
  void _paintCircleStroke(Canvas canvas, Color color) {
    final paint = Paint()
      ..style = PaintingStyle.stroke
      ..color = color
      ..strokeWidth = _circleStrokeWidth;
    canvas.drawCircle(
        Offset(_circleOffset, _circleOffset), _outlineCircleWidth, paint);
  }

  /// Paints the icon
  void _paintIcon(Canvas canvas, Color color, IconData iconData) {
    final textPainter = TextPainter(textDirection: TextDirection.ltr);
    textPainter.text = TextSpan(
        text: String.fromCharCode(iconData.codePoint),
        style: TextStyle(
          letterSpacing: 0.0,
          fontSize: _markerSize,
          fontFamily: iconData.fontFamily,
          color: color,
        ));
    textPainter.layout();
    // textPainter.paint(canvas, Offset(_iconOffset, _iconOffset));
    textPainter.paint(canvas, Offset.zero);
  }
}

</code>```

`

I would like to fill in the marker.

Body:
enter image description here
enter image description here

It looks like this. The center is supposed to be filled with white, but it's transparent.
How can I fill this marker?

I used this code. It's from this link.

I wanted to set the marker's color to black.
So I used this code.

`

import 'dart:math';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

class MarkerGenerator {
  final _markerSize;
  double _circleStrokeWidth = 0;
  double _circleOffset = 0;
  double _outlineCircleWidth = 0;
  double _fillCircleWidth = 0;
  double _iconSize = 0;
  double _iconOffset = 0;

  MarkerGenerator(this._markerSize) {
    // calculate marker dimensions
    _circleStrokeWidth = _markerSize / 10.0;
    _circleOffset = _markerSize / 2;
    _outlineCircleWidth = _circleOffset - (_circleStrokeWidth / 2);
    _fillCircleWidth = _markerSize / 3;
    final outlineCircleInnerWidth = _markerSize - (2 * _circleStrokeWidth);
    _iconSize = sqrt(pow(outlineCircleInnerWidth, 2) / 2);
    final rectDiagonal = sqrt(2 * pow(_markerSize, 2));
    final circleDistanceToCorners =
        (rectDiagonal - outlineCircleInnerWidth) / 2;
    _iconOffset = sqrt(pow(circleDistanceToCorners, 2) / 2);
  }

  /// Creates a BitmapDescriptor from an IconData
  Future<BitmapDescriptor> createBitmapDescriptorFromIconData(IconData iconData,
      Color iconColor, Color circleColor, Color backgroundColor) async {
    final pictureRecorder = PictureRecorder();
    final canvas = Canvas(pictureRecorder);

    // _paintCircleFill(canvas, backgroundColor);
    // _paintCircleStroke(canvas, circleColor);
    _paintIcon(canvas, iconColor, iconData);

    final picture = pictureRecorder.endRecording();
    final image =
        await picture.toImage(_markerSize.round(), _markerSize.round());
    final bytes = await image.toByteData(format: ImageByteFormat.png);

    return BitmapDescriptor.fromBytes(bytes!.buffer.asUint8List());
  }

  /// Paints the icon background
  void _paintCircleFill(Canvas canvas, Color color) {
    final paint = Paint()
      ..style = PaintingStyle.fill
      ..color = color;
    canvas.drawCircle(
        Offset(_circleOffset, _circleOffset), _fillCircleWidth, paint);
  }

  /// Paints a circle around the icon
  void _paintCircleStroke(Canvas canvas, Color color) {
    final paint = Paint()
      ..style = PaintingStyle.stroke
      ..color = color
      ..strokeWidth = _circleStrokeWidth;
    canvas.drawCircle(
        Offset(_circleOffset, _circleOffset), _outlineCircleWidth, paint);
  }

  /// Paints the icon
  void _paintIcon(Canvas canvas, Color color, IconData iconData) {
    final textPainter = TextPainter(textDirection: TextDirection.ltr);
    textPainter.text = TextSpan(
        text: String.fromCharCode(iconData.codePoint),
        style: TextStyle(
          letterSpacing: 0.0,
          fontSize: _markerSize,
          fontFamily: iconData.fontFamily,
          color: color,
        ));
    textPainter.layout();
    // textPainter.paint(canvas, Offset(_iconOffset, _iconOffset));
    textPainter.paint(canvas, Offset.zero);
  }
}

`

I would like to fill in the marker.


问:
In NEXT-AUTH session storage , When there is two logins required, then how to store two login details and two get both accounts access tokens?
In NEXT-AUTH session storage , When there is two logins required, then how to store two store two login details in next-auth session storage and how to get both accounts access tokens?

i need solution for this problem


问:
Check if the values in the first column of a dataframe contain the values in the second column with the same index in pandas
I would like to know if there is a method in pandas that could compare if a column contains the value on the same index from another column.

My attempt was df['col1'].str.contains(df['col2']), however it results in a TypeError: unhashable type: 'Series'

My desired outcome:

```<code># create sample dataframe
df = pd.DataFrame({'col1': ['test', 'foo', 'bar'],
                   'col2': ['st', 'qw', 'ar']})

# create boolean mask
mask = df['col1'].str.contains(df['col2'])

# apply mask to original dataframe and return new dataframe
df_filtered = df[mask]

print(df_filtered)

  col1  col2
0 test  st
2  bar  ar
</code>```

Body:
I would like to know if there is a method in pandas that could compare if a column contains the value on the same index from another column.

My attempt was df['col1'].str.contains(df['col2']), however it results in a TypeError: unhashable type: 'Series'

My desired outcome:

# create sample dataframe
df = pd.DataFrame({'col1': ['test', 'foo', 'bar'],
                   'col2': ['st', 'qw', 'ar']})

# create boolean mask
mask = df['col1'].str.contains(df['col2'])

# apply mask to original dataframe and return new dataframe
df_filtered = df[mask]

print(df_filtered)

  col1  col2
0 test  st
2  bar  ar


问:
How to turn off dateFormat on ExcelJS library
I am using ExcelJS in a TS file and I am trying to turn off the dateFormat. Similar to this question and this question, but I get an incorrect number of arguments exception when I do so.

```<code>await workbook.xlsx.readFile(filepath, {dateFormat: []});
</code>```

Does anyone have any tips on how to turn this off when using this library in TS? I keep getting inconsistent dates

Body:
I am using ExcelJS in a TS file and I am trying to turn off the dateFormat. Similar to this question and this question, but I get an incorrect number of arguments exception when I do so.

await workbook.xlsx.readFile(filepath, {dateFormat: []});

Does anyone have any tips on how to turn this off when using this library in TS? I keep getting inconsistent dates


问:
Orchestrate AWS Lambda functions for data preprocessing pipeline
I have the following ETL job to do using AWS services.

Input is a list of files that need to be processed.
For each file, several Lambdas are being invoked in a synchronous pipeline (e.g. each file needs to be downloaded from somewhere, then transformed etc.)
The whole pipeline needs to wait for all files to be processed in order to invoke next Lambda, which is used for analyzing all newly generated information.
That Lambda, will dictate the way all files will continue their processing.
The diagram is something like this:

I've seen that there are tools like AWS Step functions, AWS Glue, and this is to me very similar to a producer consumer problem so maybe SQS comes to play.

Anyway, what would be the best approach to build a pipeline like this?


问:
Stack dataframes vertically ignoring rows with duplicate timestamps
I have multiple pandas dataframes as follows:

```<code>import pandas as pd

# Create some dates
last_10 = pd.datetime.now().replace(microsecond=0) - pd.Timedelta('10H')

dates = pd.date_range(last_10, periods = 10, freq='H')

# Create first dataframe
N = 5
df1 = pd.DataFrame({'y': range(1, N + 1),'time': dates[0:N]})

# Create second dataframe with some overlap
df2 = pd.DataFrame({'y': range(1, N + 1),'time': dates[2:2+N]})

# Create a third dataframe
df3 = pd.DataFrame({'y': range(1, N + 1),'time': dates[5:5+N]})

</code>```

Now what I want to do is vertically stack these dataframes to create a single data frame but I do not want sdduplicate time stamps i.e. if the to with the given time value already exists, I would like to just skip it.

Is there some pandas syntax to achieve this?

Body:
I have multiple pandas dataframes as follows:

import pandas as pd

# Create some dates
last_10 = pd.datetime.now().replace(microsecond=0) - pd.Timedelta('10H')

dates = pd.date_range(last_10, periods = 10, freq='H')

# Create first dataframe
N = 5
df1 = pd.DataFrame({'y': range(1, N + 1),'time': dates[0:N]})

# Create second dataframe with some overlap
df2 = pd.DataFrame({'y': range(1, N + 1),'time': dates[2:2+N]})

# Create a third dataframe
df3 = pd.DataFrame({'y': range(1, N + 1),'time': dates[5:5+N]})

Now what I want to do is vertically stack these dataframes to create a single data frame but I do not want sdduplicate time stamps i.e. if the to with the given time value already exists, I would like to just skip it.

Is there some pandas syntax to achieve this?


问:
Using relative imports in vs code
I'm facing a conflict with importing and auto imports with VS Code.
This is my jsconfig.json

```<code>{
  "compilerOptions": {
    "target": "es5",
    "module": "esnext",
    "baseUrl": "src",
    "moduleResolution": "node",
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  }
}
</code>```

But when I do auto import, something like this is generated:

```<code>import AuthContainer from "app/containers/AuthContainer/AuthContainer.vue";
</code>```

This works well, when I hit ctr + click on the component it brings me to that component.
But I get an error from webpack:

```<code>https://gyazo.com/2b49123cdfefe268bdf1415eefa36496
</code>```

When I do this:

```<code>import AuthContainer from "@/app/containers/AuthContainer/AuthContainer.vue";
</code>```

The import works properly, but when I do ctr + click, it does not bring me to the component but the error is no longer there.
Any idea what is happening?

Title: Using relative imports in vs code

Body:
I'm facing a conflict with importing and auto imports with VS Code.
This is my jsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "esnext",
    "baseUrl": "src",
    "moduleResolution": "node",
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ]
  }
}

But when I do auto import, something like this is generated:

import AuthContainer from "app/containers/AuthContainer/AuthContainer.vue";

This works well, when I hit ctr + click on the component it brings me to that component.
But I get an error from webpack:

https://gyazo.com/2b49123cdfefe268bdf1415eefa36496

When I do this:

import AuthContainer from "@/app/containers/AuthContainer/AuthContainer.vue";

The import works properly, but when I do ctr + click, it does not bring me to the component but the error is no longer there.
Any idea what is happening?


问:
Django ORM: migrate composite foreign key to latest version of django
Have limited experience with django orm,

there is a project with legacy django version (2.2) and I need to migrate it to the latest one (4.1). Cannot understand, what is modern concept of something called CompositeForeignKey and CompositeOneToOneField, which was before imported from 3d party module django-composite-foreignkey (this module doesn't support django orm above version 2). So what I need is to create foreign key of multiple fields to another table. Below is example of existing definition of such composite key.

```<code>    from compositefk.fields import CompositeForeignKey
    ...

    # my model...
    study_country = CompositeForeignKey(
        'StudyCountry', on_delete=models.DO_NOTHING, to_fields={'study': 'study', 'country': 'country'}
    )
</code>```

Is there any simple way how to migrate such a code to new django orm?

p.s. any raw SQL cannot be a solution in my case for specific reasons.

Body:
Have limited experience with django orm,

there is a project with legacy django version (2.2) and I need to migrate it to the latest one (4.1). Cannot understand, what is modern concept of something called CompositeForeignKey and CompositeOneToOneField, which was before imported from 3d party module django-composite-foreignkey (this module doesn't support django orm above version 2). So what I need is to create foreign key of multiple fields to another table. Below is example of existing definition of such composite key.

    from compositefk.fields import CompositeForeignKey
    ...

    # my model...
    study_country = CompositeForeignKey(
        'StudyCountry', on_delete=models.DO_NOTHING, to_fields={'study': 'study', 'country': 'country'}
    )

Is there any simple way how to migrate such a code to new django orm?

p.s. any raw SQL cannot be a solution in my case for specific reasons.


问:
What is the point of using 'step_angle' and 'step_length' when making a function to draw an arc using Python turtle?
I am currently trying to work through thinkpython and I've come across this exercise which uses the turtle module to draw an arc, given radius and angle.

'Polyline' is a function which draws 'n' line segments (e.g. polyline(t, 5, 60, 72) draws a pentagon with 5 sides [line segments], each of length 60 pixels. The angle between each pair of sides is 72 degrees.

The 'arc' function calculates 'n' using int(arc_length / 4) + 1.

Why is 'n' equal to this? Further, it calculates a 'step_length' and a 'step_angle'. I am completely lost on what this means and what the significance of it is.

Any help would be appreciated.

Here are the functions:

```<code>def polyline(t, n, length, angle):
    """
    Draws n line segments.

    t: Turtle object
    n: number of line segments
    length: length of each segment
    angle: degrees between segments
    """
    for i in range(n):
        fd(t, length)
        lt(t, angle)

def arc(t, r, angle):
    """Draws an arc with the given radius and angle.

    t: Turtle
    r: radius
    angle: angle subtended by the arc, in degrees
    """
    arc_length = 2 * math.pi * r * abs(angle) / 360
    n = int(arc_length / 4) + 1
    step_length = arc_length / n
    step_angle = float(angle) / n

    # making a slight left turn before starting reduces
    # the error caused by the linear approximation of the arc
    lt(t, step_angle/2)
    polyline(t, n, step_length, step_angle)
    rt(t, step_angle/2)
</code>```

Body:
I am currently trying to work through thinkpython and I've come across this exercise which uses the turtle module to draw an arc, given radius and angle.

'Polyline' is a function which draws 'n' line segments (e.g. polyline(t, 5, 60, 72) draws a pentagon with 5 sides [line segments], each of length 60 pixels. The angle between each pair of sides is 72 degrees.

The 'arc' function calculates 'n' using int(arc_length / 4) + 1.

Why is 'n' equal to this? Further, it calculates a 'step_length' and a 'step_angle'. I am completely lost on what this means and what the significance of it is.

Any help would be appreciated.

Here are the functions:

def polyline(t, n, length, angle):
    """
    Draws n line segments.

    t: Turtle object
    n: number of line segments
    length: length of each segment
    angle: degrees between segments
    """
    for i in range(n):
        fd(t, length)
        lt(t, angle)

def arc(t, r, angle):
    """Draws an arc with the given radius and angle.

    t: Turtle
    r: radius
    angle: angle subtended by the arc, in degrees
    """
    arc_length = 2 * math.pi * r * abs(angle) / 360
    n = int(arc_length / 4) + 1
    step_length = arc_length / n
    step_angle = float(angle) / n

    # making a slight left turn before starting reduces
    # the error caused by the linear approximation of the arc
    lt(t, step_angle/2)
    polyline(t, n, step_length, step_angle)
    rt(t, step_angle/2)


问:
Flowchart - Logical test - reasoning
In the following problems, you are told something about the result, and you must determine what the contents of the boxes must have been in order to obtain that result.
In these problems, the expression [number in box X] is abbreviated as [X].
For example:
“Is [1] greater than [10]?”
Means:
“Is [number in box 1] greater than [number in box 10]?”

In each of the following problems, no two boxes contain the same number

enter image description here

I'm not sure if I understand this correctly.

To get to C:
Is [3] Greater than [1] > No > Is [2] Greater than [1] > Yes > End

To get to F:
Is [3] Greater than [1] > Yes > Is [2] Greater than [1] > Yes > Is [3] Greater than [2] > Yes > End

What I know:
2 > 1  3 > 2  3 > 1 2 > 1

Or in these boxes everytime I go down I have to assign different number because of instructions:

In each of the following problems, no two boxes contain the same number

Can anyone explain how to solve it like I'm 4 years old?
Thanks

I have tried AI, I have tried solving it, I have asked 4 of my friends that are programmers.

I don't understand how to answer these 2 questions

Eitherthe letter C orthe letter F is in box 4.
Which of the boxes 1, 2 and 3 cannot possiblycontain:
The largest number?
The smallest number?

Title: Flowchart - Logical test - reasoning


问:
The function navigator pop has an issue
```<code>TextField(
              onSubmitted: (data) async
              {
                cityName = data;
                WeatherSerivce service = WeatherSerivce();
                WeatherModel weather = await service.getWeatherService(cityName: cityName!);
                weatherData = weather;
                updateUi!();
                Navigator.of(context).pop(); //Here I should go pack to the previous screen but it doesn't work
              }
</code>```
<p>// I tried a lot on this issue and didn't get an idea to solve it</p>

Title: The function navigator pop has an issue

Body:
TextField(
              onSubmitted: (data) async
              {
                cityName = data;
                WeatherSerivce service = WeatherSerivce();
                WeatherModel weather = await service.getWeatherService(cityName: cityName!);
                weatherData = weather;
                updateUi!();
                Navigator.of(context).pop(); //Here I should go pack to the previous screen but it doesn't work
              }

// I tried a lot on this issue and didn't get an idea to solve it


问:
Tkinter UI Integration
I am currently developing a backup software with a GUI written in python. I designed all the gui in figma and then exported them. My question is if I can integrate this progress bar to update in real time according to the backup progress. Is it something that can be done?

Title: Tkinter UI Integration


问:
Numpy Polynomial Regression for 2D Data
I'm new to polynomial regression. I know that using numpy we can compute polynomial regression for 1D array (Like this). However, I get the following error when I apply numpy.poly1d(numpy.polyfit(x, y, 3)) when x is 2D array and Y is 1D array.

ValueError: Polynomial must be 1d only.

I have a dataset with N samples, each sample has 2 features and one label. I want to use numpy polynomial fit to make a model to predict labels using given 2 features of each sample.

Title: Numpy Polynomial Regression for 2D Data


问:
tuple error, no matching constructor for initialization of 'Stock'
iam making a stock market game but for some reason, this same exact error pops up every time, "/nix/store/dlni53myj53kx20pi4yhm7p68lw17b07-gcc-10.3.0/include/c++/10.3.0/tuple:1693:9: error: no matching constructor for initialization of 'Stock' "

no idea of what it means. this seems to be like a individual error, one that has a diffrent solution for everyone

i tried to do things like changing the void addStock  by removing the std::pair, didnt work. i don't no what to do, any solution?

btw heres the code:

#include <iostream>
#include <string>
#include <map>
#include <random>

// The Stock class represents a single stock in the market.
class Stock {
public:
  // Construct a new Stock with the given name and starting price.
  Stock(const std::string& name, double price)
    : name_(name), price_(price) {}

  // Get the name of the stock.
  std::string name() const { return name_; }

  // Get the current price of the stock.
  double price() const { return price_; }

  // Update the price of the stock based on a random change.
  void updatePrice() {
    // Generate a random number in the range [-0.1, 0.1].
    std::random_device rd;
    std::mt19937 gen(rd());
    std::uniform_real_distribution<> dis(-0.1, 0.1);
    double change = dis(gen);

    // Update the price of the stock by the random change.
    price_ += change;
  }

private:
  std::string name_;
  double price_;
};

// The Market class represents a collection of stocks.
class Market {
public:
  // Construct a new Market.
  Market() {}

  // Add a new stock to the market with the given name and starting price.
  void addStock(const std::string& name, double price) {
    stocks_[name] = Stock(name, price);
  }

  // Get a pointer to the stock with the given name.
  Stock* getStock(const std::string& name) {
    return &stocks_[name];
  }

  // Update the prices of all stocks in the market.
  void updatePrices() {
    for (auto& pair : stocks_) {
      pair.second.updatePrice();
    }
  }

  // A map from stock names to Stock objects.
  std::map<std::string, Stock> stocks_;
};

int main() {
  // Create a new market.
  Market market;

  // Add some stocks to the market.
  market.addStock("AAPL", 100.0);
  market.addStock("GOOG", 200.0);
  market.addStock("MSFT", 150.0);

  // Update the prices of the stocks in the market.
  market.updatePrices();

  // Print the current prices of the stocks.
  for (const auto& pair : market.stocks_) {
    std::cout << pair.second.name() << ": $" << pair.second.price() << std::endl;
  }

  return 0;
}
```


问:
crbug/1173575, non-JS module files deprecated. I believe chrome.runtime.getURL() is causing
I am building a google chrome extension in react. What I am trying to do now is that in the popup window there will be a button that when clicked, opens up a new panel window (an extension page) and in this page I will be displaying stuff and more buttons etc.

This error is coming from the button click to open new panel part. So I have the manifest.json link the default_popup to 'index.html' which is empty. (apart from the html5 skeleton)

I have my App.js file that holds all of the code for performing the above actions:
`

```<code>/*global chrome*/
import './App.css';
import React, { Component, useEffect, useRef } from 'react';

let createData = {
  //type: 'panel',
  width: 350,
  height: 500,
  url: chrome.runtime.getURL('./src/newPage.html')
}

function App() {

  const ref = useRef(null);

  useEffect(() => {
    const handleClick = event => {

      let creating = chrome.windows.create(createData);
      creating.then(() => {
        console.log("The detached panel has been created");
      })
    };

    const element = ref.current;

    element.addEventListener('click', handleClick);

    return () => {
      element.removeEventListener('click', handleClick);
    }
  }, []);

  return (
    <body>
      <div>
        <h1>Tester Extension</h1>
      </div>

      <div>
        <button ref={ref}>Click</button>
      </div>
    </body>
  );

export default App;
</code>```

`
newPage.html contains the layout of the extension page. however I get the "crbug/1173575, non-JS module files deprecated." in the console of the extension page and the following screen upon it opening

enter image description here

When I take away the url part of the following code
`

```<code>let createData = {
  //type: 'panel',
  width: 350,
  height: 500,
  url: chrome.runtime.getURL('./src/newPage.html')
}
</code>```

`
the error goes away but then I am not sure how to do what I want to.

I have looked through a bunch of the other posts with similar error message and tried all of the different fixes but nothing has worked apart from the solution just mentioned.

Any advice on moving forward would be great

Body:
I am building a google chrome extension in react. What I am trying to do now is that in the popup window there will be a button that when clicked, opens up a new panel window (an extension page) and in this page I will be displaying stuff and more buttons etc.

This error is coming from the button click to open new panel part. So I have the manifest.json link the default_popup to 'index.html' which is empty. (apart from the html5 skeleton)

I have my App.js file that holds all of the code for performing the above actions:
`

/*global chrome*/
import './App.css';
import React, { Component, useEffect, useRef } from 'react';

let createData = {
  //type: 'panel',
  width: 350,
  height: 500,
  url: chrome.runtime.getURL('./src/newPage.html')
}

function App() {

  const ref = useRef(null);

  useEffect(() => {
    const handleClick = event => {

      let creating = chrome.windows.create(createData);
      creating.then(() => {
        console.log("The detached panel has been created");
      })
    };

    const element = ref.current;

    element.addEventListener('click', handleClick);

    return () => {
      element.removeEventListener('click', handleClick);
    }
  }, []);

  return (

Tester Extension

        <button ref={ref}>Click</button>

  );

export default App;

`
newPage.html contains the layout of the extension page. however I get the "crbug/1173575, non-JS module files deprecated." in the console of the extension page and the following screen upon it opening

enter image description here

When I take away the url part of the following code
`

let createData = {
  //type: 'panel',
  width: 350,
  height: 500,
  url: chrome.runtime.getURL('./src/newPage.html')
}

`
the error goes away but then I am not sure how to do what I want to.

I have looked through a bunch of the other posts with similar error message and tried all of the different fixes but nothing has worked apart from the solution just mentioned.

Any advice on moving forward would be great


问:
Loading standalone service by mocking context json
Am using react js to display a standalone service by mocking a context json through globalStore, I get "globalStore is not a function" error messagethat happens from the provider component.

How can I be to pass my json data through globalStore as a function and not as an object.
My code
PrdUx.tsx

```<code>import {PrdProvider} from '../store/PrdProvider';
const PrdUx =- ({globalStore}: any) => {
return(
<PrdProvider globalStore={globalStore}>
<PrdUx />
</PrdProvider>
);
};
export default PrdUx;

</code>```

App.tsx

```<code>import PrdUx from './component/PrdUx';
import PrdUxMock from '../public/PrdUxMock.json';

const AppRouter = () => {
return (
<Routes>
<Route path='/test' element={PrdUx globalStore={PrdUxMock} />
</Routes>
);
};
</code>```

PrdProvider.tsx

```<code>export function PrdProvider({globalStore, children}: any){

const{context, updateAcc} = globalStore();
}
......
}
</code>```

I expect the   page to load properly with no error

Body:
Am using react js to display a standalone service by mocking a context json through globalStore, I get "globalStore is not a function" error messagethat happens from the provider component.

How can I be to pass my json data through globalStore as a function and not as an object.
My code
PrdUx.tsx

import {PrdProvider} from '../store/PrdProvider';
const PrdUx =- ({globalStore}: any) => {
return(
<PrdProvider globalStore={globalStore}>
<PrdUx />
</PrdProvider>
);
};
export default PrdUx;

App.tsx

import PrdUx from './component/PrdUx';
import PrdUxMock from '../public/PrdUxMock.json';

const AppRouter = () => {
return (
<Routes>
<Route path='/test' element={PrdUx globalStore={PrdUxMock} />
</Routes>
);
};

PrdProvider.tsx

export function PrdProvider({globalStore, children}: any){

const{context, updateAcc} = globalStore();
}
......
}

I expect the   page to load properly with no error


问:
Typo3 Upgrade 10.4 News Template/Layout not loading
I have updated my Typo3 Website from v. 9.5 to 10.4.32. Everything is working fine so far.

The Layout of the News Pluging is not working anymore.

This is these are the extension config files:

typo3conf/ext/news/Configuration/TypoScript/setup.txt

```<code># Important: This file is deprecated and will removed with EXT:news 10.x
@import 'EXT:news/Configuration/TypoScript/setup.typoscript'
</code>```

typo3conf/ext/news/Configuration/TypoScript/setup.typoscript

```<code>plugin.tx_news {
    mvc.callDefaultActionIfActionCantBeResolved = 1

    view {
        templateRootPaths {
            0 = EXT:news/Resources/Private/Templates/
            1 = {$plugin.tx_news.view.templateRootPath}
        }

        partialRootPaths {
            0 = EXT:news/Resources/Private/Partials/
            1 = {$plugin.tx_news.view.partialRootPath}
        }

        layoutRootPaths {
            0 = EXT:news/Resources/Private/Layouts/
            1 = {$plugin.tx_news.view.layoutRootPath}
        }

        widget.GeorgRinger\News\ViewHelpers\Widget\PaginateViewHelper.templateRootPath = EXT:news/Resources/Private/Templates/
    }}
</code>```

The News Extension is not using this templates. I think that typoscript has no effect.

What can be the problem? I am not a Typo3 guru so I am very glad if you can help.

Body:
I have updated my Typo3 Website from v. 9.5 to 10.4.32. Everything is working fine so far.

The Layout of the News Pluging is not working anymore.

This is these are the extension config files:

typo3conf/ext/news/Configuration/TypoScript/setup.txt

# Important: This file is deprecated and will removed with EXT:news 10.x
@import 'EXT:news/Configuration/TypoScript/setup.typoscript'

typo3conf/ext/news/Configuration/TypoScript/setup.typoscript

plugin.tx_news {
    mvc.callDefaultActionIfActionCantBeResolved = 1

    view {
        templateRootPaths {
            0 = EXT:news/Resources/Private/Templates/
            1 = {$plugin.tx_news.view.templateRootPath}
        }

        partialRootPaths {
            0 = EXT:news/Resources/Private/Partials/
            1 = {$plugin.tx_news.view.partialRootPath}
        }

        layoutRootPaths {
            0 = EXT:news/Resources/Private/Layouts/
            1 = {$plugin.tx_news.view.layoutRootPath}
        }

        widget.GeorgRinger\News\ViewHelpers\Widget\PaginateViewHelper.templateRootPath = EXT:news/Resources/Private/Templates/
    }}

The News Extension is not using this templates. I think that typoscript has no effect.

What can be the problem? I am not a Typo3 guru so I am very glad if you can help.


问:
Errors as Predefined type 'System.Object' is not defined or imported
I have upgraded ASP.Net MVC .net version from 4.6 to 4.8.  Everything runs fine I am able to build the project and use the app without any issue however I  am seeing thousands error throughout the project as  none of the library is not recognized.

Sorry this question was asked before but there is no solution to my issue.

Predefined type 'System.Object' is not defined or imported
Predefined type 'System.String' is not defined or imported
and there are errors for each line


问:
How to get Instant.now with time as zero?
The Instant.now(); gives 2022-12-14T22:55:56.055612600Z. But I would like to have output like this 2022-12-14T00:00:00.000Z. Meaning, I need instant to provide me with current date, but the time with all zeros. How can I achieve?


问:
I want to save and restore a mutableList or array in Kotlin
I have the following mutableList

```<code>val rowsSavedList = mutableListOf<Int>()

The data is lost when the app changes from portrait to landscape. I save the rest of my data using onSaveInstanceState and restore with onRestoreInstanceState Is there a way to do this with the mutableList.
</code>```

I have tried using onSaveInstanceState and onRestoreInstanceState but it does not work. Any help would be greatly appreciated.

Body:
I have the following mutableList

val rowsSavedList = mutableListOf<Int>()

The data is lost when the app changes from portrait to landscape. I save the rest of my data using onSaveInstanceState and restore with onRestoreInstanceState Is there a way to do this with the mutableList.

I have tried using onSaveInstanceState and onRestoreInstanceState but it does not work. Any help would be greatly appreciated.


问:
ggplot2: show single renamed legend for combined geom_path and geom_point plot
I have a connected scatterplot using geom_point and geom_path. I want the shapes of the points to be different based on one grouping variable, which is the same variable I'm using to connect the points with geom_path. I manually chose shapes using scale_shape_manual(). I want to show only one legend with the title "Sample".

I've tried doing this using labs(shape = "Sample"), but this forces both legends to be visible and only names the first one, which I do not want to show. Without this line I get the correct single legend, but it is not named. How can I only show the legend I want but still rename it?

My code with labs():

```<code>ggplot(great_hollow, aes(x = d15N, y = Sample_ordered), color = Species_ordered) +
  geom_path(aes(group = Species_ordered, colour = Species_ordered)) +
  geom_point(aes(shape = Species_ordered, fill = Species_ordered), colour = "black", size = 3) +
  scale_shape_manual(values = c(21, 22, 24, 21, 23, 25)) +
  labs(shape = "Sample") +
  facet_wrap(~Type, scales = "fixed") +
  ggtitle(expression(paste(delta^{15},"N Values by Site and Trophic Level"))) +
  scale_x_continuous(expression(paste(delta^{15}, "N (\u2030 VS air)"))) +
  scale_y_discrete(limits=rev) +
  theme_bw() +
  theme(plot.title = element_text(hjust = 0.5),
        axis.title.y = element_blank(),
        plot.background = element_rect(color = 1, linewidth = 1),
        plot.margin = margin(t = 10,
                             r = 10,
                             b = 10,
                             l = 10))
</code>```

The resulting plot:
Two legends, wrong one is named

My code without labs():

```<code>ggplot(great_hollow, aes(x = d15N, y = Sample_ordered), color = Species_ordered) +
  geom_path(aes(group = Species_ordered, colour = Species_ordered)) +
  geom_point(aes(shape = Species_ordered, fill = Species_ordered), colour = "black", size = 3) +
  scale_shape_manual(values = c(21, 22, 24, 21, 23, 25)) +
  facet_wrap(~Type, scales = "fixed") +
  ggtitle(expression(paste(delta^{15},"N Values by Site and Trophic Level"))) +
  scale_x_continuous(expression(paste(delta^{15}, "N (\u2030 VS air)"))) +
  scale_y_discrete(limits=rev) +
  theme_bw() +
  theme(plot.title = element_text(hjust = 0.5),
        axis.title.y = element_blank(),
        plot.background = element_rect(color = 1, linewidth = 1),
        plot.margin = margin(t = 10,
                             r = 10,
                             b = 10,
                             l = 10))
</code>```

The resulting plot:
Single legend, unnamed

I'm relatively new to R so any suggestions would be much appreciated!

Body:
I have a connected scatterplot using geom_point and geom_path. I want the shapes of the points to be different based on one grouping variable, which is the same variable I'm using to connect the points with geom_path. I manually chose shapes using scale_shape_manual(). I want to show only one legend with the title "Sample".

I've tried doing this using labs(shape = "Sample"), but this forces both legends to be visible and only names the first one, which I do not want to show. Without this line I get the correct single legend, but it is not named. How can I only show the legend I want but still rename it?

My code with labs():

ggplot(great_hollow, aes(x = d15N, y = Sample_ordered), color = Species_ordered) +
  geom_path(aes(group = Species_ordered, colour = Species_ordered)) +
  geom_point(aes(shape = Species_ordered, fill = Species_ordered), colour = "black", size = 3) +
  scale_shape_manual(values = c(21, 22, 24, 21, 23, 25)) +
  labs(shape = "Sample") +
  facet_wrap(~Type, scales = "fixed") +
  ggtitle(expression(paste(delta^{15},"N Values by Site and Trophic Level"))) +
  scale_x_continuous(expression(paste(delta^{15}, "N (\u2030 VS air)"))) +
  scale_y_discrete(limits=rev) +
  theme_bw() +
  theme(plot.title = element_text(hjust = 0.5),
        axis.title.y = element_blank(),
        plot.background = element_rect(color = 1, linewidth = 1),
        plot.margin = margin(t = 10,
                             r = 10,
                             b = 10,
                             l = 10))

The resulting plot:
Two legends, wrong one is named

My code without labs():

ggplot(great_hollow, aes(x = d15N, y = Sample_ordered), color = Species_ordered) +
  geom_path(aes(group = Species_ordered, colour = Species_ordered)) +
  geom_point(aes(shape = Species_ordered, fill = Species_ordered), colour = "black", size = 3) +
  scale_shape_manual(values = c(21, 22, 24, 21, 23, 25)) +
  facet_wrap(~Type, scales = "fixed") +
  ggtitle(expression(paste(delta^{15},"N Values by Site and Trophic Level"))) +
  scale_x_continuous(expression(paste(delta^{15}, "N (\u2030 VS air)"))) +
  scale_y_discrete(limits=rev) +
  theme_bw() +
  theme(plot.title = element_text(hjust = 0.5),
        axis.title.y = element_blank(),
        plot.background = element_rect(color = 1, linewidth = 1),
        plot.margin = margin(t = 10,
                             r = 10,
                             b = 10,
                             l = 10))

The resulting plot:
Single legend, unnamed

I'm relatively new to R so any suggestions would be much appreciated!


问:
how to keep my node app running even when there is an error up on request
I am fetching some data using intervals, sometimes i have multiple formats of data and i need to send request more than multiple times. Sometimes it gives error, like CONN CLOSED or ECONNRESET, but this is not the problem. My nodejs app stops executing when even it gets 1 error, but im dealing with 10s of requests, so that 1 error is not big problem for me and i want to keep my app running. How can I achieve this, I tried try catch but it didn't work as well. At the bottom you can see one of the logs as an example.

```<code>const request = require('request')
var fs = require('fs')
// Request URL

var url = 'url.net';

i = 0

async function sender(){
  try {
    request(url, (error, response, body)=>{

          // Printing the error if occurred
        if(error) console.log(error)

          // Printing status code
        console.log(response.statusCode + '-'.repeat(i));
        i++
        if(i == 20){
          i = 0
        }
          // Printing body
    });
  }
  catch (e) {

  }

}
</code>```

Here is how the program stops executing

```<code>StatusCode 200 receiving data
StatusCode 200 receiving data
StatusCode 200 receiving data

Error: read ECONNRESET
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20) {
  errno: -4077,
  code: 'ECONNRESET',
  syscall: 'read'
}
C:\Users\Lenovo\Documents\sendingReq\send.js:18
        console.log(response.statusCode + '-'.repeat(i));
                             ^

TypeError: Cannot read properties of undefined (reading 'statusCode')
    at Request._callback (C:\Users\Lenovo\Documents\sendingReq\send.js:18:30)
    at self.callback (C:\Users\Lenovo\Documents\sendingReq\node_modules\request\request.js:185:22)
    at Request.emit (node:events:513:28)
    at Request.onRequestError (C:\Users\Lenovo\Documents\sendingReq\node_modules\request\request.js:877:8)
    at ClientRequest.emit (node:events:513:28)
    at TLSSocket.socketErrorListener (node:_http_client:494:9)
    at TLSSocket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v18.12.1
</code>```

Body:
I am fetching some data using intervals, sometimes i have multiple formats of data and i need to send request more than multiple times. Sometimes it gives error, like CONN CLOSED or ECONNRESET, but this is not the problem. My nodejs app stops executing when even it gets 1 error, but im dealing with 10s of requests, so that 1 error is not big problem for me and i want to keep my app running. How can I achieve this, I tried try catch but it didn't work as well. At the bottom you can see one of the logs as an example.

const request = require('request')
var fs = require('fs')
// Request URL

var url = 'url.net';

i = 0

async function sender(){
  try {
    request(url, (error, response, body)=>{

          // Printing the error if occurred
        if(error) console.log(error)

          // Printing status code
        console.log(response.statusCode + '-'.repeat(i));
        i++
        if(i == 20){
          i = 0
        }
          // Printing body
    });
  }
  catch (e) {

  }

}

Here is how the program stops executing

StatusCode 200 receiving data
StatusCode 200 receiving data
StatusCode 200 receiving data

Error: read ECONNRESET
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20) {
  errno: -4077,
  code: 'ECONNRESET',
  syscall: 'read'
}
C:\Users\Lenovo\Documents\sendingReq\send.js:18
        console.log(response.statusCode + '-'.repeat(i));
                             ^

TypeError: Cannot read properties of undefined (reading 'statusCode')
    at Request._callback (C:\Users\Lenovo\Documents\sendingReq\send.js:18:30)
    at self.callback (C:\Users\Lenovo\Documents\sendingReq\node_modules\request\request.js:185:22)
    at Request.emit (node:events:513:28)
    at Request.onRequestError (C:\Users\Lenovo\Documents\sendingReq\node_modules\request\request.js:877:8)
    at ClientRequest.emit (node:events:513:28)
    at TLSSocket.socketErrorListener (node:_http_client:494:9)
    at TLSSocket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v18.12.1


问:
Goals and Unique Pageview don't match in GA3
I created a goal in Google Analytics and I'm using this regex (below) but when analyzing with the unique pages, the result is a little different:

paths:

```<code>/newshop/available/offers-shop
/newshopLC/available/offers-shop
/newshopLC/available/addons
</code>```

regex used in Goals:

```<code>\/(newshop|newshopLC)\/available\/(offers-shop|addons)
</code>```

I saw in some forums that the difference could be in the Page Title but we use a SPA shopping flow and we don't have a title in any pageview step. I believe the regex is incorrect somehow...

I have tried to change the regex but the difference persist. Maybe I'm doing something wrong...

Body:
I created a goal in Google Analytics and I'm using this regex (below) but when analyzing with the unique pages, the result is a little different:

paths:

/newshop/available/offers-shop
/newshopLC/available/offers-shop
/newshopLC/available/addons

regex used in Goals:

\/(newshop|newshopLC)\/available\/(offers-shop|addons)

I saw in some forums that the difference could be in the Page Title but we use a SPA shopping flow and we don't have a title in any pageview step. I believe the regex is incorrect somehow...

I have tried to change the regex but the difference persist. Maybe I'm doing something wrong...


问:
While installing BioSentVec I am getting an error for the ```make``` command: The system cannot find the file specified
I am trying to install BioSentVec but getting an error while running the make command. I am following the instructions in the answers to this question.  I will focus on the second answer, which is as follows:

```<code>wget https://github.com/epfml/sent2vec/archive/master.zip
unzip master.zip
cd sent2vec-master
make
sudo python3.7 -m pip install .
</code>```

However, I am getting the following error after running the third command:

```<code>c++ -pthread -std=c++0x -O3 -funroll-loops -c src/args.cc
process_begin: CreateProcess(NULL, c++ -pthread -std=c++0x -O3 -funroll-loops -c src/args.cc, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [Makefile:25: args.o] Error 2
</code>```

I am installing BioSentVec in an Anaconda environment.

Body:
I am trying to install BioSentVec but getting an error while running the make command. I am following the instructions in the answers to this question.  I will focus on the second answer, which is as follows:

wget https://github.com/epfml/sent2vec/archive/master.zip
unzip master.zip
cd sent2vec-master
make
sudo python3.7 -m pip install .

However, I am getting the following error after running the third command:

c++ -pthread -std=c++0x -O3 -funroll-loops -c src/args.cc
process_begin: CreateProcess(NULL, c++ -pthread -std=c++0x -O3 -funroll-loops -c src/args.cc, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [Makefile:25: args.o] Error 2

I am installing BioSentVec in an Anaconda environment.


问:
Using ROS2 Galactic with rclpy, cannot use empty lists as default value for parameters
I've been trying to declare a parameter using the following call:

```<code>self.declare_parameter(
    devices_param,
    [],
    ParameterDescriptor(
        description='Devices on %s output' % output.name,
        type=ParameterType.PARAMETER_STRING_ARRAY))
</code>```

The follow error occurs when I try to set the parameters through a config file:

rclpy.exceptions.InvalidParameterTypeException: Trying to set parameter 'outputs.5v.devices' to '['radio']' of type 'STRING_ARRAY', expecting type 'BYTE_ARRAY'

This error occurs because the ParameterDescriptor type is ignored, and instead the default value's type is inferred. Since BYTE_ARRAY is the first array type in the enum, it is chosen for an empty list.

I found an issue regarding this behavior with this proposed workaround:

```<code>param = Parameter('my_param', type_=Parameter.Type.STRING_ARRAY, value=[])
node.declare_parameter(param.name, param.get_parameter_value())
</code>```

However, this doesn't fix the problem. It does fix the issue of the type being inferred incorrectly, but the declare_parameter call ultimately fails. Looking into the source code, there doesn't seem to be a situation where this approach ever works since it tries to instantiate a new Parameter class using the ParameterValue from get_parameter_value, which isn't what Parameter's constructor is expecting.

I know I can use dynamic typing to get around this, but I am trying to maintain a degree of backwards compatibility to Foxy, which doesn't have the dynamic_typing flag (Foxy's default is to not use static types in parameters). Also, static typing with array types just doesn't work if this is working as intended, which seems unlikely.

Does anyone have a solution to using empty lists with parameters in Galactic?

Body:
I've been trying to declare a parameter using the following call:

self.declare_parameter(
    devices_param,
    [],
    ParameterDescriptor(
        description='Devices on %s output' % output.name,
        type=ParameterType.PARAMETER_STRING_ARRAY))

The follow error occurs when I try to set the parameters through a config file:

rclpy.exceptions.InvalidParameterTypeException: Trying to set parameter 'outputs.5v.devices' to '['radio']' of type 'STRING_ARRAY', expecting type 'BYTE_ARRAY'

This error occurs because the ParameterDescriptor type is ignored, and instead the default value's type is inferred. Since BYTE_ARRAY is the first array type in the enum, it is chosen for an empty list.

I found an issue regarding this behavior with this proposed workaround:

param = Parameter('my_param', type_=Parameter.Type.STRING_ARRAY, value=[])
node.declare_parameter(param.name, param.get_parameter_value())

However, this doesn't fix the problem. It does fix the issue of the type being inferred incorrectly, but the declare_parameter call ultimately fails. Looking into the source code, there doesn't seem to be a situation where this approach ever works since it tries to instantiate a new Parameter class using the ParameterValue from get_parameter_value, which isn't what Parameter's constructor is expecting.

I know I can use dynamic typing to get around this, but I am trying to maintain a degree of backwards compatibility to Foxy, which doesn't have the dynamic_typing flag (Foxy's default is to not use static types in parameters). Also, static typing with array types just doesn't work if this is working as intended, which seems unlikely.

Does anyone have a solution to using empty lists with parameters in Galactic?