问:
Angular custom libraries and ui-router-config
I am having trouble setting up an angular application which consumes two custom angular-libraries (which contain many components/services/configs which we moved there because we want to migrate to using libraries instead of copying code any time we need a new instance of our project for another client).

Library A, called "common-library", contains basic components (layout-components mainly, services etc.) and Library B is called "type-a-library" (for the sake of this example). Library B "type-a" has a dependency on "common" and the consumer-application, called "client-name", imports both libraries.

```<code>client-name
    |_ common-library
    |_ type-a-library
</code>```

The "main"-application "client-name", which uses these libraries, uses the ui-router-library for state-management. Before we moved everything into those two libraries we only had one single angular-application with all components etc.. It had a state-configuration via

```<code>    UIRouterModule.forRoot({
        states: APPLICATION_STATES,
        useHash: true,
        initial: {state: 'home'}
    })
</code>```

which was easy, because everything was inside the same application. But now, after switching to libraries, I am having trouble correctly setting up the states.

Our idea was that each library exports a list of states which are being merged in the "client-a"-consumer-application and then passed into its UIRouterModule.forRoot() function.

We have some abstract states for layout purposes, e.g.:

```<code>export const layoutState: Ng2StateDeclaration = {
    name: 'layout',
    abstract: true,
    component: CwpLayoutComponent
};

export const homeState: Ng2StateDeclaration = {
    name: 'layout.home',
    url: '/home',
    component: CwpHomePageComponent
};
</code>```

So if state "layout.home" is being called, it is being rendered into a <ui-view>-Tag inside its parent-state, "layout". Both example components, CwpLayoutComponent and CwpHomePageComponent, are inside the "type-a"-library.

How do I need to import the UIRouterModule into the LibraryModules? I mean the libraries don't set up states themselves but they do contain components which use the ui-view-Directive of UIRouter (for the nested states) and also contain Services which use the StateService so I guess I do have to import UIRouterModule here?

I tried "UIRouterModule", I tried UIRouterModule.forRoot(), I also tried UIRouterModule.forChild()... I tried UIRouterModule.forRoot() for the common-library and UIRouterModule.forChild() for the library "type-a"... I don't understand how these forRoot and forChild-functions work when using them in Angular-Libraries. I was under the impression that only the import in the app.module.ts of the main-application can use "forRoot()" and the libraries would need to use "forChild()" instead, but if I do that it tells me that it can't find a provider for the service called "StateService" which belongs to UIRouterModule if I try to render a state (coming from the state-list inside the library "type-a") which uses the StateService...

The project did start with the above configuration, but calling the state "layout.home" doesn't render the inner component "CwpHomePageComponent" but only the layout-"frame", coming from the abstract state "layout". For some reason it won't render the nested state anymore. I think my UIRouterModule-config isn't working when using it like I do, but what am I doing wrong?

Body:
I am having trouble setting up an angular application which consumes two custom angular-libraries (which contain many components/services/configs which we moved there because we want to migrate to using libraries instead of copying code any time we need a new instance of our project for another client).

Library A, called "common-library", contains basic components (layout-components mainly, services etc.) and Library B is called "type-a-library" (for the sake of this example). Library B "type-a" has a dependency on "common" and the consumer-application, called "client-name", imports both libraries.

client-name
    |_ common-library
    |_ type-a-library

The "main"-application "client-name", which uses these libraries, uses the ui-router-library for state-management. Before we moved everything into those two libraries we only had one single angular-application with all components etc.. It had a state-configuration via

    UIRouterModule.forRoot({
        states: APPLICATION_STATES,
        useHash: true,
        initial: {state: 'home'}
    })

which was easy, because everything was inside the same application. But now, after switching to libraries, I am having trouble correctly setting up the states.

Our idea was that each library exports a list of states which are being merged in the "client-a"-consumer-application and then passed into its UIRouterModule.forRoot() function.

We have some abstract states for layout purposes, e.g.:

export const layoutState: Ng2StateDeclaration = {
    name: 'layout',
    abstract: true,
    component: CwpLayoutComponent
};

export const homeState: Ng2StateDeclaration = {
    name: 'layout.home',
    url: '/home',
    component: CwpHomePageComponent
};

So if state "layout.home" is being called, it is being rendered into a <ui-view>-Tag inside its parent-state, "layout". Both example components, CwpLayoutComponent and CwpHomePageComponent, are inside the "type-a"-library.

How do I need to import the UIRouterModule into the LibraryModules? I mean the libraries don't set up states themselves but they do contain components which use the ui-view-Directive of UIRouter (for the nested states) and also contain Services which use the StateService so I guess I do have to import UIRouterModule here?

I tried "UIRouterModule", I tried UIRouterModule.forRoot(), I also tried UIRouterModule.forChild()... I tried UIRouterModule.forRoot() for the common-library and UIRouterModule.forChild() for the library "type-a"... I don't understand how these forRoot and forChild-functions work when using them in Angular-Libraries. I was under the impression that only the import in the app.module.ts of the main-application can use "forRoot()" and the libraries would need to use "forChild()" instead, but if I do that it tells me that it can't find a provider for the service called "StateService" which belongs to UIRouterModule if I try to render a state (coming from the state-list inside the library "type-a") which uses the StateService...

The project did start with the above configuration, but calling the state "layout.home" doesn't render the inner component "CwpHomePageComponent" but only the layout-"frame", coming from the abstract state "layout". For some reason it won't render the nested state anymore. I think my UIRouterModule-config isn't working when using it like I do, but what am I doing wrong?


来源: stackexchange

问:
How to add a unique identifier to a table that represents a chain of friendships on a social media platform
I have a table in BigQuery that represents friends on social media that looks like the following, where each row represents two people who are friends.

```<code>friend1 friend2
Bob     Fred
Fred    Alice
Sam     Jane
Jane    Clive
Clive   Paul
Jim     Tom
Jim     Anne
Paul    Jack
Jim     Corrinne
Tom     Phil
Craig   Jack
Sarah   Jack
</code>```

I want to run a query that will output the following:

```<code>friend1 friend2   network_identifier
Bob     Fred      1
Fred    Alice     1
Sam     Jane      2
Jane    Clive     2
Clive   Paul      2
Jim     Tom       3
Jim     Anne      3
Paul    Jack      2
Jim     Corrinne  3
Tom     Phil      3
Craig   Jack      2
Sarah   Jack      2
</code>```

where the column network_identifier represents the network of friends i.e. there is some connection either via a friend, a friend of a friend, a friend of a friend of a friend etc.

nerwork_identifier 1: Bob is friends with Fred who is friends with Alice.

nerwork_identifier 2: Sam is friends with Jane who is friends with Clive who is friends with Paul who is friends with Jack who is friends with Craig and Sarah.

nerwork_identifier 3:  Jim is friends with Tom, Anne and Corrine and Tom is friends with Phil.

ContentLicense: CC BY-SA 4.0

Body:
I have a table in BigQuery that represents friends on social media that looks like the following, where each row represents two people who are friends.

friend1 friend2
Bob     Fred
Fred    Alice
Sam     Jane
Jane    Clive
Clive   Paul
Jim     Tom
Jim     Anne
Paul    Jack
Jim     Corrinne
Tom     Phil
Craig   Jack
Sarah   Jack

I want to run a query that will output the following:

friend1 friend2   network_identifier
Bob     Fred      1
Fred    Alice     1
Sam     Jane      2
Jane    Clive     2
Clive   Paul      2
Jim     Tom       3
Jim     Anne      3
Paul    Jack      2
Jim     Corrinne  3
Tom     Phil      3
Craig   Jack      2
Sarah   Jack      2

where the column network_identifier represents the network of friends i.e. there is some connection either via a friend, a friend of a friend, a friend of a friend of a friend etc.

nerwork_identifier 1: Bob is friends with Fred who is friends with Alice.

nerwork_identifier 2: Sam is friends with Jane who is friends with Clive who is friends with Paul who is friends with Jack who is friends with Craig and Sarah.

nerwork_identifier 3:  Jim is friends with Tom, Anne and Corrine and Tom is friends with Phil.


问:
selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed
I have a python script that I am running on one PC and want to move it to a remote PC that runs 24/7. It worked for a while and then it stopped from one day to the next. Now it gives me the error message that the window already closed is, when in fact is not. I have updated selenium together with all other libraries on both computers and the Chrome driver and still on the old PC the script works without a problem, but on the new one it doesn't work. Even added Chrome options and still nothing.

there is no iframe in on the target website, nor has there ever been

updated all libraries and chrome drivers and both PCs

added chrome options that should have helped, but didn't

```<code>chromeOptions = webdriver.ChromeOptions()
prefs = {"download.default_directory": download_dest}
chromeOptions.add_experimental_option("prefs", prefs)
# chromeOptions.add_argument("--headless")
# chromeOptions.add_argument('--start-maximized')
chromeOptions.add_experimental_option("detach", True)
chromeOptions.add_argument('disable-infobars')
chromeOptions.add_argument('--disable-extensions')
chromeOptions.add_argument('--no-sandbox')
chromeOptions.add_argument('--disable-dev-shm-usage')
chromeOptions.add_argument('--disable-gpu')
chromeOptions.add_experimental_option("excludeSwitches", ["enable-logging"])
driver = webdriver.Chrome(service=Service(driver_path), options=chromeOptions)
</code>```

rewiring the script even and still nothing

security rights, certificates, proxies etc. are all the same for both machines.

Everything works on the old PC, but on the new nothing helped. Both run the same version of python and all the libraries are the same as well.

Issue was isolated to task scheduler. This is a script that runs on a daily basis, thus the task scheduler. The script runs normally when called from the command prompt on the new and also from PyCharm on the new PC. The new PC is also less powerful compared to the old one, however, this shouldn't be a factor as I am able to run the script fine in command prompt.

Body:
I have a python script that I am running on one PC and want to move it to a remote PC that runs 24/7. It worked for a while and then it stopped from one day to the next. Now it gives me the error message that the window already closed is, when in fact is not. I have updated selenium together with all other libraries on both computers and the Chrome driver and still on the old PC the script works without a problem, but on the new one it doesn't work. Even added Chrome options and still nothing.

there is no iframe in on the target website, nor has there ever been

updated all libraries and chrome drivers and both PCs

added chrome options that should have helped, but didn't

chromeOptions = webdriver.ChromeOptions()
prefs = {"download.default_directory": download_dest}
chromeOptions.add_experimental_option("prefs", prefs)
# chromeOptions.add_argument("--headless")
# chromeOptions.add_argument('--start-maximized')
chromeOptions.add_experimental_option("detach", True)
chromeOptions.add_argument('disable-infobars')
chromeOptions.add_argument('--disable-extensions')
chromeOptions.add_argument('--no-sandbox')
chromeOptions.add_argument('--disable-dev-shm-usage')
chromeOptions.add_argument('--disable-gpu')
chromeOptions.add_experimental_option("excludeSwitches", ["enable-logging"])
driver = webdriver.Chrome(service=Service(driver_path), options=chromeOptions)

rewiring the script even and still nothing

security rights, certificates, proxies etc. are all the same for both machines.

Everything works on the old PC, but on the new nothing helped. Both run the same version of python and all the libraries are the same as well.

Issue was isolated to task scheduler. This is a script that runs on a daily basis, thus the task scheduler. The script runs normally when called from the command prompt on the new and also from PyCharm on the new PC. The new PC is also less powerful compared to the old one, however, this shouldn't be a factor as I am able to run the script fine in command prompt.


问:
Can autocomplete make use of Malli?
Given I have a schema for the function get-stock.

```<code>(m/-> get-stock [:cat :int] -> [:map [:price float?] [:sym string]])
</code>```

When I a code below,

```<code>(-> (get-stock)
    ;;; the cursor is here
)
</code>```

Can any tools show me possible keywords that are :price or :sym at the cursor?

Title: Can autocomplete make use of Malli?

Body:
Given I have a schema for the function get-stock.

(m/-> get-stock [:cat :int] -> [:map [:price float?] [:sym string]])

When I a code below,

(-> (get-stock)
    ;;; the cursor is here
)

Can any tools show me possible keywords that are :price or :sym at the cursor?


问:
How to create Class diagram automatically while using Pycharm community eddition?
I'm using Pycharm community edition, and want to generate class diagrams automatically based on the classes that exist in my project.
I tried to use PlantUML plugin, but unfortunately, I need to create the class diagrams by creating a file with plantUML's syntax.

I want to be able to generate the classes diagrams automatically from the project, so when a class structure is changed, the diagram will be changed as well.

For example, in Intellijay IDE this could be achieved by selecting the class from the project tool window, then click on "Diagrams"...

How can this be done in Pycharm community edition (In the professional edition it is pretty simple)?

Thank you.


问:
what steps need to follow for Configuring TT_PRODUCT extension in Typo3
How to show basket ,what configuration is needed for that .Page return response after I did steps](https://i.stack.imgur.com/cgIIG.png)

I have followed following step
1.Install extension  by composer
2.add into template
3.add page choose plugin
4.add basket  enter image description here

But no basket is coming in the page .

I need complete step wise document in tt_product in typo3.
please help if anyone has done !
Thanks in advance


问:
Postgress creating a partition without lock
I want to create a partition on a table that has data. With the current architecture creating a  partition is creating a lock on the database. How to create a partition without locking?

Creating the partition results in deadlock now


问:
password generator with conditoins (c#)
I am supposed to create a password generator in C++ with these conditions:

30 characters

at least 1 lower case letter

6 capital letters

at least 8 digits

2 to 5 special characters

So far I've only managed to create a random number generator for all characters and it's a bit difficult for me to include the conditions. Can anyone help me? Thank you in advance!

```<code>#include <iostream>
#include <time.h>

using namespace std;

int main() {
  srand(time(0));
  string pass;

  string data = "abcdefghijklmnopqrstuvwxyz"
              "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
              "0123456789"
              ";,:.+-*/%><=!~^&|[]{}()";
  for (int i=0; i<=30; i++) //30 characters
  {

  pass = pass + data[rand()% 100]; //random generator
  }

  cout << "Your password: " << pass;

  return 0;
}
</code>```

Title: password generator with conditoins (c#)

Body:
I am supposed to create a password generator in C++ with these conditions:

30 characters

at least 1 lower case letter

6 capital letters

at least 8 digits

2 to 5 special characters

So far I've only managed to create a random number generator for all characters and it's a bit difficult for me to include the conditions. Can anyone help me? Thank you in advance!

#include <iostream>
#include <time.h>

using namespace std;

int main() {
  srand(time(0));
  string pass;

  string data = "abcdefghijklmnopqrstuvwxyz"
              "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
              "0123456789"
              ";,:.+-*/%><=!~^&|[]{}()";
  for (int i=0; i<=30; i++) //30 characters
  {

  pass = pass + data[rand()% 100]; //random generator
  }

  cout << "Your password: " << pass;

  return 0;
}


问:
How do I add captions to DT:datatable()?
I often use exchangeably knitr::kable and DT::datatable to show tables in my reports, depending on how many rows the data has. I need these tables to be numbers, so that they can be referenced to in the document

The problem is that the following code does not produce a table caption and reference for the first table and I have to use weird workarounds that do not work reliably or completely switch to manual numbering of tables.

```<code>---
title: "Example"
format: html
---

As you can see in @tbl-iris, this example does not work. However, it does
work for `knitr::kable`, as you can see in @tbl-iris2.

```{r}
#| label: tbl-iris
#| tbl-cap: Example DT table
DT::datatable(head(iris))
```

```{r}
#| label: tbl-iris2
#| tbl-cap: Example kable table
knitr::kable(head(iris))
```
</code>```

This is the output of quarto render test.qmd:

Body:
I often use exchangeably knitr::kable and DT::datatable to show tables in my reports, depending on how many rows the data has. I need these tables to be numbers, so that they can be referenced to in the document

The problem is that the following code does not produce a table caption and reference for the first table and I have to use weird workarounds that do not work reliably or completely switch to manual numbering of tables.

---
title: "Example"
format: html
---

As you can see in @tbl-iris, this example does not work. However, it does
work for `knitr::kable`, as you can see in @tbl-iris2.

```{r}
#| label: tbl-iris
#| tbl-cap: Example DT table
DT::datatable(head(iris))
```

```{r}
#| label: tbl-iris2
#| tbl-cap: Example kable table
knitr::kable(head(iris))
```

This is the output of quarto render test.qmd:


问:
"This version of ChromeDriver has not been tested with Chrome version 108" error with Selenium ChromeDriver
I'm using selenium, chromedriver. I got this error when I started my Test

ChromeDriver was started successfully.
[1670846258.729][WARNING]: This version of ChromeDriver has not been tested with Chrome version 108.

And I also got "Compound class names not permitted" error.

What could be the problem?

chrome version : 108.0.5359.99
Chromedriver version : 108.0.5359.71

enter image description here

I even updated my dependencies to latest version.

enter image description here


问:
Vuejs onclick on v-for in array whith 2 of each items, makes the action on both items rather than the clicked one
I'm trying to learn Vuejs3,making a simple memory game.
I pick the list of cards and make an array of objects screen 2 cards flipped on clickwith 2 times each item for making the pairs to find. (rather than duplicating each card on my data list of cards).
The problem: when I click on the card to flip, it flips the 2 of the same rather than one.console log of v-for array

I'd like each click to turn only one image from the pair of images.
The only solution that has worked is to put 2 times each item in my data file.
Any ideas? Thanks

method who flips card

```<code>methods: {
// flip 2 cards and compare them
flipCard(card) {
console.log("flip called");
card.isFlipped = true;
this.pairs.push(card);
if (this.pairs.length == 2) {
console.log(this.pairs\[0\].image, this.pairs\[1\].image);
this.compare(this.pairs\[0\].image, this.pairs\[1\].image);
}
},
</code>```

shuffle cards and push 2 times each card into an array

```<code>created() {
this.allCards.map((item)=\> {
this.selection.push(item, item);
})
this.selection = this.shuffle(this.selection);
console.log(this.selection);

    this.selection.forEach((card) => {
      card.isFlipped = false;
    });

},
</code>```

template:

```<code><template>
  <div class="cardwrap row row-cols-6 row-cols-md-8 g-3">
    <div class="card"  v-for="(card, index) in selection" :key="card[index]">
      <img @click="flipCard(card, card[index])"
        :src="
          card.isFlipped
            ? '../assets/animals/' + card.image
            : '../assets/square.jpg'
        "
        :alt="card.id"
      />
    </div>
</code>```

Body:
I'm trying to learn Vuejs3,making a simple memory game.
I pick the list of cards and make an array of objects screen 2 cards flipped on clickwith 2 times each item for making the pairs to find. (rather than duplicating each card on my data list of cards).
The problem: when I click on the card to flip, it flips the 2 of the same rather than one.console log of v-for array

I'd like each click to turn only one image from the pair of images.
The only solution that has worked is to put 2 times each item in my data file.
Any ideas? Thanks

method who flips card

methods: {
// flip 2 cards and compare them
flipCard(card) {
console.log("flip called");
card.isFlipped = true;
this.pairs.push(card);
if (this.pairs.length == 2) {
console.log(this.pairs\[0\].image, this.pairs\[1\].image);
this.compare(this.pairs\[0\].image, this.pairs\[1\].image);
}
},

shuffle cards and push 2 times each card into an array

created() {
this.allCards.map((item)=\> {
this.selection.push(item, item);
})
this.selection = this.shuffle(this.selection);
console.log(this.selection);

    this.selection.forEach((card) => {
      card.isFlipped = false;
    });

},

template:

<template>


问:
Remove aab file from google play console
How do i remove the App bundle from google play console?

.stack.imgur.com/rHEXL.png


问:
minify/optimization wont change function names angular 12
I am currently working on my main project for work and just found out that my prod-build's only minify's the .js content but it doenst changes function or class names.

All my class names and all my properites are keept with the same name.

I have set optimization in angular.json settings but that wont help.

angular.json -> configurations -> production:

```<code>{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "cli": {
    "analytics": false
  },
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "client": {
      "projectType": "application",
      "schematics": {
        "@schematics/angular:component": {
          "style": "scss"
        },
        "@schematics/angular:application": {
          "strict": true
        }
      },
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/client",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "inlineStyleLanguage": "scss","allowedCommonJsDependencies": [
              "@babel",
              "canvg"
           ],
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
              "src/styles.scss"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "7mb",
                  "maximumError": "9mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "2kb",
                  "maximumError": "4kb"
                }
              ],
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "outputHashing": "all"
            },
            "development": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true
            }
          },
          "defaultConfiguration": "production"
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "configurations": {
            "production": {
              "browserTarget": "client:build:production"
            },
            "development": {
              "browserTarget": "client:build:development"
            }
          },
          "defaultConfiguration": "development"
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "client:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "karmaConfig": "karma.conf.js",
            "inlineStyleLanguage": "scss",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
              "src/styles.scss"
            ],
            "scripts": []
          }
        }
      }
    }
  },
  "defaultProject": "client"
}
</code>```

client root files

new project var find in main.js

How can i pseudonymise classes and functions?

Body:
I am currently working on my main project for work and just found out that my prod-build's only minify's the .js content but it doenst changes function or class names.

All my class names and all my properites are keept with the same name.

I have set optimization in angular.json settings but that wont help.

angular.json -> configurations -> production:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "cli": {
    "analytics": false
  },
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "client": {
      "projectType": "application",
      "schematics": {
        "@schematics/angular:component": {
          "style": "scss"
        },
        "@schematics/angular:application": {
          "strict": true
        }
      },
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/client",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "inlineStyleLanguage": "scss","allowedCommonJsDependencies": [
              "@babel",
              "canvg"
           ],
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
              "src/styles.scss"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "7mb",
                  "maximumError": "9mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "2kb",
                  "maximumError": "4kb"
                }
              ],
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "outputHashing": "all"
            },
            "development": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true
            }
          },
          "defaultConfiguration": "production"
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "configurations": {
            "production": {
              "browserTarget": "client:build:production"
            },
            "development": {
              "browserTarget": "client:build:development"
            }
          },
          "defaultConfiguration": "development"
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "client:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "karmaConfig": "karma.conf.js",
            "inlineStyleLanguage": "scss",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
              "src/styles.scss"
            ],
            "scripts": []
          }
        }
      }
    }
  },
  "defaultProject": "client"
}

client root files

new project var find in main.js

How can i pseudonymise classes and functions?


问:
Lcov process is stuck in file read
I am running lcov to capture the code coverage but my lcov process is stuck somewhere.
Here is the strace and lsof output:

strace -p 9167

```<code>strace: Process 9167 attached
fcntl(3, F_SETLKW, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=0, l_len=0}
</code>```

/sbin/lsof -p 9167

```<code>COMMAND  PID    USER   FD   TYPE DEVICE SIZE/OFF       NODE NAME
gcov    9167  admin  cwd    DIR   0,88    20480 3196209040 /linux-gcc4-64/gcov/obj/reset_manager (rw-tap2-data.xyz.com:/cs44_nb/build)
gcov    9167 admin  rtd    DIR  253,0     4096          2 /
gcov    9167 admin  txt    REG  253,0   318928    9214523 /usr/bin/gcov
gcov    9167 admin  mem    REG  253,0  2156272    9177394 /usr/lib64/libc-2.17.so
gcov    9167 admin  mem    REG  253,0  1136944    9177402 /usr/lib64/libm-2.17.so
gcov    9167 admin  mem    REG  253,0   163312    9177387 /usr/lib64/ld-2.17.so
gcov    9167 admin    0u   CHR  136,9      0t0         12 /dev/pts/9
gcov    9167 admin    1w   CHR    1,3      0t0       1028 /dev/null
gcov    9167 admin    2u   CHR  136,9      0t0         12 /dev/pts/9
gcov    9167 admin    3r   REG   0,88    10800 3208575778 /linux-gcc4-64/gcov/obj/reset_manager/COInfo.gcda (rw-tap2-data.xyz.com:/cs44_nb/build)
</code>```

Can someone Pls help me to debug this further?

Here are other details:

```<code>gdb version:  10.3.0
lcov version: 1.15.0
</code>```

Thanks

I tried to run strace/lcov to debug this.

Title: Lcov process is stuck in file read

Body:
I am running lcov to capture the code coverage but my lcov process is stuck somewhere.
Here is the strace and lsof output:

strace -p 9167

strace: Process 9167 attached
fcntl(3, F_SETLKW, {l_type=F_RDLCK, l_whence=SEEK_SET, l_start=0, l_len=0}

/sbin/lsof -p 9167

COMMAND  PID    USER   FD   TYPE DEVICE SIZE/OFF       NODE NAME
gcov    9167  admin  cwd    DIR   0,88    20480 3196209040 /linux-gcc4-64/gcov/obj/reset_manager (rw-tap2-data.xyz.com:/cs44_nb/build)
gcov    9167 admin  rtd    DIR  253,0     4096          2 /
gcov    9167 admin  txt    REG  253,0   318928    9214523 /usr/bin/gcov
gcov    9167 admin  mem    REG  253,0  2156272    9177394 /usr/lib64/libc-2.17.so
gcov    9167 admin  mem    REG  253,0  1136944    9177402 /usr/lib64/libm-2.17.so
gcov    9167 admin  mem    REG  253,0   163312    9177387 /usr/lib64/ld-2.17.so
gcov    9167 admin    0u   CHR  136,9      0t0         12 /dev/pts/9
gcov    9167 admin    1w   CHR    1,3      0t0       1028 /dev/null
gcov    9167 admin    2u   CHR  136,9      0t0         12 /dev/pts/9
gcov    9167 admin    3r   REG   0,88    10800 3208575778 /linux-gcc4-64/gcov/obj/reset_manager/COInfo.gcda (rw-tap2-data.xyz.com:/cs44_nb/build)

Can someone Pls help me to debug this further?

Here are other details:

gdb version:  10.3.0
lcov version: 1.15.0

Thanks

I tried to run strace/lcov to debug this.


问:
retrofit header authorization not working
*i am tried to send token header using "Autorization" but response return empty. postman it's working. i used retrofit library. i tried two ways`

```<code>interface EtrApi {
    @POST("getLoads")
    fun getLoads(@Header("Authorization") accessToken: String
    ): Call<LoadResponse?>?
}
interface EtrApi {
    @Headers(
        "Content-Type: application/json; charset=UTF-8",
       "Accept: ",
        "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJUaGVfY2xhaW0iLCJhdWQiOiJUaGVXVkIiwiaWF0IjoxNjcwODQ0NDk5LCJuYmYiOjE2NzA4NDQ1MDksImV4cCI6MTcwNjg0NDQ5OSwiZGF0YSI6eyJkcml2ZXJfaWQiOiIxOSIsImRyaXZlcl9uYW1lIjoibWsgdGsiLCJkcml2ZXJfZW1haWwiOiJta0BnbWFpbC5jb20iLCJyb2xlIjoiZHJpdmVyIn19.NL_285_OaBPBYJncb9_oFKuvgMgSjfFkJcxIJMzS7Xc"
    )
  @POST("getLoads")
    fun getLoads(): Call<LoadResponse?>?
}

 val quotesApi = RetrofitHelper.getInstance().create(EtrApi::class.java)
            if (token != null) {
                Log.e("token",""+token)
                quotesApi.getLoads(token)
                    ?.enqueue(object : Callback<LoadResponse?> {
                        override fun onResponse(
                            call: Call<LoadResponse?>,
                            responsez: Response<LoadResponse?>
                        ) {
                            Log.e("Responsestring", responsez.body().toString())

                            if (responsez.isSuccessful) {
                                if (responsez.body() != null) {
                                    //  var json = Gson().toJson(response.body())
                                    progressDialog.dismiss()
                                }
                            } else {
                                progressDialog.dismiss()
                            }
                        }

                        override fun onFailure(call: Call<LoadResponse?>, t: Throwable) {
                            Log.e("Responsestringerr", t.toString())
                            progressDialog.dismiss()
                        }
                    })
            }

```*`
```

Body:
*i am tried to send token header using "Autorization" but response return empty. postman it's working. i used retrofit library. i tried two ways`

interface EtrApi {
    @POST("getLoads")
    fun getLoads(@Header("Authorization") accessToken: String
    ): Call<LoadResponse?>?
}
interface EtrApi {
    @Headers(
        "Content-Type: application/json; charset=UTF-8",
       "Accept: ",
        "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJUaGVfY2xhaW0iLCJhdWQiOiJUaGVXVkIiwiaWF0IjoxNjcwODQ0NDk5LCJuYmYiOjE2NzA4NDQ1MDksImV4cCI6MTcwNjg0NDQ5OSwiZGF0YSI6eyJkcml2ZXJfaWQiOiIxOSIsImRyaXZlcl9uYW1lIjoibWsgdGsiLCJkcml2ZXJfZW1haWwiOiJta0BnbWFpbC5jb20iLCJyb2xlIjoiZHJpdmVyIn19.NL_285_OaBPBYJncb9_oFKuvgMgSjfFkJcxIJMzS7Xc"
    )
  @POST("getLoads")
    fun getLoads(): Call<LoadResponse?>?
}

 val quotesApi = RetrofitHelper.getInstance().create(EtrApi::class.java)
            if (token != null) {
                Log.e("token",""+token)
                quotesApi.getLoads(token)
                    ?.enqueue(object : Callback<LoadResponse?> {
                        override fun onResponse(
                            call: Call<LoadResponse?>,
                            responsez: Response<LoadResponse?>
                        ) {
                            Log.e("Responsestring", responsez.body().toString())

                            if (responsez.isSuccessful) {
                                if (responsez.body() != null) {
                                    //  var json = Gson().toJson(response.body())
                                    progressDialog.dismiss()
                                }
                            } else {
                                progressDialog.dismiss()
                            }
                        }

                        override fun onFailure(call: Call<LoadResponse?>, t: Throwable) {
                            Log.e("Responsestringerr", t.toString())
                            progressDialog.dismiss()
                        }
                    })
            }

```*`


问:
How to assign materials for NXOpen FEM Parts from MatML Library
I'm trying to assign material for FEM part from MatML Library.
Below are the Libraries used.</p>
```<code>NXOpen.PhysMat.PhysicalMaterialListBuilder physicalMaterialListBuilder1;
        physicalMaterialListBuilder1 = workFemPart.MaterialManager.PhysicalMaterials.CreateListBlockBuilder();

        NXOpen.PhysMat.PhysicalMaterialAssignBuilder physicalMaterialAssignBuilder1;
        physicalMaterialAssignBuilder1 = workFemPart.MaterialManager.PhysicalMaterials.CreateMaterialAssignBuilder();

        NXOpen.NXObject[] objects1 = new NXOpen.NXObject[1];

        physicalMaterial1 = workFemPart.MaterialManager.PhysicalMaterials.LoadFromMatmlLibrary(AppDomain.CurrentDomain.BaseDirectory+"Material\\"+materialName+".xml", materialName);

        //NXOpen.CAE.CAEBody cAEBody1 = (NXOpen.CAE.CAEBody)workFemPart.FindObject("CAE_Body(1)");
        objects1[0] = (NXObject)nxObject1[0];
        physicalMaterialAssignBuilder1 = workFemPart.MaterialManager.PhysicalMaterials.CreatePhysicalMaterialInspectBuilder(physicalMaterial1);

        physicalMaterialAssignBuilder1.Destroy();
        physicalMaterialListBuilder1.Destroy();
</code>```

Body:
I'm trying to assign material for FEM part from MatML Library.
Below are the Libraries used.

NXOpen.PhysMat.PhysicalMaterialListBuilder physicalMaterialListBuilder1;
        physicalMaterialListBuilder1 = workFemPart.MaterialManager.PhysicalMaterials.CreateListBlockBuilder();

        NXOpen.PhysMat.PhysicalMaterialAssignBuilder physicalMaterialAssignBuilder1;
        physicalMaterialAssignBuilder1 = workFemPart.MaterialManager.PhysicalMaterials.CreateMaterialAssignBuilder();

        NXOpen.NXObject[] objects1 = new NXOpen.NXObject[1];

        physicalMaterial1 = workFemPart.MaterialManager.PhysicalMaterials.LoadFromMatmlLibrary(AppDomain.CurrentDomain.BaseDirectory+"Material\\"+materialName+".xml", materialName);

        //NXOpen.CAE.CAEBody cAEBody1 = (NXOpen.CAE.CAEBody)workFemPart.FindObject("CAE_Body(1)");
        objects1[0] = (NXObject)nxObject1[0];
        physicalMaterialAssignBuilder1 = workFemPart.MaterialManager.PhysicalMaterials.CreatePhysicalMaterialInspectBuilder(physicalMaterial1);

        physicalMaterialAssignBuilder1.Destroy();
        physicalMaterialListBuilder1.Destroy();


问:
firestore sums all values without duplication
If you do not swipe up and down to refresh the tableview, the total value is normal, but if you pull up to refresh the tableview, the old data will be added repeatedly. What should I do to prevent repeated reading of the total value?</p>
```<code>db.collection("Admin").document("AiSmartRobot").collection("AiDailyProfit").getDocuments()
{ (snapshot, error) in
               if snapshot!.documents.isEmpty  {

               }else{
                   if snapshot?.isEmpty != true && snapshot != nil {
for document in snapshot!.documents{
                           if let quantity = document.data()["quantity"] as? Double{
                               self.totalVotes += quantity

                              cell.nowq8.text = String(format: "%.4f", self.totalVotes)

</code>```

Body:
If you do not swipe up and down to refresh the tableview, the total value is normal, but if you pull up to refresh the tableview, the old data will be added repeatedly. What should I do to prevent repeated reading of the total value?

db.collection("Admin").document("AiSmartRobot").collection("AiDailyProfit").getDocuments()
{ (snapshot, error) in
               if snapshot!.documents.isEmpty  {

               }else{
                   if snapshot?.isEmpty != true && snapshot != nil {
for document in snapshot!.documents{
                           if let quantity = document.data()["quantity"] as? Double{
                               self.totalVotes += quantity

                              cell.nowq8.text = String(format: "%.4f", self.totalVotes)


问:
Get data from django user model
This is my model:

```<code>from django.contrib.auth.models import User

class User_Model(models.Model):
    user = models.OneToOneField(User, null=True, on_delete=models.CASCADE)
    nickname = models.CharField(User.username, max_length=2000, null=True)

    def __str__(self):
        return f"{self.user}"
</code>```

I would like to save into nickname in this model value of "username" from User model.
I want to use it later in vievs.py to send them as context

```<code>class Users(ListView):
    model = User_Model
    context_object_name = "users"
    paginate_by = 10
    template_name = "Messenger/home.html"

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context["qs_json"] = json.dumps(list(User_Model.objects.values('nickname')))
        return context
</code>```

Generally i try to do stuff like here but i want to list nicknames: https://www.youtube.com/watch?v=jqSl36xR9Ys

I tried to get those from one to one field but i think i done this wrong way

Title: Get data from django user model

Body:
This is my model:

from django.contrib.auth.models import User

class User_Model(models.Model):
    user = models.OneToOneField(User, null=True, on_delete=models.CASCADE)
    nickname = models.CharField(User.username, max_length=2000, null=True)

    def __str__(self):
        return f"{self.user}"

I would like to save into nickname in this model value of "username" from User model.
I want to use it later in vievs.py to send them as context

class Users(ListView):
    model = User_Model
    context_object_name = "users"
    paginate_by = 10
    template_name = "Messenger/home.html"

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context["qs_json"] = json.dumps(list(User_Model.objects.values('nickname')))
        return context

Generally i try to do stuff like here but i want to list nicknames: https://www.youtube.com/watch?v=jqSl36xR9Ys

I tried to get those from one to one field but i think i done this wrong way


问:
WZoom is not defined rails 7
I am installing this package in my rails 7 app to have zoom functionality on my images.

Package: https://github.com/worka/vanilla-js-wheel-zoom

I am installing it via npm
I did

```<code>./bin/importmap pin vanilla-js-wheel-zoom --download
</code>```

but after using it in my view it gives me following error

Title: WZoom is not defined rails 7

Body:
I am installing this package in my rails 7 app to have zoom functionality on my images.

Package: https://github.com/worka/vanilla-js-wheel-zoom

I am installing it via npm
I did

./bin/importmap pin vanilla-js-wheel-zoom --download

but after using it in my view it gives me following error


问:
System.Data 4.0.0.0 not found issue
I'm deploying an app on a new Windows 11 machine - this app has run fine on many other Windows 10 and 11 machines for years. On this new machine, I keep getting an error when trying to deserialize an object with JSON.net - "Could not load file or assembly 'System.Data, Version=4.0.0.0".

I thought that was weird since System.Data is part of .Net, but I added the system.data.dll file to my installer so now it is in the apps' local Program Files (x86) folder. My app is .Net 4.8.1 and in my references that is the version of system.data that my project uses so that is what I added. This had no affect on the error. We tried installing .Net 4.8, and we got message that it or a newer version of .Net is already installed. Any idea what is going on here

Title: System.Data 4.0.0.0 not found issue


问:
TypeScript: Type should be interface X or X + 2 additional fields
I'm trying to define a type which should be either Base or Base with additional fields. My code looks like this:

```<code>interface Base {
  id: string,
}

interface Extra {
  firstName: string,
  lastName: string,
}

type Human = Base | (Base & Extra);

const validBase: Base = {id: "123"};
const validHuman: Human = {id: "123", firstName: "Seppo", lastName: "Taalasmaa"};
</code>```

This works as expected. But if I create an invalid Human, which has only firstName but no lastName, it is still considered to be a valid Human. Why?

```<code>const shouldBeInvalid: Human = {id: "123", firstName: "Seppo"}; // Works, why??
</code>```

Body:
I'm trying to define a type which should be either Base or Base with additional fields. My code looks like this:

interface Base {
  id: string,
}

interface Extra {
  firstName: string,
  lastName: string,
}

type Human = Base | (Base & Extra);

const validBase: Base = {id: "123"};
const validHuman: Human = {id: "123", firstName: "Seppo", lastName: "Taalasmaa"};

This works as expected. But if I create an invalid Human, which has only firstName but no lastName, it is still considered to be a valid Human. Why?

const shouldBeInvalid: Human = {id: "123", firstName: "Seppo"}; // Works, why??


问:
How to get the intersection of two vectors when one is a polygon and one a multipolygon, without skipping features with invalid geometries?

In QGIS I am trying to get the intersection between the vector layer with black lines and another vector layer in gold. Whenever I do it I get the error that they are different geometries. When I opt to skip features with invalid geometries I get maybe two areas on the whole map where there's an intersection when it is clear there are much more. Is there anything I can do to find this intersection?

Note: the black outlined layer was originally a raster.

If more info is needed let me know, thanks


问:
Segmentation fault when creating custom autograd function that calls Julia code
I have a (vector-to-scalar) function and corresponding derivative function written in Julia that I am unable to translate to Python. I would like to use these within PyTorch by defining a custom autograd function. For simplicity, lets assume this function is sum(). This gives the following MRE:

import numpy as np
import torch
from julia import Main

class JuliaSum(torch.autograd.Function):

    @staticmethod
    def forward(ctx, input):
        ctx.save_for_backward(input)

        x = input.cpu().detach().numpy()

        return torch.FloatTensor([Main.sum(x)]).to('cuda')
        # return torch.FloatTensor([np.sum(x)]).to('cuda')

    @staticmethod
    def backward(ctx, grad_output):
        input, = ctx.saved_tensors
        x = input.cpu().detach().numpy()

        y = torch.FloatTensor(Main.ones(len(x))).to('cuda')
        # y = torch.FloatTensor(np.ones(len(x))).to('cuda')

        return grad_output * y

input = torch.FloatTensor([0.1, 0.2, 0.3]).to('cuda').requires_grad_()

# Works — outputs `tensor([0.6000], device='cuda:0', grad_fn=<JuliaSumBackward>)`
y = JuliaSum.apply(input)
print(y)

# Works — outputs `tensor([1., 1., 1.], device='cuda:0') `
x = input.cpu().detach().numpy().astype(np.float64)
y_test = torch.FloatTensor(main.ones(len(x))).to('cuda')
print(torch.ones(1).to('cuda') * y_test)

# Doesn't work — segmentation fault
y.backward(torch.ones(1).to('cuda'))
print(input.grad)

```
<p>Calling the forward method works fine, as does running the code contained in the <code>backward</code> method from the global scope. However, when I call the <code>backward</code> method, I receive:</p>
```signal (11): Segmentation fault
in expression starting at none:0
Allocations: 3652709 (Pool: 3650429; Big: 2280); GC: 5
Segmentation fault (core dumped)
```
<p>The exact line command causing the issue is <code>Main.ones(len(x))</code>. Replacing this with <code>Main.ones(3)</code> still causes a segmentation fault, so it appears to be an issue with PyJulia accessing memory that has been deallocated.</p>
<p>Also note that when I replace the two calls to Julia with the corresponding NumPy commands (left commented-out), the <code>backward</code> method works fine. The code also works when all tensors are on the CPU but my application requires GPU-acceleration.</p>
<p>What is causing this segmentation fault, and how can alter my code to avoid it whilst keeping PyTorch tensors on the GPU?</p>
<hr>
<p>I've included a Dockerfile that matches my environment to make reproducing this issue as simple as possible. For reference, I am using an RTX 3060.</p>
<pre class="lang-docker prettyprint-override"><code>FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04

ARG PYTHON_VERSION=3.10.1
ARG JULIA_VERSION=1.7.1

ENV container docker
ENV DEBIAN_FRONTEND noninteractive
ENV LANG en_US.utf8
ENV MAKEFLAGS -j4

RUN mkdir /app
WORKDIR /app

# DEPENDENCIES
#===========================================
RUN apt-get update -y && \
    apt-get install -y gcc make wget libffi-dev \
        build-essential libssl-dev zlib1g-dev \
        libbz2-dev libreadline-dev libsqlite3-dev \
        libncurses5-dev libncursesw5-dev xz-utils \
        git

# INSTALL PYTHON
#===========================================
RUN wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz && \
    tar -zxf Python-$PYTHON_VERSION.tgz && \
    cd Python-$PYTHON_VERSION && \
    ./configure --with-ensurepip=install --enable-shared && make && make install && \
    ldconfig && \
    ln -sf python3 /usr/local/bin/python
RUN python -m pip install --upgrade pip setuptools wheel && \
    python -m pip install julia numpy torch

# INSTALL JULIA
#====================================
RUN wget https://raw.githubusercontent.com/abelsiqueira/jill/main/jill.sh && \
    bash /app/jill.sh -y -v $JULIA_VERSION && \
    export PYTHON="python" && \
    julia -e 'using Pkg; ENV["PYTHON"] = "/usr/local/bin/python"' && \
    python -c 'import julia; julia.install()'

# CLEAN UP
#===========================================
RUN rm -rf /app/jill.sh \
    /opt/julias/*.tar.gz \
    /app/Python-$PYTHON_VERSION.tgz
RUN apt-get purge -y gcc make wget zlib1g-dev libffi-dev libssl-dev \
        libbz2-dev libreadline-dev \
        libncurses5-dev libncursesw5-dev xz-utils && \
    apt-get autoremove -y

CMD ["/bin/bash"]
</code>```

Body:
I have a (vector-to-scalar) function and corresponding derivative function written in Julia that I am unable to translate to Python. I would like to use these within PyTorch by defining a custom autograd function. For simplicity, lets assume this function is sum(). This gives the following MRE:

import numpy as np
import torch
from julia import Main

class JuliaSum(torch.autograd.Function):

    @staticmethod
    def forward(ctx, input):
        ctx.save_for_backward(input)

        x = input.cpu().detach().numpy()

        return torch.FloatTensor([Main.sum(x)]).to('cuda')
        # return torch.FloatTensor([np.sum(x)]).to('cuda')

    @staticmethod
    def backward(ctx, grad_output):
        input, = ctx.saved_tensors
        x = input.cpu().detach().numpy()

        y = torch.FloatTensor(Main.ones(len(x))).to('cuda')
        # y = torch.FloatTensor(np.ones(len(x))).to('cuda')

        return grad_output * y

input = torch.FloatTensor([0.1, 0.2, 0.3]).to('cuda').requires_grad_()

# Works — outputs `tensor([0.6000], device='cuda:0', grad_fn=<JuliaSumBackward>)`
y = JuliaSum.apply(input)
print(y)

# Works — outputs `tensor([1., 1., 1.], device='cuda:0') `
x = input.cpu().detach().numpy().astype(np.float64)
y_test = torch.FloatTensor(main.ones(len(x))).to('cuda')
print(torch.ones(1).to('cuda') * y_test)

# Doesn't work — segmentation fault
y.backward(torch.ones(1).to('cuda'))
print(input.grad)

Calling the forward method works fine, as does running the code contained in the backward method from the global scope. However, when I call the backward method, I receive:

signal (11): Segmentation fault
in expression starting at none:0
Allocations: 3652709 (Pool: 3650429; Big: 2280); GC: 5
Segmentation fault (core dumped)

The exact line command causing the issue is Main.ones(len(x)). Replacing this with Main.ones(3) still causes a segmentation fault, so it appears to be an issue with PyJulia accessing memory that has been deallocated.

Also note that when I replace the two calls to Julia with the corresponding NumPy commands (left commented-out), the backward method works fine. The code also works when all tensors are on the CPU but my application requires GPU-acceleration.

What is causing this segmentation fault, and how can alter my code to avoid it whilst keeping PyTorch tensors on the GPU?

I've included a Dockerfile that matches my environment to make reproducing this issue as simple as possible. For reference, I am using an RTX 3060.

FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04

ARG PYTHON_VERSION=3.10.1
ARG JULIA_VERSION=1.7.1

ENV container docker
ENV DEBIAN_FRONTEND noninteractive
ENV LANG en_US.utf8
ENV MAKEFLAGS -j4

RUN mkdir /app
WORKDIR /app

# DEPENDENCIES
#===========================================
RUN apt-get update -y && \
    apt-get install -y gcc make wget libffi-dev \
        build-essential libssl-dev zlib1g-dev \
        libbz2-dev libreadline-dev libsqlite3-dev \
        libncurses5-dev libncursesw5-dev xz-utils \
        git

# INSTALL PYTHON
#===========================================
RUN wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz && \
    tar -zxf Python-$PYTHON_VERSION.tgz && \
    cd Python-$PYTHON_VERSION && \
    ./configure --with-ensurepip=install --enable-shared && make && make install && \
    ldconfig && \
    ln -sf python3 /usr/local/bin/python
RUN python -m pip install --upgrade pip setuptools wheel && \
    python -m pip install julia numpy torch

# INSTALL JULIA
#====================================
RUN wget https://raw.githubusercontent.com/abelsiqueira/jill/main/jill.sh && \
    bash /app/jill.sh -y -v $JULIA_VERSION && \
    export PYTHON="python" && \
    julia -e 'using Pkg; ENV["PYTHON"] = "/usr/local/bin/python"' && \
    python -c 'import julia; julia.install()'

# CLEAN UP
#===========================================
RUN rm -rf /app/jill.sh \
    /opt/julias/*.tar.gz \
    /app/Python-$PYTHON_VERSION.tgz
RUN apt-get purge -y gcc make wget zlib1g-dev libffi-dev libssl-dev \
        libbz2-dev libreadline-dev \
        libncurses5-dev libncursesw5-dev xz-utils && \
    apt-get autoremove -y

CMD ["/bin/bash"]


问:
Method "WriteToTable();" isn't doing anything to the database file
My code:

```<code> private void button1_Click(object sender, EventArgs e)
    {
        WriteToTable();
    }

  public void WriteToTable()
    {
         string DBpath = @"Data Source=.\StudentInfoDB.db;Version=3;";
         using SQLiteConnection SQLConnection = new SQLiteConnection(DBpath);
         using var cmd = new SQLiteCommand(DBpath, SQLConnection);
         SQLConnection.Open();
         cmd.CommandText = "INSERT INTO Students (Name) VALUES ('Test')";
         cmd.ExecuteNonQuery();
         SQLConnection.Close();
    }
</code>```

In my database file, I have one table called Students and 3 columns called name, grade and phone number. I'm trying to ensure I correctly connected to the database so I decided I should try adding text under the Name column before I add anymore code.

I expected this code to output "Text" under the "Name" column to my database file, however after I press button1 nothing happens. No errors show up and no crashes occur.

I have tried debugging the code and searching online for common mistakes but sadly it did not help

Body:
My code:

 private void button1_Click(object sender, EventArgs e)
    {
        WriteToTable();
    }

  public void WriteToTable()
    {
         string DBpath = @"Data Source=.\StudentInfoDB.db;Version=3;";
         using SQLiteConnection SQLConnection = new SQLiteConnection(DBpath);
         using var cmd = new SQLiteCommand(DBpath, SQLConnection);
         SQLConnection.Open();
         cmd.CommandText = "INSERT INTO Students (Name) VALUES ('Test')";
         cmd.ExecuteNonQuery();
         SQLConnection.Close();
    }

In my database file, I have one table called Students and 3 columns called name, grade and phone number. I'm trying to ensure I correctly connected to the database so I decided I should try adding text under the Name column before I add anymore code.

I expected this code to output "Text" under the "Name" column to my database file, however after I press button1 nothing happens. No errors show up and no crashes occur.

I have tried debugging the code and searching online for common mistakes but sadly it did not help


问:
How to create a new SHA 1 key for new project ?I have created that one by using cd android./gradlew signingReport
i am creating a project but when i use my sha-1 key in fire base it give error of update that this sha-1 key and package name is already in use. The question is that how to create a unique sha 1 key for every project because it is same when i use the command in my pc</p>


问:
How to get the secret id for thycotic secret srever plugin in jenkins?
How to get the credentials form the naps secret server using thycotic server plugin in jenkins? The plugin requires these details (https://i.stack.imgur.com/XcBq6.png)

How to find the secret id and the base url in naps secret server?


问:
Short Circuiting && interleaving: what if the statement already checked changes
I have a question about the processing of statements and short-circuit vs no short-circuit (I do not know the exact name for no short-circuit).

The scenario is the following.
Imagine I have two statements p and q that are evaluated in the following manner:

```<code>if ( p && q ) then ....
</code>```

The tricky thing is that the statement q is a blocking-statement, that blocks  until true or false.

Imagine the following situation:
p is true and then the program blocks in q. Then, when q is released and returns true, p is not longer true (due to interleaving, for instance).

My question is how  the processing of this if will occur if there is short-cirtcuit or not. I guess that with short-circuit it will not check p again. However, if there is no short-circuit it should check that both statements are true at the same time before entering the if clause, is not it? in which cases will this occur?

Body:
I have a question about the processing of statements and short-circuit vs no short-circuit (I do not know the exact name for no short-circuit).

The scenario is the following.
Imagine I have two statements p and q that are evaluated in the following manner:

if ( p && q ) then ....

The tricky thing is that the statement q is a blocking-statement, that blocks  until true or false.

Imagine the following situation:
p is true and then the program blocks in q. Then, when q is released and returns true, p is not longer true (due to interleaving, for instance).

My question is how  the processing of this if will occur if there is short-cirtcuit or not. I guess that with short-circuit it will not check p again. However, if there is no short-circuit it should check that both statements are true at the same time before entering the if clause, is not it? in which cases will this occur?


问:
Create dependency-like visual in quicksight
I have a table of dependencies where the column names are 'root' dendendencies and everything under the column name is a dependent of the root. Now, what i want to create is a visual in quicksight is some sort of visual that shows the dependencies of dependencies. So, say i have column x with n dependencies, if i select/click on any dependency of x, call it y, it should be able to display column y along with all of the items of column/dependency y.

is this possible in quicksight, and if so how?

I would like an interactive table showing the dependencies


问:
ag-grid custom events from header, such like click
in AG-Grid
is there an option to listen events to header click.
in my case, I need to reset column (single) filter on dblClick on header input filter.</p>


问:
Error while passing ndk path string in cmake using Android Studio when using vcpkg
I created an Android Studio project that calls c++ code using the JNI. My project worked until I tried to add a package to my project in my CMake file using VCPKG. My CMakeList.txt looks like this:

```<code>cmake_minimum_required(VERSION 3.18.1)
**set(CMAKE_TOOLCHAIN_FILE C:/vcpkg/scripts/buildsystems/vcpkg.cmake)**

project("deepsudoku")

**find_package(frugally-deep CONFIG REQUIRED)**
**target_link_libraries(main PRIVATE frugally-deep::fdeep)**

include_directories(${OpenCV_DIR}/jni/include)

add_library( lib_opencv SHARED IMPORTED )
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION ${OpenCV_DIR}/libs/${ANDROID_ABI}/libopencv_java4.so)

add_library(deepsudoku SHARED native-lib.cpp utils.cpp imageProcessing.cpp HoughAccumulator.cpp)
find_library(log-lib log)
target_link_libraries(deepsudoku PRIVATE -ljnigraphics lib_opencv ${jnigraphic-lib} ${log-lib})
</code>```

The project was building fine until I added the lines marked by **. Now when I try to build the project, I get a CMake Error in CMakeSystem.cmake located in app/.cxx/Debug/u3j6s5y3/arm64-v8a/CMakeFiles/3.18.1-g262b901-dirty/CMakeSystem.cmake. The file looks like this.

```<code>set(CMAKE_HOST_SYSTEM "Windows-10.0.19045")
set(CMAKE_HOST_SYSTEM_NAME "Windows")
set(CMAKE_HOST_SYSTEM_VERSION "10.0.19045")
set(CMAKE_HOST_SYSTEM_PROCESSOR "AMD64")

include("C:/vcpkg/scripts/buildsystems/vcpkg.cmake")

set(CMAKE_SYSTEM "Android-28")
set(CMAKE_SYSTEM_NAME "Android")
set(CMAKE_SYSTEM_VERSION "28")
set(CMAKE_SYSTEM_PROCESSOR "aarch64")

**set(CMAKE_ANDROID_NDK "C:\Android\Sdk\ndk\21.4.7075529")**
set(CMAKE_ANDROID_STANDALONE_TOOLCHAIN "")
set(CMAKE_ANDROID_ARCH "arm64")
set(CMAKE_ANDROID_ARCH_ABI "arm64-v8a")
set(CMAKE_ANDROID_ARCH_TRIPLE "aarch64-linux-android")
set(CMAKE_ANDROID_NDK_DEPRECATED_HEADERS "0")
set(CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG "windows-x86_64")
**set(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED "C:\Android\Sdk\ndk\21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64")
**
set(CMAKE_CROSSCOMPILING "TRUE")

set(CMAKE_SYSTEM_LOADED 1)
</code>```

I get a syntax error while passing the strings in the lines marked by **(Invalid character escape '\A'). The syntax error emerges because there are backslashes instead of forward slashes in the path of the Android NDK. I tried to change the path by hand, but the file seems to be generated by Android Studio because the file is always reset when I build the project and the same error arises. I also tried to change path of the NDK in the Project Structure section and tried to add a different path by adding ndk.dir to the local.properties file. The actual path of the NDK changes, but it always uses backslashes and the same error while parsing the path is thrown. Is there a way to change the backslashes to forward slashes in the path so that the sting can be parsed? Or is there another to avoid this error?

Body:
I created an Android Studio project that calls c++ code using the JNI. My project worked until I tried to add a package to my project in my CMake file using VCPKG. My CMakeList.txt looks like this:

cmake_minimum_required(VERSION 3.18.1)
**set(CMAKE_TOOLCHAIN_FILE C:/vcpkg/scripts/buildsystems/vcpkg.cmake)**

project("deepsudoku")

**find_package(frugally-deep CONFIG REQUIRED)**
**target_link_libraries(main PRIVATE frugally-deep::fdeep)**

include_directories(${OpenCV_DIR}/jni/include)

add_library( lib_opencv SHARED IMPORTED )
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION ${OpenCV_DIR}/libs/${ANDROID_ABI}/libopencv_java4.so)

add_library(deepsudoku SHARED native-lib.cpp utils.cpp imageProcessing.cpp HoughAccumulator.cpp)
find_library(log-lib log)
target_link_libraries(deepsudoku PRIVATE -ljnigraphics lib_opencv ${jnigraphic-lib} ${log-lib})

The project was building fine until I added the lines marked by **. Now when I try to build the project, I get a CMake Error in CMakeSystem.cmake located in app/.cxx/Debug/u3j6s5y3/arm64-v8a/CMakeFiles/3.18.1-g262b901-dirty/CMakeSystem.cmake. The file looks like this.

set(CMAKE_HOST_SYSTEM "Windows-10.0.19045")
set(CMAKE_HOST_SYSTEM_NAME "Windows")
set(CMAKE_HOST_SYSTEM_VERSION "10.0.19045")
set(CMAKE_HOST_SYSTEM_PROCESSOR "AMD64")

include("C:/vcpkg/scripts/buildsystems/vcpkg.cmake")

set(CMAKE_SYSTEM "Android-28")
set(CMAKE_SYSTEM_NAME "Android")
set(CMAKE_SYSTEM_VERSION "28")
set(CMAKE_SYSTEM_PROCESSOR "aarch64")

**set(CMAKE_ANDROID_NDK "C:\Android\Sdk\ndk\21.4.7075529")**
set(CMAKE_ANDROID_STANDALONE_TOOLCHAIN "")
set(CMAKE_ANDROID_ARCH "arm64")
set(CMAKE_ANDROID_ARCH_ABI "arm64-v8a")
set(CMAKE_ANDROID_ARCH_TRIPLE "aarch64-linux-android")
set(CMAKE_ANDROID_NDK_DEPRECATED_HEADERS "0")
set(CMAKE_ANDROID_NDK_TOOLCHAIN_HOST_TAG "windows-x86_64")
**set(CMAKE_ANDROID_NDK_TOOLCHAIN_UNIFIED "C:\Android\Sdk\ndk\21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64")
**
set(CMAKE_CROSSCOMPILING "TRUE")

set(CMAKE_SYSTEM_LOADED 1)

I get a syntax error while passing the strings in the lines marked by **(Invalid character escape '\A'). The syntax error emerges because there are backslashes instead of forward slashes in the path of the Android NDK. I tried to change the path by hand, but the file seems to be generated by Android Studio because the file is always reset when I build the project and the same error arises. I also tried to change path of the NDK in the Project Structure section and tried to add a different path by adding ndk.dir to the local.properties file. The actual path of the NDK changes, but it always uses backslashes and the same error while parsing the path is thrown. Is there a way to change the backslashes to forward slashes in the path so that the sting can be parsed? Or is there another to avoid this error?


问:
How to write functor that is constructible from lambda?
When I convert a lambda to an std::function object, it gets converted and in case less than 24 bytes are captured (e.g. this pointer), std::function doesn't issue a heap alloc.

Now my question is how can I construct my own functor from a lambda and extract this-ptr from the lambda to save it in my functors memory layout?


问:
React JS Material UI DataGrid Pagination Alignment
React Js material ui datagrid pagination components not aligned properly

Here is the Rendered pagination of DataGrid

Kindly please suggest ways as how to make it aligned properly...

Thanks in Advance


问:
Recycler View (with Data Binding Position is wrong after Scrolling
Im using Recycler View with data Binding to display a list of Routes.  For Testing there are always (and only) 10 Items (Route1 -10) Every Route has a delete Button, to delete the Row the User picked(From the List and from the RV). When deleting the first or second Item without scrolling, it works just fine and I can delete all Items. But After scrolling, (I think) the Adapter sets the Position to a wrong value and deletes the wrong items. Eventually the program crashes with a IndexOutOfBoundsException.

I tried to use other positions instead of the int position i get from the Adapter:

holder.absoluteAdapterPosition holder.adapterPosition holder.bindingAdapterPosition holder.layoutPosition

Unfortunately it didnt change the outcome.

Then I tried: Kotlin RecyclerView delete item. Is this a bug?
Works better, but after deleting the last item of the List the adapter position is corrupt again.

Finnaly I wrote the onClicklistener for the delete Button inside the View Holder of my Adapter.
Now it works, but I dont understand why. Can someone please explain me this behavior?

```<code>package com.example.testnestedxml

import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.testnestedxml.databinding.ListItemBinding

class RouteAdapter(
    private var routeList: ArrayList<Route>
) :
    RecyclerView.Adapter<RouteViewHolder>() {
    //Fügt alle Items (Views) in eine View
    private lateinit var binding: ListItemBinding

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RouteViewHolder {
        //View wird erstellt
        binding = ListItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
        return RouteViewHolder(binding)
    }

    override fun onBindViewHolder(holder: RouteViewHolder, position: Int) {
        val route = routeList[position]
        holder.routeViewHolderBinding(route, routeList,this)

    }

    override fun getItemCount(): Int = routeList.size
}

package com.example.testnestedxml

import android.content.Intent
import android.os.Handler
import android.util.Log
import android.view.View
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView
import com.example.testnestedxml.databinding.ListItemBinding
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import java.lang.reflect.Type

class RouteViewHolder(
    private val binding: ListItemBinding,
) : RecyclerView.ViewHolder(binding.root) {

    fun routeViewHolderBinding(
        route: Route,
        routeList: ArrayList<Route>,
        routeAdapter: RouteAdapter
    ) {
        binding.name.text = route.name
        binding.dauer.text = route.duration.toString()
        binding.entfernung.text = route.length.toString()

        val itemPosition = layoutPosition
        binding.delete.setOnClickListener {
            routeList.removeAt(itemPosition)
            routeAdapter.notifyDataSetChanged()
            saveDataRouteAdapter(routeList)
        }
    }

    private fun saveDataRouteAdapter(routeList: ArrayList<Route>) {
        val sharedPreferences = binding.root.context.getSharedPreferences(
            "shared preferences",
            AppCompatActivity.MODE_PRIVATE
        )
        val editor = sharedPreferences.edit()
        val gson = Gson()
        val json = gson.toJson(routeList)
        editor.putString("Route list", json)
        editor.apply()
    }
}
</code>```

Body:
Im using Recycler View with data Binding to display a list of Routes.  For Testing there are always (and only) 10 Items (Route1 -10) Every Route has a delete Button, to delete the Row the User picked(From the List and from the RV). When deleting the first or second Item without scrolling, it works just fine and I can delete all Items. But After scrolling, (I think) the Adapter sets the Position to a wrong value and deletes the wrong items. Eventually the program crashes with a IndexOutOfBoundsException.

I tried to use other positions instead of the int position i get from the Adapter:

holder.absoluteAdapterPosition holder.adapterPosition holder.bindingAdapterPosition holder.layoutPosition

Unfortunately it didnt change the outcome.

Then I tried: Kotlin RecyclerView delete item. Is this a bug?
Works better, but after deleting the last item of the List the adapter position is corrupt again.

Finnaly I wrote the onClicklistener for the delete Button inside the View Holder of my Adapter.
Now it works, but I dont understand why. Can someone please explain me this behavior?

package com.example.testnestedxml

import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.example.testnestedxml.databinding.ListItemBinding

class RouteAdapter(
    private var routeList: ArrayList<Route>
) :
    RecyclerView.Adapter<RouteViewHolder>() {
    //Fügt alle Items (Views) in eine View
    private lateinit var binding: ListItemBinding

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RouteViewHolder {
        //View wird erstellt
        binding = ListItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
        return RouteViewHolder(binding)
    }

    override fun onBindViewHolder(holder: RouteViewHolder, position: Int) {
        val route = routeList[position]
        holder.routeViewHolderBinding(route, routeList,this)

    }

    override fun getItemCount(): Int = routeList.size
}

package com.example.testnestedxml

import android.content.Intent
import android.os.Handler
import android.util.Log
import android.view.View
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.RecyclerView
import com.example.testnestedxml.databinding.ListItemBinding
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import java.lang.reflect.Type

class RouteViewHolder(
    private val binding: ListItemBinding,
) : RecyclerView.ViewHolder(binding.root) {

    fun routeViewHolderBinding(
        route: Route,
        routeList: ArrayList<Route>,
        routeAdapter: RouteAdapter
    ) {
        binding.name.text = route.name
        binding.dauer.text = route.duration.toString()
        binding.entfernung.text = route.length.toString()

        val itemPosition = layoutPosition
        binding.delete.setOnClickListener {
            routeList.removeAt(itemPosition)
            routeAdapter.notifyDataSetChanged()
            saveDataRouteAdapter(routeList)
        }
    }

    private fun saveDataRouteAdapter(routeList: ArrayList<Route>) {
        val sharedPreferences = binding.root.context.getSharedPreferences(
            "shared preferences",
            AppCompatActivity.MODE_PRIVATE
        )
        val editor = sharedPreferences.edit()
        val gson = Gson()
        val json = gson.toJson(routeList)
        editor.putString("Route list", json)
        editor.apply()
    }
}


问:
How to allow multiselction in cell using streamlit with st_aggrid?
how to use the multiselect option inside cell in order to allow user to select multiple values and then display the selected values seperated with comma ??

i already work with single selection using the below configuration

```<code>
gd.configure_column('source',width = 500,editable = True,cellEditor = 'agSelectCellEditor',cellEditorParams={"values":["source1","source2","source3"]})
</code>```

the above configuration work perfect.
But now i want to display more than one source where the user can have multiple sources  how could the configuration be changed in order to meet my requirements ?

I will appreciate any help .

Body:
how to use the multiselect option inside cell in order to allow user to select multiple values and then display the selected values seperated with comma ??

i already work with single selection using the below configuration

gd.configure_column('source',width = 500,editable = True,cellEditor = 'agSelectCellEditor',cellEditorParams={"values":["source1","source2","source3"]})

the above configuration work perfect.
But now i want to display more than one source where the user can have multiple sources  how could the configuration be changed in order to meet my requirements ?

I will appreciate any help .


问:
Android studio Chipmunk directories issue
After updating Android studio to Chipmunk when ever I create/Add new activity in project it doesn't reference it according to directory hierarchy which cause app to crash

.ClassNotFoundException: Didn't find class "com.example.splash.MainActivity"

Then I have to go to Manifest and correct the import as shown in images below.

Error snap

After correction snap  (Manually)

How to avoid every time correcting manually? Is there any setting in Android studio? This error exist in Chipmunk version of Android studio before this it was working fine.

If relevant (I add activity by hovering to that package and right click and choose empty activity)

Is this a bug or am I missing something?


问:
How to update the organiser's caldav client without sending mail in sabre dav?
RFC6638 Section 3.2.1 says that if organizer and attendee same don't send mail.

https://www.rfc-editor.org/rfc/rfc6638#section-7.2

Then how to update the organizer's caldav client without sending mail ?
So i got a sabre dav server and it only send update email to attendees and not organizer when there is an update on the event.

So how is it that we update the organizer's caldav client without sending updated ical to the organizer ?


问:
Microsoft ML - M to N SdcaRegression
I am currently writing a regression trainer for a M to N situation using Microsoft.ML in .NET6

I have an input vector of 128 floats and an output vector of 5 floats that I am trying to learn. I managed to get it to work for an M to 1 situation but I am struggling to find what the problem is with my M to N setup.

The problem seems to be how I build my data transformer. Does anyone have a working example project for an M to N regression model using Microsoft ML? The only example code I could find was for price-prediction (a M to 1 example).

Title: Microsoft ML - M to N SdcaRegression


问:
How can I get an output from an endless recursive async function?
I am currently working on a program for which I need an endless counter. For this I am using an async function, which recursivly calls itself over and over again. Since I can't ever return this method and I can't use an out parameter in an async function I am just writing the output into an outside variable. This feels very wrong to me though. Is there a better way to do this?

```<code>public abstract class SkateAI : IAgent
{
protected SkateAI(float movespeed)
{
    MoveSpeed = movespeed;
}

public float MoveSpeed;

protected Vector2 Position = new (0, 0);
protected float BetweenTicker;
protected float StartTime = 0;
protected PeriodicTimer timer = new(TimeSpan.FromMilliseconds(1.0f));
protected bool _isUp;
protected bool _timerStarted;

public Vector2 GetPosition()
{
    return Position;
}

internal async Task TickBetweenTimer(float input, float speedFactor = 1)
{
    if (BetweenTicker >= input)
        _isUp = false;
    else if (BetweenTicker <= 0)
        _isUp = true;

    switch (_isUp)
    {
        case false:
            BetweenTicker -= 0.001f * MoveSpeed * speedFactor;
            break;
        default:
            BetweenTicker += 0.001f * MoveSpeed * speedFactor;
            break;
    }

    await timer.WaitForNextTickAsync(CancellationToken.None);
    TickBetweenTimer(input, speedFactor);
}
</code>```

Body:
I am currently working on a program for which I need an endless counter. For this I am using an async function, which recursivly calls itself over and over again. Since I can't ever return this method and I can't use an out parameter in an async function I am just writing the output into an outside variable. This feels very wrong to me though. Is there a better way to do this?

public abstract class SkateAI : IAgent
{
protected SkateAI(float movespeed)
{
    MoveSpeed = movespeed;
}

public float MoveSpeed;

protected Vector2 Position = new (0, 0);
protected float BetweenTicker;
protected float StartTime = 0;
protected PeriodicTimer timer = new(TimeSpan.FromMilliseconds(1.0f));
protected bool _isUp;
protected bool _timerStarted;

public Vector2 GetPosition()
{
    return Position;
}

internal async Task TickBetweenTimer(float input, float speedFactor = 1)
{
    if (BetweenTicker >= input)
        _isUp = false;
    else if (BetweenTicker <= 0)
        _isUp = true;

    switch (_isUp)
    {
        case false:
            BetweenTicker -= 0.001f * MoveSpeed * speedFactor;
            break;
        default:
            BetweenTicker += 0.001f * MoveSpeed * speedFactor;
            break;
    }

    await timer.WaitForNextTickAsync(CancellationToken.None);
    TickBetweenTimer(input, speedFactor);
}


问:
Jupyter Notebooks not working - SSL Error on 11 ('51.37.246.55', 57941): [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645)
Hi I am trying to set up a jupyter notebook running on an AWS when I run it and paste in the url in my browser I get a connection error saying my ip address uses an unsupported protocol - ERR_SSL_VERSION_OR_CIPHER_MISMATCH and in my terminal I get the following:

```<code>SSL Error on 11 ('51.37.246.55', 57941): [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645)
</code>```

I've tried using a 2048 RSA for my .pem file and updating my versions of python and openssl but still not working

Body:
Hi I am trying to set up a jupyter notebook running on an AWS when I run it and paste in the url in my browser I get a connection error saying my ip address uses an unsupported protocol - ERR_SSL_VERSION_OR_CIPHER_MISMATCH and in my terminal I get the following:

SSL Error on 11 ('51.37.246.55', 57941): [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645)

I've tried using a 2048 RSA for my .pem file and updating my versions of python and openssl but still not working


问:
Moving elements between Tkinter Treeview widgets
I am trying to implement a function that lets me drag and drop treeview entries between N treeview widgets. I played around with detach/insert as well as move. While I got drag and drop reordering within widgets running, I cannot figure out how to drop them into another.</p>


问:
Set up development environment for OSGeo4W/QGIS with C++
I want to set up a development environment to make C++ applications which use QGIS elements like 'map canvas' etc.

I could not find any working tutorial or documentation to solve it with Qt or Visual Studio C++.
Could You please give me some idea to solve it or show the main steps i need to follow?


问:
React localStorage is undefined after LogIn (setItem())
I have a simple React app with a "/login" page in it. After the user logs in, I set the token with localstorage.setItem() and then navigate the user to the main page "/". In there I have different components, and those componenst use different API calls with the token.

All my API calls are in a "services.js" file.

Problem: After log in, the api calls are getting fired, and localstorage.getItem(token) returning null (i guess it is asnyc and takes some time to set the data), 401 Unauthorized

How can I make my app to wait for the localstorage item? What's the best way to acccess my bearer token in the services.js file, where all my api calls lay?

Login component:

    const [token, setToken] = useContext(UserContext);
    const navigate = useNavigate();

    const asyncLocalStorage = {
        getItem: async function () {
            await null;
            return localStorage.getItem('esteticaToken');
        }
    };

    const submitLogin = async () => {
        await logIn({username:username, password:pw})
        .then((response)=>{
            if (response.status === 401) {
                setErrorMessage("Hibás felhasználónév, vagy jelszó!")
                return
            }
            setLoading(false)
            setToken(response.token);

            //I try to wait for the token, and only after navigate to the main page (not working)
            if (asyncLocalStorage.getItem() !== null) {
                navigate("/");
            }

        })
        .catch(()=>setLoading(false))
    };
```
<p>services.js:</p>
```//Main page API calls
export async function getProjects(){
    let config = {
        headers: {
            "Content-Type": "application/json",
            Authorization: "Bearer " + localStorage.getItem('esteticaToken') //this is null
        }
    }

    const { data } = await axios.get(API_URL+'/projects',config)
    return data;
}

export async function getHits(){
    let config = {
        headers: {
            "Content-Type": "application/json",
            Authorization: "Bearer " + localStorage.getItem('esteticaToken')
        }
    }

    const { data } = await axios.get(API_URL+'/hits',config)
    return data;
}
```
<p>My main component, where I call for the api's</p>
```export default function MainPage(){

    //React Query firing the api call from services.js after log in
    const { isFetching: loading, data:dataProjects } = useQuery('projects', getAllProjects)

    return(
...rest of the app
)

```

Body:
I have a simple React app with a "/login" page in it. After the user logs in, I set the token with localstorage.setItem() and then navigate the user to the main page "/". In there I have different components, and those componenst use different API calls with the token.

All my API calls are in a "services.js" file.

Problem: After log in, the api calls are getting fired, and localstorage.getItem(token) returning null (i guess it is asnyc and takes some time to set the data), 401 Unauthorized

How can I make my app to wait for the localstorage item? What's the best way to acccess my bearer token in the services.js file, where all my api calls lay?

Login component:

    const [token, setToken] = useContext(UserContext);
    const navigate = useNavigate();

    const asyncLocalStorage = {
        getItem: async function () {
            await null;
            return localStorage.getItem('esteticaToken');
        }
    };

    const submitLogin = async () => {
        await logIn({username:username, password:pw})
        .then((response)=>{
            if (response.status === 401) {
                setErrorMessage("Hibás felhasználónév, vagy jelszó!")
                return
            }
            setLoading(false)
            setToken(response.token);

            //I try to wait for the token, and only after navigate to the main page (not working)
            if (asyncLocalStorage.getItem() !== null) {
                navigate("/");
            }

        })
        .catch(()=>setLoading(false))
    };

services.js:

//Main page API calls
export async function getProjects(){
    let config = {
        headers: {
            "Content-Type": "application/json",
            Authorization: "Bearer " + localStorage.getItem('esteticaToken') //this is null
        }
    }

    const { data } = await axios.get(API_URL+'/projects',config)
    return data;
}

export async function getHits(){
    let config = {
        headers: {
            "Content-Type": "application/json",
            Authorization: "Bearer " + localStorage.getItem('esteticaToken')
        }
    }

    const { data } = await axios.get(API_URL+'/hits',config)
    return data;
}

My main component, where I call for the api's

export default function MainPage(){

    //React Query firing the api call from services.js after log in
    const { isFetching: loading, data:dataProjects } = useQuery('projects', getAllProjects)

    return(
...rest of the app
)


问:
suggestions on how to make the function more generic(c# .net -> exporting to csv)
so I have the following function

```<code>DataTable GetData()
{
string chargeMonth = DateTime.Now.ToString("yyyyMM");
var creationDate = DateTime.Now.ToString("yyyyMMdd");
string creationTime = DateTime.Now.ToString("HHmmss");
string constVal = "MLL";
string fileType = "HIYUV-CHEVRA";
string fileName;

var connectString = "Data Source=192.168.117.1;User ID=*;Password=*";
OracleConnection con = new OracleConnection();
con.ConnectionString = connectString;
con.Open();

OracleCommand cmd = con.CreateCommand();
cmd.CommandText = "Select * from BAKASHOT_PIRTY_MEIDA WHERE PROD IS NULL and CHARGED = 0";
OracleDataReader reader = cmd.ExecuteReader();
DataTable dt = new DataTable();

dt.Load(cmd.ExecuteReader());
foreach (DataRow row in dt.Rows)
{
DataTable db = new DataTable();
if (row[3].ToString() == "10")
{
cmd.CommandText = "Select * from BAKASHOT_PIRTY_MEIDA WHERE COMPANY_ID = " + row[3].ToString() + " and PROD IS NULL and CHARGED = 1";
//compId = company_id's value
string compId = row[3].ToString();
fileName = constVal + "-" + fileType + "-" + compId + "-" + chargeMonth + "-" + creationDate + "-" + creationTime + ".csv";

db.Load(cmd.ExecuteReader());
ExportExcelGeneric(db, fileName);
}
if (row[3].ToString() == "1000")
{
cmd.CommandText = "Select * from BAKASHOT_PIRTY_MEIDA WHERE COMPANY_ID = " + row[3].ToString() + " and PROD IS NULL and CHARGED = 1";
string compId = row[3].ToString();
fileName = constVal + "-" + fileType + "-" + compId + "-" + chargeMonth + "-" + creationDate + "-" + creationTime + ".csv";

db.Load(cmd.ExecuteReader());
ExportExcelGeneric(db, fileName);
}
}
con.Close();
return dt;
}
</code>```

and this is my csv function:

```<code>  void ExportExcelGeneric(DataTable ds, string filename)
            {

                StreamWriter sw = new StreamWriter("D:\\" + filename, false);
                string y = "D:\\" + filename;
                //headers
                for (int i = 0; i < ds.Columns.Count; i++)
                {
                    sw.Write(ds.Columns[i]);
                    if (i < ds.Columns.Count - 1)
                    {
                        sw.Write(",");
                    }
                }
                sw.Write(sw.NewLine);
                foreach (DataRow dr in ds.Rows)
                {
                    for (int i = 0; i < ds.Columns.Count; i++)
                    {
                        if (!Convert.IsDBNull(dr[i]))
                        {
                            string value = dr[i].ToString();
                            if (value.Contains(','))
                            {
                                value = String.Format("\"{0}\"", value);
                                sw.Write(value);
                            }
                            else
                            {
                                sw.Write(dr[i].ToString());
                            }
                        }
                        if (i < ds.Columns.Count - 1)
                        {
                            sw.Write(",");
                        }
                    }
                    sw.Write(sw.NewLine);
                }
                sw.Close();
            }
</code>```

What it does is basically check for company_id value under company_id column's value taken from database and creates a csv for that specific ID..
as it is now, if for example I have 40records of (row[3].ToString() == "10") the loop will go in every row and do the select query, I want to somehow skip that, and say like : "if you got a companyId of 10, skip the rest until u reach the next one which is 1000, and to make query from database only once per Company_ID.
also, Im trying to avoid hardcoding the companyId in my if statements and Im not kinda sure how to do that., also, Im making the first select and inserting into a datatable before my statements just so I have a variable I can iterate through otherwise I couldnt.. which seems odd and bad practice aswell.
Im pretty new to programming, making everything generic is still tough and I'd like to get some opinions and help .

thanks and have a nice day!

Body:
so I have the following function

DataTable GetData()
{
string chargeMonth = DateTime.Now.ToString("yyyyMM");
var creationDate = DateTime.Now.ToString("yyyyMMdd");
string creationTime = DateTime.Now.ToString("HHmmss");
string constVal = "MLL";
string fileType = "HIYUV-CHEVRA";
string fileName;

var connectString = "Data Source=192.168.117.1;User ID=*;Password=*";
OracleConnection con = new OracleConnection();
con.ConnectionString = connectString;
con.Open();

OracleCommand cmd = con.CreateCommand();
cmd.CommandText = "Select * from BAKASHOT_PIRTY_MEIDA WHERE PROD IS NULL and CHARGED = 0";
OracleDataReader reader = cmd.ExecuteReader();
DataTable dt = new DataTable();

dt.Load(cmd.ExecuteReader());
foreach (DataRow row in dt.Rows)
{
DataTable db = new DataTable();
if (row[3].ToString() == "10")
{
cmd.CommandText = "Select * from BAKASHOT_PIRTY_MEIDA WHERE COMPANY_ID = " + row[3].ToString() + " and PROD IS NULL and CHARGED = 1";
//compId = company_id's value
string compId = row[3].ToString();
fileName = constVal + "-" + fileType + "-" + compId + "-" + chargeMonth + "-" + creationDate + "-" + creationTime + ".csv";

db.Load(cmd.ExecuteReader());
ExportExcelGeneric(db, fileName);
}
if (row[3].ToString() == "1000")
{
cmd.CommandText = "Select * from BAKASHOT_PIRTY_MEIDA WHERE COMPANY_ID = " + row[3].ToString() + " and PROD IS NULL and CHARGED = 1";
string compId = row[3].ToString();
fileName = constVal + "-" + fileType + "-" + compId + "-" + chargeMonth + "-" + creationDate + "-" + creationTime + ".csv";

db.Load(cmd.ExecuteReader());
ExportExcelGeneric(db, fileName);
}
}
con.Close();
return dt;
}

and this is my csv function:

  void ExportExcelGeneric(DataTable ds, string filename)
            {

                StreamWriter sw = new StreamWriter("D:\\" + filename, false);
                string y = "D:\\" + filename;
                //headers
                for (int i = 0; i < ds.Columns.Count; i++)
                {
                    sw.Write(ds.Columns[i]);
                    if (i < ds.Columns.Count - 1)
                    {
                        sw.Write(",");
                    }
                }
                sw.Write(sw.NewLine);
                foreach (DataRow dr in ds.Rows)
                {
                    for (int i = 0; i < ds.Columns.Count; i++)
                    {
                        if (!Convert.IsDBNull(dr[i]))
                        {
                            string value = dr[i].ToString();
                            if (value.Contains(','))
                            {
                                value = String.Format("\"{0}\"", value);
                                sw.Write(value);
                            }
                            else
                            {
                                sw.Write(dr[i].ToString());
                            }
                        }
                        if (i < ds.Columns.Count - 1)
                        {
                            sw.Write(",");
                        }
                    }
                    sw.Write(sw.NewLine);
                }
                sw.Close();
            }

What it does is basically check for company_id value under company_id column's value taken from database and creates a csv for that specific ID..
as it is now, if for example I have 40records of (row[3].ToString() == "10") the loop will go in every row and do the select query, I want to somehow skip that, and say like : "if you got a companyId of 10, skip the rest until u reach the next one which is 1000, and to make query from database only once per Company_ID.
also, Im trying to avoid hardcoding the companyId in my if statements and Im not kinda sure how to do that., also, Im making the first select and inserting into a datatable before my statements just so I have a variable I can iterate through otherwise I couldnt.. which seems odd and bad practice aswell.
Im pretty new to programming, making everything generic is still tough and I'd like to get some opinions and help .

thanks and have a nice day!