问:
How to disable web pack in Angular 14
How to disable web pack in Angular 14 ?

I am not able to debug my code.

Angular JSON

```<code>{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "color-admin": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "allowedCommonJsDependencies": [
                "lodash"
            ],
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ],
            "styles": [
              "src/styles.css",
              "src/scss/angular.scss"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "color-admin:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "color-admin:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "color-admin:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "scripts": [],
            "styles": [
              "src/styles.css"
            ],
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "color-admin-e2e": {
      "root": "",
      "sourceRoot": "",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "./protractor.conf.js",
            "devServerTarget": "color-admin:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "color-admin",
  "schematics": {
    "@schematics/angular:component": {
      "prefix": "app",
      "style": "css"
    },
    "@schematics/angular:directive": {
      "prefix": "app"
    }
  },
  "cli": {
    "analytics": false
  }
}
</code>```

My Package Json -

```<code>{
  "name": "color-admin",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "postinstall": "node remove-css-imports.js ngcc"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/build-angular": "~14.2.1",
    "@angular/animations": "^14.2.0",
    "@angular/cdk": "^14.2.0",
    "@angular/cli": "^14.2.1",
    "@angular/common": "^14.2.0",
    "@angular/compiler": "^14.2.0",
    "@angular/compiler-cli": "^14.2.0",
    "@angular/core": "^14.2.0",
    "@angular/forms": "^14.2.0",
    "@angular/language-service": "^14.2.0",
    "@angular/localize": "^14.2.0",
    "@angular/material": "^14.2.0",
    "@angular/platform-browser": "^14.2.0",
    "@angular/platform-browser-dynamic": "^14.2.0",
    "@angular/router": "^14.2.0",
    "@fortawesome/fontawesome-free": "^6.2.0",
    "@fullcalendar/angular": "^5.11.2",
    "@fullcalendar/bootstrap": "^5.11.3",
    "@fullcalendar/core": "^5.11.3",
    "@fullcalendar/daygrid": "^5.11.3",
    "@fullcalendar/interaction": "^5.11.3",
    "@fullcalendar/list": "^5.11.3",
    "@fullcalendar/resource-timegrid": "^5.11.3",
    "@fullcalendar/timegrid": "^5.11.3",
    "@ng-bootstrap/ng-bootstrap": "^13.0.0",
    "@ngx-loading-bar/core": "^6.0.2",
    "@ngx-loading-bar/router": "^6.0.2",
    "@popperjs/core": "^2.11.6",
    "@sweetalert2/ngx-sweetalert2": "^11.0.0",
    "@swimlane/ngx-charts": "^20.1.0",
    "@swimlane/ngx-datatable": "^20.0.0",
    "@types/jasmine": "~4.3.0",
    "@types/jasminewd2": "~2.0.10",
    "@types/node": "^18.7.15",
    "@yaireo/tagify": "^4.16.4",
    "angular-calendar": "^0.30.1",
    "apexcharts": "^3.35.5",
    "bootstrap": "^5.2.0",
    "bootstrap-icons": "^1.9.1",
    "bootstrap-social": "^5.1.1",
    "chart.js": "^3.9.1",
    "codelyzer": "^6.0.2",
    "core-js": "^3.25.0",
    "d3": "^7.6.1",
    "dart-sass": "^1.25.0",
    "date-fns": "^2.29.2",
    "dayjs": "^1.11.5",
    "fibers": "^5.0.3",
    "flag-icon-css": "^4.1.6",
    "ionicons": "^6.0.3",
    "jasmine-core": "~4.4.0",
    "jasmine-spec-reporter": "~7.0.0",
    "jquery": "^3.6.1",
    "jwt-decode": "^3.1.2",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.1",
    "karma-coverage-istanbul-reporter": "~3.0.3",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "^2.0.0",
    "lity": "^2.4.1",
    "masonry-layout": "^4.2.2",
    "moment": "^2.29.4",
    "ng-apexcharts": "^1.7.1",
    "ng-chartjs": "^0.2.5",
    "ng-masonry-layout": "^8.0.2",
    "ng2-nvd3": "^2.0.0",
    "ngx-color": "^8.0.3",
    "ngx-countdown": "^14.0.0",
    "ngx-daterangepicker-material": "^6.0.2",
    "ngx-editor": "^15.0.0",
    "ngx-highlight-js": "^14.0.0",
    "ngx-highlightjs": "^7.0.1",
    "ngx-masonry": "^13.0.0",
    "ngx-nvd3": "^1.0.9",
    "ngx-perfect-scrollbar": "^10.1.1",
    "ngx-trend": "^8.0.0",
    "nvd3": "^1.8.6",
    "protractor": "~7.0.0",
    "rxjs": "^7.5.6",
    "rxjs-compat": "^6.6.7",
    "simple-line-icons": "^2.5.5",
    "socket.io-client": "^4.5.1",
    "sweetalert2": "^11.4.32",
    "ts-node": "^10.9.1",
    "tslib": "^2.4.0",
    "tslint": "~6.1.3",
    "typescript": "^4.8.2",
    "zone.js": "~0.11.8"
  }
}
</code>```

tsConfig.json

```<code>{
  "compileOnSave": false,
  "compilerOptions": {
    "downlevelIteration": true,
    "importHelpers": true,
    "module": "es2020",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es6",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2015",
      "dom"
    ],
    "paths": { "@angular/*": ["../node_modules/@angular/*"] }
  }
}
</code>```

main.ts

```<code>import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.log(err));
</code>```

pollyfills.ts -

```<code>/***************************************************************************************************
 * Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
 */
import '@angular/localize/init';
/**
 * This file includes polyfills needed by Angular and is loaded before the app.
 * You can add your own extra polyfills to this file.
 *
 * This file is divided into 2 sections:
 *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
 *   2. Application imports. Files imported after ZoneJS that should be loaded before your main
 *      file.
 *
 * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
 * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
 * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
 *
 * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
 */

/***************************************************************************************************
 * BROWSER POLYFILLS
 */

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol';
// import 'core-js/es6/object';
// import 'core-js/es6/function';
// import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float';
// import 'core-js/es6/number';
// import 'core-js/es6/math';
// import 'core-js/es6/string';
// import 'core-js/es6/date';
// import 'core-js/es6/array';
// import 'core-js/es6/regexp';
// import 'core-js/es6/map';
// import 'core-js/es6/weak-map';
// import 'core-js/es6/set';

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js';  // Run `npm install --save classlist.js`.

/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';

/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.

/**
 * Required to support Web Animations `@angular/platform-browser/animations`.
 * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
 **/
// import 'web-animations-js';  // Run `npm install --save web-animations-js`.

/***************************************************************************************************
 * Zone JS is required by default for Angular itself.
 */
import 'zone.js/dist/zone';  // Included with Angular CLI.
</code>```

/***************************************************************************************************

APPLICATION IMPORTS
*/

Each and every time I ran my application, its bundled it and run it inside webpack. I am not able to debug my code.

I want some setting where I can enable and disable the webpack.

Title: How to disable web pack in Angular 14

Body:
How to disable web pack in Angular 14 ?

I am not able to debug my code.

Angular JSON

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "color-admin": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "allowedCommonJsDependencies": [
                "lodash"
            ],
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ],
            "styles": [
              "src/styles.css",
              "src/scss/angular.scss"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "color-admin:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "color-admin:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "color-admin:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "scripts": [],
            "styles": [
              "src/styles.css"
            ],
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "color-admin-e2e": {
      "root": "",
      "sourceRoot": "",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "./protractor.conf.js",
            "devServerTarget": "color-admin:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "color-admin",
  "schematics": {
    "@schematics/angular:component": {
      "prefix": "app",
      "style": "css"
    },
    "@schematics/angular:directive": {
      "prefix": "app"
    }
  },
  "cli": {
    "analytics": false
  }
}

My Package Json -

{
  "name": "color-admin",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "postinstall": "node remove-css-imports.js ngcc"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/build-angular": "~14.2.1",
    "@angular/animations": "^14.2.0",
    "@angular/cdk": "^14.2.0",
    "@angular/cli": "^14.2.1",
    "@angular/common": "^14.2.0",
    "@angular/compiler": "^14.2.0",
    "@angular/compiler-cli": "^14.2.0",
    "@angular/core": "^14.2.0",
    "@angular/forms": "^14.2.0",
    "@angular/language-service": "^14.2.0",
    "@angular/localize": "^14.2.0",
    "@angular/material": "^14.2.0",
    "@angular/platform-browser": "^14.2.0",
    "@angular/platform-browser-dynamic": "^14.2.0",
    "@angular/router": "^14.2.0",
    "@fortawesome/fontawesome-free": "^6.2.0",
    "@fullcalendar/angular": "^5.11.2",
    "@fullcalendar/bootstrap": "^5.11.3",
    "@fullcalendar/core": "^5.11.3",
    "@fullcalendar/daygrid": "^5.11.3",
    "@fullcalendar/interaction": "^5.11.3",
    "@fullcalendar/list": "^5.11.3",
    "@fullcalendar/resource-timegrid": "^5.11.3",
    "@fullcalendar/timegrid": "^5.11.3",
    "@ng-bootstrap/ng-bootstrap": "^13.0.0",
    "@ngx-loading-bar/core": "^6.0.2",
    "@ngx-loading-bar/router": "^6.0.2",
    "@popperjs/core": "^2.11.6",
    "@sweetalert2/ngx-sweetalert2": "^11.0.0",
    "@swimlane/ngx-charts": "^20.1.0",
    "@swimlane/ngx-datatable": "^20.0.0",
    "@types/jasmine": "~4.3.0",
    "@types/jasminewd2": "~2.0.10",
    "@types/node": "^18.7.15",
    "@yaireo/tagify": "^4.16.4",
    "angular-calendar": "^0.30.1",
    "apexcharts": "^3.35.5",
    "bootstrap": "^5.2.0",
    "bootstrap-icons": "^1.9.1",
    "bootstrap-social": "^5.1.1",
    "chart.js": "^3.9.1",
    "codelyzer": "^6.0.2",
    "core-js": "^3.25.0",
    "d3": "^7.6.1",
    "dart-sass": "^1.25.0",
    "date-fns": "^2.29.2",
    "dayjs": "^1.11.5",
    "fibers": "^5.0.3",
    "flag-icon-css": "^4.1.6",
    "ionicons": "^6.0.3",
    "jasmine-core": "~4.4.0",
    "jasmine-spec-reporter": "~7.0.0",
    "jquery": "^3.6.1",
    "jwt-decode": "^3.1.2",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.1",
    "karma-coverage-istanbul-reporter": "~3.0.3",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "^2.0.0",
    "lity": "^2.4.1",
    "masonry-layout": "^4.2.2",
    "moment": "^2.29.4",
    "ng-apexcharts": "^1.7.1",
    "ng-chartjs": "^0.2.5",
    "ng-masonry-layout": "^8.0.2",
    "ng2-nvd3": "^2.0.0",
    "ngx-color": "^8.0.3",
    "ngx-countdown": "^14.0.0",
    "ngx-daterangepicker-material": "^6.0.2",
    "ngx-editor": "^15.0.0",
    "ngx-highlight-js": "^14.0.0",
    "ngx-highlightjs": "^7.0.1",
    "ngx-masonry": "^13.0.0",
    "ngx-nvd3": "^1.0.9",
    "ngx-perfect-scrollbar": "^10.1.1",
    "ngx-trend": "^8.0.0",
    "nvd3": "^1.8.6",
    "protractor": "~7.0.0",
    "rxjs": "^7.5.6",
    "rxjs-compat": "^6.6.7",
    "simple-line-icons": "^2.5.5",
    "socket.io-client": "^4.5.1",
    "sweetalert2": "^11.4.32",
    "ts-node": "^10.9.1",
    "tslib": "^2.4.0",
    "tslint": "~6.1.3",
    "typescript": "^4.8.2",
    "zone.js": "~0.11.8"
  }
}

tsConfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "downlevelIteration": true,
    "importHelpers": true,
    "module": "es2020",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es6",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2015",
      "dom"
    ],
    "paths": { "@angular/*": ["../node_modules/@angular/*"] }
  }
}

main.ts

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.log(err));

pollyfills.ts -

/***************************************************************************************************
 * Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
 */
import '@angular/localize/init';
/**
 * This file includes polyfills needed by Angular and is loaded before the app.
 * You can add your own extra polyfills to this file.
 *
 * This file is divided into 2 sections:
 *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
 *   2. Application imports. Files imported after ZoneJS that should be loaded before your main
 *      file.
 *
 * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
 * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
 * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
 *
 * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
 */

/***************************************************************************************************
 * BROWSER POLYFILLS
 */

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol';
// import 'core-js/es6/object';
// import 'core-js/es6/function';
// import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float';
// import 'core-js/es6/number';
// import 'core-js/es6/math';
// import 'core-js/es6/string';
// import 'core-js/es6/date';
// import 'core-js/es6/array';
// import 'core-js/es6/regexp';
// import 'core-js/es6/map';
// import 'core-js/es6/weak-map';
// import 'core-js/es6/set';

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js';  // Run `npm install --save classlist.js`.

/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';

/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.

/**
 * Required to support Web Animations `@angular/platform-browser/animations`.
 * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
 **/
// import 'web-animations-js';  // Run `npm install --save web-animations-js`.

/***************************************************************************************************
 * Zone JS is required by default for Angular itself.
 */
import 'zone.js/dist/zone';  // Included with Angular CLI.

/***************************************************************************************************

APPLICATION IMPORTS
*/

Each and every time I ran my application, its bundled it and run it inside webpack. I am not able to debug my code.

I want some setting where I can enable and disable the webpack.


来源: stackexchange

问:
Pandas Module: How to edit specific row values without affecting rest of data frame? (Error when using .at and .loc)
I am trying to update a data frame with details of games played by NBA teams. I am trying to add an ELO rating based on the results of the game and update it across the data frame.

I am using the pandas module and my issue is that no matter what method I use: .loc or .at, I still meet the same issue of

```<code>See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  Data.loc[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
/var/folders/jg/wv3bw8156zlf6cvp9mhhr2lm0000gn/T/ipykernel_7131/3774981364.py:20: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
</code>```

This is exactly what I am doing though??? So I don't understand where to go from here.

It seems that my functions work in finding and updating the ELO ratings, but for some reason other columns and rows are altered in the data frame. Below is the data frame shown before and after the function is run:
Data frame as it should be but without ELO Ratings

And here it is below once the function has run:
Data frame with first three columns altered and tail showing Nan values

As you can see the IDs are made into floats instead of integers and there are suddenly null values despite me calling Data = Data.dropna() at the start of the notebook.

Can someone please point out a method where I can edit the data frame and use the updated values in the next iteration of my function, without having unwanted effects on the rest of the data frame as has occurred here.

Below is all my code pertaining to the issue, I've double checked it and I can see no reason as to why the ID column values would be altered or as to why NaN values would replace existing cells.

```<code>#Home and away team win probabilities implied by Elo ratings and home court advantage
def win_probs(home_elo, away_elo):
    h = math.pow(10, home_elo/400)
    r = math.pow(10, away_elo/400)
    a = math.pow(10, 69/400)

    denom = r + a*h
    home_prob = a*h / denom
    away_prob = r / denom

    return home_prob, away_prob

#Function to determine constant used in elo rating, based on margin of victory and difference in elo ratings
def elo_k(mov, elo_diff):
    k = 20
    if mov>0:
        multiplier = (mov+3)**(0.8)/(7.5+0.006*(elo_diff))
    else:
        multiplier=(-mov+3)**(0.8)/(7.5+0.006*(-elo_diff))
    return k*multiplier

#Update home and away elo ratings after a game
def update_elo(pts_home, pts_away, home_elo, away_elo):
    home_prob, away_prob = win_probs(home_elo, away_elo)

    if (pts_home - pts_away > 0):
        home_win = 1
        away_win = 0
    else:
        home_win = 0
        away_win = 1

    k = elo_k(pts_home - pts_away, home_elo - away_elo)

    updated_home_elo = home_elo + k * (home_win - home_prob)
    updated_away_elo = away_elo + k * (away_win - away_prob)

    return updated_home_elo, updated_away_elo

#Takes previous season into account
def get_prev_elo(team, date, season):
    prev_game = Data[(Data["GAME_DATE"] < date) & ((Data["TEAM_ID_HOME"] == team) | (Data["TEAM_ID_AWAY"] == team))]

    ver_team = 0
    ver_elo = 0
    ver_season = 0

    for season_id, team_id, pg_elo in zip(prev_game["SEASON_ID"], prev_game["TEAM_ID_HOME"], prev_game["POST_GAME_ELO_HOME"]):
        ver_season = season_id
        ver_team = team_id
        ver_elo = pg_elo

    for season_id, team_id, pg_elo in zip(prev_game["SEASON_ID"], prev_game["TEAM_ID_AWAY"], prev_game["POST_GAME_ELO_AWAY"]):
        ver_season2 = season_id
        ver_team2 = team_id
        ver_elo2 = pg_elo

    if ver_team == team:
        elo_rating = ver_elo

    elif ver_team2 == team:
        elo_rating = ver_elo2
        ver_season = ver_season2

    if ver_season != season:
        return (0.75 * elo_rating) + (0.25 * 1505)
    else:
        return elo_rating
</code>```
```<code>def fill_elo():

    j = 0

    for (season_id, game_id, date, home_team_id, away_team_id, pts_home, pts_away, elo_home, elo_away) in zip(Data["SEASON_ID"], Data["GAME_ID"], Data["GAME_DATE"], Data["TEAM_ID_HOME"], Data["TEAM_ID_AWAY"], Data["PTS_HOME"],
                                                                                Data["PTS_AWAY"], Data["ELO_HOME"], Data["ELO_AWAY"]):

        print("Iteration #", j)

        post_game_elo_home = 0
        post_game_elo_away = 0

        #UPDATE POST GAME ELOS FOR FIRST TIME ENCOUNTERING TEAM IN DATAFRAME
        if elo_home == 1500 and elo_away == 1500:
            post_game_elo_home, post_game_elo_away = update_elo(pts_home, pts_away, elo_home, elo_away)
            #Data.at[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            #Data.at[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away
            Data.loc[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            Data.loc[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away

        #UPDATE AWAY POST-GAME ELO AND THEN POST-GAME ELOS FOR TEAMS
        elif elo_home == 1500 and elo_away == 0:
            #UPDATE POST GAME ELO FOR AWAY, PRE-GAME FOR CURRENT ITERATION
            pg_elo_away = get_prev_elo(away_team_id, date, season_id)
            #Data.at[j, "ELO_AWAY"] = pg_elo_away
            Data.loc[j, "ELO_AWAY"] = pg_elo_away
            #UPDATE POST GAME ELOS
            post_game_elo_home, post_game_elo_away = update_elo(pts_home, pts_away, elo_home, pg_elo_away)
            #Data.at[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            #Data.at[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away
            Data.loc[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            Data.loc[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away

        #UPDATE HOME POST-GAME ELO AND THEN POST-GAME ELOS FOR TEAMS
        elif elo_home == 0 and elo_away == 1500:
            #UPDATE POST GAME ELO FOR HOME, PRE-GAME FOR CURRENT ITERATION
            pg_elo_home = get_prev_elo(home_team_id, date, season_id)
            #Data.at[j, "ELO_HOME"] = pg_elo_home
            Data.loc[j, "ELO_HOME"] = pg_elo_home
            #UPDATE POST GAME ELOS
            post_game_elo_home, post_game_elo_away = update_elo(pts_home, pts_away, pg_elo_home, elo_away)
            #Data.at[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            #Data.at[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away
            Data.loc[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            Data.loc[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away

        else:
            #UPDATE PRE-GAME ELOS FOR BOTH TEAMS USING POST-GAME OF PREVIOUS ITERATION
            pg_elo_home = get_prev_elo(home_team_id, date, season_id)
            #Data.at[j, "ELO_HOME"] = pg_elo_home
            Data.loc[j, "ELO_HOME"] = pg_elo_home

            pg_elo_away = get_prev_elo(away_team_id, date, season_id)
            #Data.at[j, "ELO_AWAY"] = pg_elo_away
            Data.loc[j, "ELO_AWAY"] = pg_elo_away

            #UPDATE POST-GAME ELOS
            post_game_elo_home, post_game_elo_away = update_elo(pts_home, pts_away, pg_elo_home, pg_elo_away)
            #Data.at[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            #Data.at[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away
            Data.loc[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            Data.loc[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away

        j+=1

    return Data.head()

fill_elo()
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am trying to update a data frame with details of games played by NBA teams. I am trying to add an ELO rating based on the results of the game and update it across the data frame.

I am using the pandas module and my issue is that no matter what method I use: .loc or .at, I still meet the same issue of

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  Data.loc[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
/var/folders/jg/wv3bw8156zlf6cvp9mhhr2lm0000gn/T/ipykernel_7131/3774981364.py:20: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

This is exactly what I am doing though??? So I don't understand where to go from here.

It seems that my functions work in finding and updating the ELO ratings, but for some reason other columns and rows are altered in the data frame. Below is the data frame shown before and after the function is run:
Data frame as it should be but without ELO Ratings

And here it is below once the function has run:
Data frame with first three columns altered and tail showing Nan values

As you can see the IDs are made into floats instead of integers and there are suddenly null values despite me calling Data = Data.dropna() at the start of the notebook.

Can someone please point out a method where I can edit the data frame and use the updated values in the next iteration of my function, without having unwanted effects on the rest of the data frame as has occurred here.

Below is all my code pertaining to the issue, I've double checked it and I can see no reason as to why the ID column values would be altered or as to why NaN values would replace existing cells.

#Home and away team win probabilities implied by Elo ratings and home court advantage
def win_probs(home_elo, away_elo):
    h = math.pow(10, home_elo/400)
    r = math.pow(10, away_elo/400)
    a = math.pow(10, 69/400)

    denom = r + a*h
    home_prob = a*h / denom
    away_prob = r / denom

    return home_prob, away_prob

#Function to determine constant used in elo rating, based on margin of victory and difference in elo ratings
def elo_k(mov, elo_diff):
    k = 20
    if mov>0:
        multiplier = (mov+3)**(0.8)/(7.5+0.006*(elo_diff))
    else:
        multiplier=(-mov+3)**(0.8)/(7.5+0.006*(-elo_diff))
    return k*multiplier

#Update home and away elo ratings after a game
def update_elo(pts_home, pts_away, home_elo, away_elo):
    home_prob, away_prob = win_probs(home_elo, away_elo)

    if (pts_home - pts_away > 0):
        home_win = 1
        away_win = 0
    else:
        home_win = 0
        away_win = 1

    k = elo_k(pts_home - pts_away, home_elo - away_elo)

    updated_home_elo = home_elo + k * (home_win - home_prob)
    updated_away_elo = away_elo + k * (away_win - away_prob)

    return updated_home_elo, updated_away_elo

#Takes previous season into account
def get_prev_elo(team, date, season):
    prev_game = Data[(Data["GAME_DATE"] < date) & ((Data["TEAM_ID_HOME"] == team) | (Data["TEAM_ID_AWAY"] == team))]

    ver_team = 0
    ver_elo = 0
    ver_season = 0

    for season_id, team_id, pg_elo in zip(prev_game["SEASON_ID"], prev_game["TEAM_ID_HOME"], prev_game["POST_GAME_ELO_HOME"]):
        ver_season = season_id
        ver_team = team_id
        ver_elo = pg_elo

    for season_id, team_id, pg_elo in zip(prev_game["SEASON_ID"], prev_game["TEAM_ID_AWAY"], prev_game["POST_GAME_ELO_AWAY"]):
        ver_season2 = season_id
        ver_team2 = team_id
        ver_elo2 = pg_elo

    if ver_team == team:
        elo_rating = ver_elo

    elif ver_team2 == team:
        elo_rating = ver_elo2
        ver_season = ver_season2

    if ver_season != season:
        return (0.75 * elo_rating) + (0.25 * 1505)
    else:
        return elo_rating

def fill_elo():

    j = 0

    for (season_id, game_id, date, home_team_id, away_team_id, pts_home, pts_away, elo_home, elo_away) in zip(Data["SEASON_ID"], Data["GAME_ID"], Data["GAME_DATE"], Data["TEAM_ID_HOME"], Data["TEAM_ID_AWAY"], Data["PTS_HOME"],
                                                                                Data["PTS_AWAY"], Data["ELO_HOME"], Data["ELO_AWAY"]):

        print("Iteration #", j)

        post_game_elo_home = 0
        post_game_elo_away = 0

        #UPDATE POST GAME ELOS FOR FIRST TIME ENCOUNTERING TEAM IN DATAFRAME
        if elo_home == 1500 and elo_away == 1500:
            post_game_elo_home, post_game_elo_away = update_elo(pts_home, pts_away, elo_home, elo_away)
            #Data.at[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            #Data.at[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away
            Data.loc[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            Data.loc[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away

        #UPDATE AWAY POST-GAME ELO AND THEN POST-GAME ELOS FOR TEAMS
        elif elo_home == 1500 and elo_away == 0:
            #UPDATE POST GAME ELO FOR AWAY, PRE-GAME FOR CURRENT ITERATION
            pg_elo_away = get_prev_elo(away_team_id, date, season_id)
            #Data.at[j, "ELO_AWAY"] = pg_elo_away
            Data.loc[j, "ELO_AWAY"] = pg_elo_away
            #UPDATE POST GAME ELOS
            post_game_elo_home, post_game_elo_away = update_elo(pts_home, pts_away, elo_home, pg_elo_away)
            #Data.at[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            #Data.at[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away
            Data.loc[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            Data.loc[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away

        #UPDATE HOME POST-GAME ELO AND THEN POST-GAME ELOS FOR TEAMS
        elif elo_home == 0 and elo_away == 1500:
            #UPDATE POST GAME ELO FOR HOME, PRE-GAME FOR CURRENT ITERATION
            pg_elo_home = get_prev_elo(home_team_id, date, season_id)
            #Data.at[j, "ELO_HOME"] = pg_elo_home
            Data.loc[j, "ELO_HOME"] = pg_elo_home
            #UPDATE POST GAME ELOS
            post_game_elo_home, post_game_elo_away = update_elo(pts_home, pts_away, pg_elo_home, elo_away)
            #Data.at[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            #Data.at[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away
            Data.loc[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            Data.loc[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away

        else:
            #UPDATE PRE-GAME ELOS FOR BOTH TEAMS USING POST-GAME OF PREVIOUS ITERATION
            pg_elo_home = get_prev_elo(home_team_id, date, season_id)
            #Data.at[j, "ELO_HOME"] = pg_elo_home
            Data.loc[j, "ELO_HOME"] = pg_elo_home

            pg_elo_away = get_prev_elo(away_team_id, date, season_id)
            #Data.at[j, "ELO_AWAY"] = pg_elo_away
            Data.loc[j, "ELO_AWAY"] = pg_elo_away

            #UPDATE POST-GAME ELOS
            post_game_elo_home, post_game_elo_away = update_elo(pts_home, pts_away, pg_elo_home, pg_elo_away)
            #Data.at[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            #Data.at[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away
            Data.loc[j, "POST_GAME_ELO_HOME"] = post_game_elo_home
            Data.loc[j, "POST_GAME_ELO_AWAY"] = post_game_elo_away

        j+=1

    return Data.head()

fill_elo()


问:
Django: Move migration file to another application
With the help of "contribute_to_class" function of django model Field, I added one extra field in django.contrib.auth.Permission model.

This is given below:

```<code>if not hasattr(Permission, 'module'):
    module = models.ForeignKey(
        MModule,
        on_delete=models.CASCADE,
        related_name='permissions',
        default=None,
        blank=True,
        null=True
    )
    module.contribute_to_class(Permission, 'module')
</code>```

Everything works fine! The migration file created and migration works perfect.

But the problem is that, migration file created at, lib/python3.10/site-packages/django/contrib/auth/migrations/

can I move this migration file into some other applications I am having (instead of keeping it inside system library) ?

The migration file created is given below:

```<code># Generated by Django 4.1.3 on 2022-12-25 18:16

from django.db import migrations, models
import django.db.models.deletion

class Migration(migrations.Migration):

    dependencies = [
        ('roles_permissions', '0002_mmodule_parent_module'),
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.AddField(
            model_name='permission',
            name='module',
            field=models.ForeignKey(
               blank=True, default=None, null=True,
               on_delete=django.db.models.deletion.CASCADE,
               related_name='permissions', to='roles_permissions.mmodule'
            ),
        ),
    ]
</code>```

can I move this migration file into some other applications I am having ?

Body:
With the help of "contribute_to_class" function of django model Field, I added one extra field in django.contrib.auth.Permission model.

This is given below:

if not hasattr(Permission, 'module'):
    module = models.ForeignKey(
        MModule,
        on_delete=models.CASCADE,
        related_name='permissions',
        default=None,
        blank=True,
        null=True
    )
    module.contribute_to_class(Permission, 'module')

Everything works fine! The migration file created and migration works perfect.

But the problem is that, migration file created at, lib/python3.10/site-packages/django/contrib/auth/migrations/

can I move this migration file into some other applications I am having (instead of keeping it inside system library) ?

The migration file created is given below:

# Generated by Django 4.1.3 on 2022-12-25 18:16

from django.db import migrations, models
import django.db.models.deletion

class Migration(migrations.Migration):

    dependencies = [
        ('roles_permissions', '0002_mmodule_parent_module'),
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.AddField(
            model_name='permission',
            name='module',
            field=models.ForeignKey(
               blank=True, default=None, null=True,
               on_delete=django.db.models.deletion.CASCADE,
               related_name='permissions', to='roles_permissions.mmodule'
            ),
        ),
    ]

can I move this migration file into some other applications I am having ?


问:
Input to reshape is a tensor with 2745600 values, but the requested shape requires a multiple of 1152
I am trying to train a neural network for the final code of Udemy's course on The Complete Self-Driving Car Course - Applied Deep Learning. This is the batch_generator
function:

```<code>def batch_generator(image_paths, steering_ang, batch_size, istraining):

  while True:
    batch_img = []
    batch_steering = []

    for i in range(batch_size):
      random_index = random.randint(0, len(image_paths) -1)

      if istraining:
        im, steering = random_augment(image_paths[random_index], steering_ang[random_index])
      else:
        im = mpimg.imread(image_paths[random_index])
        steering = steering_ang[random_index]

      img_preprocess(im)
      batch_img.append(im)
      batch_steering.append(steering)

    yield (np.asarray(batch_img),np.asarray(batch_steering))
</code>```

, with the nvidia_model defined as:

```<code>def nvidia_model():
  model = Sequential()
  model.add(Convolution2D(24,(5,5),strides=(2,2),input_shape=(66,200,3),activation='elu'))
  model.add(Convolution2D(36,(5,5),strides=(2,2),activation='elu'))
  model.add(Convolution2D(48,(5,5),strides=(2,2),activation='elu'))
  model. Add(Convolution2D(64,(3,3),activation='elu'))
  model.add(Convolution2D(64,(3,3),activation='elu'))
  #model.add(Dropout(0.5))

  model.add(Flatten())
  model.add(Dense(100,activation='elu'))
  #model.add(Dropout(0.5))

  model.add(Dense(50,activation='elu'))
  #model.add(Dropout(0.5))

  model. Add(Dense(10,activation='elu'))
  #model.add(Dropout(0.5))
  model.add(Dense(1))

  optimizer = Adam(learning_rate=1e-3)
  model.compile(loss='mse',optimizer=optimizer)
  return model
</code>```

When I train the model,

```<code>history = model. Fit(batch_generator(X_train, y_train, 100, 1), steps_per_epoch=300, epochs = 10, validation_data = batch_generator(X_valid, y_valid, 100, 0), validation_steps=200, verbose=1, shuffle=1)
</code>```

I get the following error:

```<code>Epoch 1/10
---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
<ipython-input-28-fd22c359b3f3> in <module>
----> 1 history = model.fit(batch_generator(X_train, y_train, 100, 1), steps_per_epoch=200, epochs = 10, validation_data = batch_generator(X_valid, y_valid, 100, 0), validation_steps=200, verbose=1, shuffle=1)

1 frames
/usr/local/lib/python3.8/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
     52   try:
     53     ctx.ensure_initialized()
---> 54     tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
     55                                         inputs, attrs, num_outputs)
     56   except core._NotOkStatusException as e:

InvalidArgumentError: Graph execution error:

Detected at node 'sequential/flatten/Reshape' defined at (most recent call last):
    File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
      exec(code, run_globals)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel_launcher.py", line 16, in <module>
      app.launch_new_instance()
    File "/usr/local/lib/python3.8/dist-packages/traitlets/config/application.py", line 992, in launch_instance
      app.start()
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelapp.py", line 612, in start
      self.io_loop.start()
    File "/usr/local/lib/python3.8/dist-packages/tornado/platform/asyncio.py", line 149, in start
      self.asyncio_loop.run_forever()
    File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
      self._run_once()
    File "/usr/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
      handle._run()
    File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
      self._context.run(self._callback, *self._args)
    File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 690, in <lambda>
      lambda f: self._run_callback(functools.partial(callback, future))
    File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 743, in _run_callback
      ret = callback()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 787, in inner
      self.run()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 748, in run
      yielded = self.gen.send(value)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 381, in dispatch_queue
      yield self.process_one()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 225, in wrapper
      runner = Runner(result, future, yielded)
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 714, in __init__
      self.run()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 748, in run
      yielded = self.gen.send(value)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 365, in process_one
      yield gen.maybe_future(dispatch(*args))
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 268, in dispatch_shell
      yield gen.maybe_future(handler(stream, idents, msg))
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 543, in execute_request
      self.do_execute(
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/ipkernel.py", line 306, in do_execute
      res = shell.run_cell(code, store_history=store_history, silent=silent)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/zmqshell.py", line 536, in run_cell
      return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2854, in run_cell
      result = self._run_cell(
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2881, in _run_cell
      return runner(coro)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/async_helpers.py", line 68, in _pseudo_sync_runner
      coro.send(None)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3057, in run_cell_async
      has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3249, in run_ast_nodes
      if (await self.run_code(code, result,  async_=asy)):
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3326, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
    File "<ipython-input-28-fd22c359b3f3>", line 1, in <module>
      history = model.fit(batch_generator(X_train, y_train, 100, 1), steps_per_epoch=200, epochs = 10, validation_data = batch_generator(X_valid, y_valid, 100, 0), validation_steps=200, verbose=1, shuffle=1)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 1409, in fit
      tmp_logs = self.train_function(iterator)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 1051, in train_function
      return step_function(self, iterator)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 1040, in step_function
      outputs = model.distribute_strategy.run(run_step, args=(data,))
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 1030, in run_step
      outputs = model.train_step(data)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 889, in train_step
      y_pred = self(x, training=True)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 490, in __call__
      return super().__call__(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/base_layer.py", line 1014, in __call__
      outputs = call_fn(inputs, *args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 92, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/sequential.py", line 374, in call
      return super(Sequential, self).call(inputs, training=training, mask=mask)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/functional.py", line 458, in call
      return self._run_internal_graph(
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/functional.py", line 596, in _run_internal_graph
      outputs = node.layer(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/base_layer.py", line 1014, in __call__
      outputs = call_fn(inputs, *args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 92, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/layers/reshaping/flatten.py", line 98, in call
      return tf.reshape(inputs, flattened_shape)
Node: 'sequential/flatten/Reshape'
Input to reshape is a tensor with 2745600 values, but the requested shape requires a multiple of 1152
     [[{{node sequential/flatten/Reshape}}]] [Op:__inference_train_function_1186]
</code>```

I would appreciate any help in resolving this.

I have tried changing the input_shape and batch_size to 1152 for training but that did not help.

Body:
I am trying to train a neural network for the final code of Udemy's course on The Complete Self-Driving Car Course - Applied Deep Learning. This is the batch_generator
function:

def batch_generator(image_paths, steering_ang, batch_size, istraining):

  while True:
    batch_img = []
    batch_steering = []

    for i in range(batch_size):
      random_index = random.randint(0, len(image_paths) -1)

      if istraining:
        im, steering = random_augment(image_paths[random_index], steering_ang[random_index])
      else:
        im = mpimg.imread(image_paths[random_index])
        steering = steering_ang[random_index]

      img_preprocess(im)
      batch_img.append(im)
      batch_steering.append(steering)

    yield (np.asarray(batch_img),np.asarray(batch_steering))

, with the nvidia_model defined as:

def nvidia_model():
  model = Sequential()
  model.add(Convolution2D(24,(5,5),strides=(2,2),input_shape=(66,200,3),activation='elu'))
  model.add(Convolution2D(36,(5,5),strides=(2,2),activation='elu'))
  model.add(Convolution2D(48,(5,5),strides=(2,2),activation='elu'))
  model. Add(Convolution2D(64,(3,3),activation='elu'))
  model.add(Convolution2D(64,(3,3),activation='elu'))
  #model.add(Dropout(0.5))

  model.add(Flatten())
  model.add(Dense(100,activation='elu'))
  #model.add(Dropout(0.5))

  model.add(Dense(50,activation='elu'))
  #model.add(Dropout(0.5))

  model. Add(Dense(10,activation='elu'))
  #model.add(Dropout(0.5))
  model.add(Dense(1))

  optimizer = Adam(learning_rate=1e-3)
  model.compile(loss='mse',optimizer=optimizer)
  return model

When I train the model,

history = model. Fit(batch_generator(X_train, y_train, 100, 1), steps_per_epoch=300, epochs = 10, validation_data = batch_generator(X_valid, y_valid, 100, 0), validation_steps=200, verbose=1, shuffle=1)

I get the following error:

Epoch 1/10
---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
<ipython-input-28-fd22c359b3f3> in <module>
----> 1 history = model.fit(batch_generator(X_train, y_train, 100, 1), steps_per_epoch=200, epochs = 10, validation_data = batch_generator(X_valid, y_valid, 100, 0), validation_steps=200, verbose=1, shuffle=1)

1 frames
/usr/local/lib/python3.8/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
     52   try:
     53     ctx.ensure_initialized()
---> 54     tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
     55                                         inputs, attrs, num_outputs)
     56   except core._NotOkStatusException as e:

InvalidArgumentError: Graph execution error:

Detected at node 'sequential/flatten/Reshape' defined at (most recent call last):
    File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
      return _run_code(code, main_globals, None,
    File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
      exec(code, run_globals)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel_launcher.py", line 16, in <module>
      app.launch_new_instance()
    File "/usr/local/lib/python3.8/dist-packages/traitlets/config/application.py", line 992, in launch_instance
      app.start()
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelapp.py", line 612, in start
      self.io_loop.start()
    File "/usr/local/lib/python3.8/dist-packages/tornado/platform/asyncio.py", line 149, in start
      self.asyncio_loop.run_forever()
    File "/usr/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
      self._run_once()
    File "/usr/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once
      handle._run()
    File "/usr/lib/python3.8/asyncio/events.py", line 81, in _run
      self._context.run(self._callback, *self._args)
    File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 690, in <lambda>
      lambda f: self._run_callback(functools.partial(callback, future))
    File "/usr/local/lib/python3.8/dist-packages/tornado/ioloop.py", line 743, in _run_callback
      ret = callback()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 787, in inner
      self.run()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 748, in run
      yielded = self.gen.send(value)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 381, in dispatch_queue
      yield self.process_one()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 225, in wrapper
      runner = Runner(result, future, yielded)
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 714, in __init__
      self.run()
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 748, in run
      yielded = self.gen.send(value)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 365, in process_one
      yield gen.maybe_future(dispatch(*args))
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 268, in dispatch_shell
      yield gen.maybe_future(handler(stream, idents, msg))
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/kernelbase.py", line 543, in execute_request
      self.do_execute(
    File "/usr/local/lib/python3.8/dist-packages/tornado/gen.py", line 209, in wrapper
      yielded = next(result)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/ipkernel.py", line 306, in do_execute
      res = shell.run_cell(code, store_history=store_history, silent=silent)
    File "/usr/local/lib/python3.8/dist-packages/ipykernel/zmqshell.py", line 536, in run_cell
      return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2854, in run_cell
      result = self._run_cell(
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 2881, in _run_cell
      return runner(coro)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/async_helpers.py", line 68, in _pseudo_sync_runner
      coro.send(None)
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3057, in run_cell_async
      has_raised = await self.run_ast_nodes(code_ast.body, cell_name,
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3249, in run_ast_nodes
      if (await self.run_code(code, result,  async_=asy)):
    File "/usr/local/lib/python3.8/dist-packages/IPython/core/interactiveshell.py", line 3326, in run_code
      exec(code_obj, self.user_global_ns, self.user_ns)
    File "<ipython-input-28-fd22c359b3f3>", line 1, in <module>
      history = model.fit(batch_generator(X_train, y_train, 100, 1), steps_per_epoch=200, epochs = 10, validation_data = batch_generator(X_valid, y_valid, 100, 0), validation_steps=200, verbose=1, shuffle=1)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 1409, in fit
      tmp_logs = self.train_function(iterator)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 1051, in train_function
      return step_function(self, iterator)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 1040, in step_function
      outputs = model.distribute_strategy.run(run_step, args=(data,))
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 1030, in run_step
      outputs = model.train_step(data)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 889, in train_step
      y_pred = self(x, training=True)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 490, in __call__
      return super().__call__(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/base_layer.py", line 1014, in __call__
      outputs = call_fn(inputs, *args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 92, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/sequential.py", line 374, in call
      return super(Sequential, self).call(inputs, training=training, mask=mask)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/functional.py", line 458, in call
      return self._run_internal_graph(
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/functional.py", line 596, in _run_internal_graph
      outputs = node.layer(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/engine/base_layer.py", line 1014, in __call__
      outputs = call_fn(inputs, *args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 92, in error_handler
      return fn(*args, **kwargs)
    File "/usr/local/lib/python3.8/dist-packages/keras/layers/reshaping/flatten.py", line 98, in call
      return tf.reshape(inputs, flattened_shape)
Node: 'sequential/flatten/Reshape'
Input to reshape is a tensor with 2745600 values, but the requested shape requires a multiple of 1152
     [[{{node sequential/flatten/Reshape}}]] [Op:__inference_train_function_1186]

I would appreciate any help in resolving this.

I have tried changing the input_shape and batch_size to 1152 for training but that did not help.


问:
How Can I Recognize Symbol Type?
I am new in mql5 and write below code for Sell in OnTick().
I want print the last position opened type and tried many way by POSITION_TYPE but I Could not do that.
how and where should I write my code about type Or other Properties of position?</p>
```<code>if(Rsi >= 50 && PositionsTotal()==0)
        {
         trade.Sell(Vol1,NULL,Ask,NULL,NULL,NULL);
         trade.SellLimit(Vol2,Ask+0.0030,NULL,NULL,NULL);
         trade.SellLimit(Vol3,Ask+0.0060,NULL,NULL,NULL);
        }

</code>```

Title: How Can I Recognize Symbol Type?

Body:
I am new in mql5 and write below code for Sell in OnTick().
I want print the last position opened type and tried many way by POSITION_TYPE but I Could not do that.
how and where should I write my code about type Or other Properties of position?

if(Rsi >= 50 && PositionsTotal()==0)
        {
         trade.Sell(Vol1,NULL,Ask,NULL,NULL,NULL);
         trade.SellLimit(Vol2,Ask+0.0030,NULL,NULL,NULL);
         trade.SellLimit(Vol3,Ask+0.0060,NULL,NULL,NULL);
        }


问:
Why am I receiving an error in CLI when inputting this command?
```<code>(new-object System.Net.WebClient).DownloadFile($URL, $OUTPUT_FILE)
</code>```

That command above is simply a copy-paste that I'm instructed to input into CLI.  This is the error it returns:

"Exception calling "DownloadFile" with "2" argument(s):  "An exception
occurred during a WebClient request."

The exam only calls for me to input a number of preset commands, but it won't take the above command to continue.  This is for Coursera.  Any ideas?

As for what I tried, I don't know enough to try anything other than seeking troubleshooting advice because Coursera has seemingly terrible student support for specific labs.

Body:
(new-object System.Net.WebClient).DownloadFile($URL, $OUTPUT_FILE)

That command above is simply a copy-paste that I'm instructed to input into CLI.  This is the error it returns:

"Exception calling "DownloadFile" with "2" argument(s):  "An exception
occurred during a WebClient request."

The exam only calls for me to input a number of preset commands, but it won't take the above command to continue.  This is for Coursera.  Any ideas?

As for what I tried, I don't know enough to try anything other than seeking troubleshooting advice because Coursera has seemingly terrible student support for specific labs.


问:
Typo3 clearing sys_file_processedfile throws errors in BE > Log
When I cleared sys_file_processedfile , following this post: is it possible to truncate sys_file_processedfile? , it does cause further errors:

This deletes all files in the table sys_files_processedfiles in the database (except for one file).
In /fileadmin/processed/ the folderstructure remains and all files are deleted as well.
This is great.

However, in Backend > Log, it then throws steadily errors, all the same only differing in the uid, e.g.:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1314354065: Could not find row with UID "112233" in table "sys_file_processedfile" | RuntimeException thrown in file /customer/12345/files/typo3/typo3_src.9.5.xx/typo3/sysext/core/Classes/Resource/AbstractRepository.php in line 208. Requested URL: https://domain.tld/index.php?eID=dumpFile&t=p&p=112233&token=--AnonymizedToken--

Please for a hint, what is wrong, how this error can be amended. Thank you.

I tried to clean up before initiating a backup.


问:
pip3 using a different Python version than pyenv has activated
I've installed pyenv to activate Python 3.9, and that appears to have worked:

maxghenis@MacBook-Air-3 policyengine-canada % pyenv versions
  system
* 3.9.16 (set by /Users/maxghenis/.pyenv/version)
maxghenis@MacBook-Air-3 policyengine-canada % python -V
Python 3.9.6
```
<p>But when I run <code>pip3 install -e .</code> in this project, it fails with an error message that suggests it's using Python 3.10:</p>
<pre class="lang-bash prettyprint-override"><code>× Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Error in sitecustomize; set PYTHONVERBOSE for traceback:
      AssertionError:
      Traceback (most recent call last):
        File "/opt/homebrew/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
</code>```

How can I ensure that pip3 uses 3.9?

Body:
I've installed pyenv to activate Python 3.9, and that appears to have worked:

maxghenis@MacBook-Air-3 policyengine-canada % pyenv versions
  system
* 3.9.16 (set by /Users/maxghenis/.pyenv/version)
maxghenis@MacBook-Air-3 policyengine-canada % python -V
Python 3.9.6

But when I run pip3 install -e . in this project, it fails with an error message that suggests it's using Python 3.10:

× Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Error in sitecustomize; set PYTHONVERBOSE for traceback:
      AssertionError:
      Traceback (most recent call last):
        File "/opt/homebrew/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>

How can I ensure that pip3 uses 3.9?


问:
Getting error at building the Kernel Xiaomi Mi A2 (jasmine_sprout)
I have been trying to build the Kernel Xiaomi Mi A2 (jasmine_sprout) for a week now and still get the always the same error, though I'm able to build other versions from time to time. I'm trying to make a custom kernel to support NetHunter function.

Here are the error message and the log file.

What might be the problem? Any help would be appreciated.


问:
How to setup Django channels on GCP App Engine?
I have a Django application that uses the channels package for WebSocket.  I'm using the daphne interface server to run the app on the Google Cloud App Engine Flex environment, but the backend service is not able to serve concurrent requests. Is there anyone who faced similar problems before?</p>


问:
How do I preserve installations when exiting colab?
When I use a notebook in Colab, it might take some time to install all dependencies that it might require.

Is it the nature of a Colab notebook that it will cease to exist when exited, like a sandbox? Or is there a way to preserve the installations?

An example:
coquiAI installs so many dependencies that it might take 10 minutes.
I wonder if I really have to do that each time I start the notebook.


问:
connect to website with python and clouscraper
All in the title I guess. I want to connect to some website protect by cloudflare, I am able to scrap data but can't find a way to scrap data data that requires logging in first.

```<code>def login(email, password):
    scraper = cloudscraper.create_scraper()
    playload = {
        'email': email,
        'password' : password,
        "recaptchaToken":"token"
    }
    r = scraper.get('https://sell.wethenew.com/fr/login')
    s = scraper.post('https://sell.wethenew.com/api/auth/login', json=playload)
    t = scraper.get('https://sell.wethenew.com/fr/profile')
    return s

#print(login(userInfo.myUsername, userInfo.myPassword).text)

def scrapMyInfo():
    r = login(userInfo.myUsername, userInfo.myPassword).text
    soup = BeautifulSoup(r, "html.parser")
    name = soup.find('span', class_="LoginTemplate_ForgottenPassword__TkxNZ")
    return name
</code>```

the login function is to connect to the website, the function scrapmyinfo is to scrap of course

Thanks

Body:
All in the title I guess. I want to connect to some website protect by cloudflare, I am able to scrap data but can't find a way to scrap data data that requires logging in first.

def login(email, password):
    scraper = cloudscraper.create_scraper()
    playload = {
        'email': email,
        'password' : password,
        "recaptchaToken":"token"
    }
    r = scraper.get('https://sell.wethenew.com/fr/login')
    s = scraper.post('https://sell.wethenew.com/api/auth/login', json=playload)
    t = scraper.get('https://sell.wethenew.com/fr/profile')
    return s

#print(login(userInfo.myUsername, userInfo.myPassword).text)

def scrapMyInfo():
    r = login(userInfo.myUsername, userInfo.myPassword).text
    soup = BeautifulSoup(r, "html.parser")
    name = soup.find('span', class_="LoginTemplate_ForgottenPassword__TkxNZ")
    return name

the login function is to connect to the website, the function scrapmyinfo is to scrap of course

Thanks


问:
403 Forbidden RelayServiceException: Forbidden: inactive or inexistent project - Unity Gaming services
On a created and linked project from Unity dashboard multiplayer to Unity project, is showing this error when I tried to create allocation and make joincode. It can login anonymously with no problem but it shows this error:

```<code>HttpException`1: (403) HTTP/1.1 403 Forbidden
Unity.Services.Relay.Http.ResponseHandler.HandleAsyncResponse (Unity.Services.Relay.Http.HttpClientResponse response, System.Collections.Generic.Dictionary`2[TKey,TValue] statusCodeToTypeMap) (at Library/PackageCache/com.unity.services.relay@1.0.5/Runtime/Http/ResponseHandler.cs:122)
Unity.Services.Relay.Http.ResponseHandler.HandleAsyncResponse[T] (Unity.Services.Relay.Http.HttpClientResponse response, System.Collections.Generic.Dictionary`2[TKey,TValue] statusCodeToTypeMap) (at Library/PackageCache/com.unity.services.relay@1.0.5/Runtime/Http/ResponseHandler.cs:226)
Unity.Services.Relay.Apis.RelayAllocations.RelayAllocationsApiClient.CreateAllocationAsync (Unity.Services.Relay.RelayAllocations.CreateAllocationRequest request, Unity.Services.Relay.Configuration operationConfiguration) (at Library/PackageCache/com.unity.services.relay@1.0.5/Runtime/Apis/RelayAllocationsApi.cs:131)
Unity.Services.Relay.WrappedRelayService.CreateAllocationAsync (System.Int32 maxConnections, System.String region) (at Library/PackageCache/com.unity.services.relay@1.0.5/Runtime/SDK/WrappedRelayService.cs:66)
Rethrow as RelayServiceException: Forbidden: inactive or inexistent project
Unity.Services.Relay.WrappedRelayService.CreateAllocationAsync (System.Int32 maxConnections, System.String region) (at Library/PackageCache/com.unity.services.relay@1.0.5/Runtime/SDK/WrappedRelayService.cs:73)
TestRelay.CreateServer () (at Assets/Scripts/TestRelay.cs:42)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <d6232873609549b8a045fa15811a5bd3>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <685c48cf8f0b48abb797275c046dda6a>:0)
UnityEngine.UnitySynchronizationContext.Exec () (at <685c48cf8f0b48abb797275c046dda6a>:0)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <685c48cf8f0b48abb797275c046dda6a>:0)
</code>```

Code:

```<code>// Start is called before the first frame update
void Start()
{
    Example_AuthenticatingAPlayer();
}

public async void CreateServer()
{
    Allocation allocation = await RelayService.Instance.CreateAllocationAsync(3);

    string joinCode = await RelayService.Instance.GetJoinCodeAsync(allocation.AllocationId);

    Debug.Log("joinCode: "+ joinCode);

    // Display the joinCode to the user.

    Debug.Log("server created");
}

public void CreateClient()
{
    Example_ConfigreTransportAndStartNgoAsConnectingPlayer();

    Debug.Log("client created");
}

async void Example_AuthenticatingAPlayer()
{
    try
    {
        await UnityServices.InitializeAsync();

        await AuthenticationService.Instance.SignInAnonymouslyAsync();
        var playerID = AuthenticationService.Instance.PlayerId;

        Debug.Log("playerID: "+playerID);

    }
    catch (Exception e)
    {
        Debug.Log(e);
    }
}
</code>```

All the multiplayer services such as relay and lobby are enabled. So what can be the issue?

Body:
On a created and linked project from Unity dashboard multiplayer to Unity project, is showing this error when I tried to create allocation and make joincode. It can login anonymously with no problem but it shows this error:

HttpException`1: (403) HTTP/1.1 403 Forbidden
Unity.Services.Relay.Http.ResponseHandler.HandleAsyncResponse (Unity.Services.Relay.Http.HttpClientResponse response, System.Collections.Generic.Dictionary`2[TKey,TValue] statusCodeToTypeMap) (at Library/PackageCache/com.unity.services.relay@1.0.5/Runtime/Http/ResponseHandler.cs:122)
Unity.Services.Relay.Http.ResponseHandler.HandleAsyncResponse[T] (Unity.Services.Relay.Http.HttpClientResponse response, System.Collections.Generic.Dictionary`2[TKey,TValue] statusCodeToTypeMap) (at Library/PackageCache/com.unity.services.relay@1.0.5/Runtime/Http/ResponseHandler.cs:226)
Unity.Services.Relay.Apis.RelayAllocations.RelayAllocationsApiClient.CreateAllocationAsync (Unity.Services.Relay.RelayAllocations.CreateAllocationRequest request, Unity.Services.Relay.Configuration operationConfiguration) (at Library/PackageCache/com.unity.services.relay@1.0.5/Runtime/Apis/RelayAllocationsApi.cs:131)
Unity.Services.Relay.WrappedRelayService.CreateAllocationAsync (System.Int32 maxConnections, System.String region) (at Library/PackageCache/com.unity.services.relay@1.0.5/Runtime/SDK/WrappedRelayService.cs:66)
Rethrow as RelayServiceException: Forbidden: inactive or inexistent project
Unity.Services.Relay.WrappedRelayService.CreateAllocationAsync (System.Int32 maxConnections, System.String region) (at Library/PackageCache/com.unity.services.relay@1.0.5/Runtime/SDK/WrappedRelayService.cs:73)
TestRelay.CreateServer () (at Assets/Scripts/TestRelay.cs:42)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <d6232873609549b8a045fa15811a5bd3>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <685c48cf8f0b48abb797275c046dda6a>:0)
UnityEngine.UnitySynchronizationContext.Exec () (at <685c48cf8f0b48abb797275c046dda6a>:0)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <685c48cf8f0b48abb797275c046dda6a>:0)

Code:

// Start is called before the first frame update
void Start()
{
    Example_AuthenticatingAPlayer();
}

public async void CreateServer()
{
    Allocation allocation = await RelayService.Instance.CreateAllocationAsync(3);

    string joinCode = await RelayService.Instance.GetJoinCodeAsync(allocation.AllocationId);

    Debug.Log("joinCode: "+ joinCode);

    // Display the joinCode to the user.

    Debug.Log("server created");
}

public void CreateClient()
{
    Example_ConfigreTransportAndStartNgoAsConnectingPlayer();

    Debug.Log("client created");
}

async void Example_AuthenticatingAPlayer()
{
    try
    {
        await UnityServices.InitializeAsync();

        await AuthenticationService.Instance.SignInAnonymouslyAsync();
        var playerID = AuthenticationService.Instance.PlayerId;

        Debug.Log("playerID: "+playerID);

    }
    catch (Exception e)
    {
        Debug.Log(e);
    }
}

All the multiplayer services such as relay and lobby are enabled. So what can be the issue?


问:
Using call-preserved registers vs just the stack for saving values around a function call
Take:

```<code>void callee(void);
long call_and_ret_saved(long ToSave){
    callee();
    return ToSave;
}
</code>```

where the generated assembly will need to save the value of the ToSave argument in order to be able to return it after the call to callee.

Both gcc and clang generate:

```<code>call_and_ret_saved:
    pushq   %rbx
    movq    %rdi, %rbx
    call    callee
    movq    %rbx, %rax
    popq    %rbx
    ret
</code>```

for it. Why not simply push %rdi; call callee; pop %rax; ret; ? Does using the call-preserved register make the return value available sooner or something?

Body:
Take:

void callee(void);
long call_and_ret_saved(long ToSave){
    callee();
    return ToSave;
}

where the generated assembly will need to save the value of the ToSave argument in order to be able to return it after the call to callee.

Both gcc and clang generate:

call_and_ret_saved:
    pushq   %rbx
    movq    %rdi, %rbx
    call    callee
    movq    %rbx, %rax
    popq    %rbx
    ret

for it. Why not simply push %rdi; call callee; pop %rax; ret; ? Does using the call-preserved register make the return value available sooner or something?


问:
How can I create a task that sets environment variables then runs another task?
I have a task(named "run"). I would like to create a task called "runDev" that configures environment variables and then calls "run". I'm unsure currently how to do this after some research.

I have tried using the following:

```<code>tasks.register("runDev", JavaExec::class) {
    environment("server_env", "dev")
    finalizedBy("run")
}
</code>```

But Gradle tells me runDev failed after trying to run it

Body:
I have a task(named "run"). I would like to create a task called "runDev" that configures environment variables and then calls "run". I'm unsure currently how to do this after some research.

I have tried using the following:

tasks.register("runDev", JavaExec::class) {
    environment("server_env", "dev")
    finalizedBy("run")
}

But Gradle tells me runDev failed after trying to run it


问:
Issue with permission on Apache Flume (Binding host with port)
I recently just got an api from meteomatics.com and i'm trying to send some data to HDFS using Apache flume btu i got this problem.

Problem :

```<code> '19:56:58.789 [lifecycleSupervisor-1-0] ERROR org.apache.flume.source.http.HTTPSource - Error while starting HTTPSource. Exception follows.
java.io.IOException: Failed to bind to api.meteomatics.com/37.208.109.220:443
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349) ~[jetty-server-9.4.41.v20210516.jar:9.4.41.v20210516]
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_292]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) ~[?:1.8.0_292]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_292]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_292]
at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_292]
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_292]
at sun.nio.ch.Net.bind(Net.java:461) ~[?:1.8.0_292]
at sun.nio.ch.Net.bind(Net.java:453) ~[?:1.8.0_292]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222) ~[?:1.8.0_292]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85) ~[?:1.8.0_292]
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344) ~[jetty-server-9.4.41.v20210516.jar:9.4.41.v20210516]
... 16 more
19:56:58.810 [lifecycleSupervisor-1-0] ERROR org.apache.flume.lifecycle.LifecycleSupervisor - Unable to start EventDrivenSourceRunner: { source:org.apache.flume.source.http.HTTPSource{name:r1,state:IDLE} } - Exception follows.
java.lang.RuntimeException: java.io.IOException: Failed to bind to api.meteomatics.com/37.208.109.220:443
at com.google.common.base.Throwables.propagate(Throwables.java:156) ~[guava-11.0.2.jar:?]
at org.apache.flume.source.http.HTTPSource.start(HTTPSource.java:204) ~[flume-ng-core-1.11.0.jar:1.11.0]
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_292]
at sun.nio.ch.Net.bind(Net.java:461) ~[?:1.8.0_292]
at sun.nio.ch.Net.bind(Net.java:453) ~[?:1.8.0_292]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222) ~[?:1.8.0_292]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85) ~[?:1.8.0_292]
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344) ~[jetty-server-9.4.41.v20210516.jar:9.4.41.v20210516]'
</code>```

Conf file :

```<code>a1.sources = r1
a1.channels = c1
a1.sinks = k1

a1.sources.r1.type = http
a1.sources.r1.bind = api.meteomatics.com
a1.sources.r1.port = 443
a1.sources.r1.handler = org.apache.flume.source.http.JSONHandler
a1.sources.r1.handler.properties = ssl,timestamp,status,method,headers,remoteHost,logger,requestURI

a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = hdfs://localhost:9000/user/MeteoData
a1.sinks.k1.hdfs.batchSize = 1000
a1.sinks.k1.hdfs.filePrefix = brahim
a1.sinks.k1.hdfs.fileType = DataStream
a1.sinks.k1.hdfs.rollSize = 0

a1.channels.c1.type = memory
a1.channels.c1.capacity = 10000
a1.channels.c1.transactionCapacity = 100

a1.sources.r1.channels = c1
a1.sinks.r1.channel = c1
</code>```

i execute with this :
flume-ng agent -n a1 -c conf -f /home/ubuntu1/apache-flume-1.11.0-bin/conf/meteoconf1.conf

Can someone please tell me how to solve this problem.

i don't know what to try to fix this problem i tried executing as sudo (path_of_flume-ng) agent -n a1 -c conf -f /home/ubuntu1/apache-flume-1.11.0-bin/conf/meteoconf1.conf it didn't solve the problem
i also checked :
netstat -an | grep api.meteomatics.com:443
nothing is using the port there
telnet api.meteomatics.com 443
and this one works it gives connected

Body:
I recently just got an api from meteomatics.com and i'm trying to send some data to HDFS using Apache flume btu i got this problem.

Problem :

 '19:56:58.789 [lifecycleSupervisor-1-0] ERROR org.apache.flume.source.http.HTTPSource - Error while starting HTTPSource. Exception follows.
java.io.IOException: Failed to bind to api.meteomatics.com/37.208.109.220:443
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349) ~[jetty-server-9.4.41.v20210516.jar:9.4.41.v20210516]
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_292]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) ~[?:1.8.0_292]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_292]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_292]
at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_292]
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_292]
at sun.nio.ch.Net.bind(Net.java:461) ~[?:1.8.0_292]
at sun.nio.ch.Net.bind(Net.java:453) ~[?:1.8.0_292]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222) ~[?:1.8.0_292]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85) ~[?:1.8.0_292]
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344) ~[jetty-server-9.4.41.v20210516.jar:9.4.41.v20210516]
... 16 more
19:56:58.810 [lifecycleSupervisor-1-0] ERROR org.apache.flume.lifecycle.LifecycleSupervisor - Unable to start EventDrivenSourceRunner: { source:org.apache.flume.source.http.HTTPSource{name:r1,state:IDLE} } - Exception follows.
java.lang.RuntimeException: java.io.IOException: Failed to bind to api.meteomatics.com/37.208.109.220:443
at com.google.common.base.Throwables.propagate(Throwables.java:156) ~[guava-11.0.2.jar:?]
at org.apache.flume.source.http.HTTPSource.start(HTTPSource.java:204) ~[flume-ng-core-1.11.0.jar:1.11.0]
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_292]
at sun.nio.ch.Net.bind(Net.java:461) ~[?:1.8.0_292]
at sun.nio.ch.Net.bind(Net.java:453) ~[?:1.8.0_292]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222) ~[?:1.8.0_292]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85) ~[?:1.8.0_292]
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344) ~[jetty-server-9.4.41.v20210516.jar:9.4.41.v20210516]'

Conf file :

a1.sources = r1
a1.channels = c1
a1.sinks = k1

a1.sources.r1.type = http
a1.sources.r1.bind = api.meteomatics.com
a1.sources.r1.port = 443
a1.sources.r1.handler = org.apache.flume.source.http.JSONHandler
a1.sources.r1.handler.properties = ssl,timestamp,status,method,headers,remoteHost,logger,requestURI

a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path = hdfs://localhost:9000/user/MeteoData
a1.sinks.k1.hdfs.batchSize = 1000
a1.sinks.k1.hdfs.filePrefix = brahim
a1.sinks.k1.hdfs.fileType = DataStream
a1.sinks.k1.hdfs.rollSize = 0

a1.channels.c1.type = memory
a1.channels.c1.capacity = 10000
a1.channels.c1.transactionCapacity = 100

a1.sources.r1.channels = c1
a1.sinks.r1.channel = c1

i execute with this :
flume-ng agent -n a1 -c conf -f /home/ubuntu1/apache-flume-1.11.0-bin/conf/meteoconf1.conf

Can someone please tell me how to solve this problem.

i don't know what to try to fix this problem i tried executing as sudo (path_of_flume-ng) agent -n a1 -c conf -f /home/ubuntu1/apache-flume-1.11.0-bin/conf/meteoconf1.conf it didn't solve the problem
i also checked :
netstat -an | grep api.meteomatics.com:443
nothing is using the port there
telnet api.meteomatics.com 443
and this one works it gives connected


问:
How to retrieve coordinates from a grid
I generated a grid of points using this code:

```<code>import numpy as np
import matplotlib.pyplot as plt
N1=15
N2=10
x = np.arange(0, N1)
y = np.arange(0, N2)
T1, T2 = np.meshgrid(x, y)

plt.scatter(T1,T2)
plt.grid()

</code>```

i want to retrieve the 2-D coordinates from the points in the grid in a matrix form.

I tried to use a layout to get the coordinates

Title: How to retrieve coordinates from a grid

Body:
I generated a grid of points using this code:

import numpy as np
import matplotlib.pyplot as plt
N1=15
N2=10
x = np.arange(0, N1)
y = np.arange(0, N2)
T1, T2 = np.meshgrid(x, y)

plt.scatter(T1,T2)
plt.grid()

i want to retrieve the 2-D coordinates from the points in the grid in a matrix form.

I tried to use a layout to get the coordinates


问:
Is there a way to set independent CAs for each path in NodeJS?
I was experimenting with using mTLS in express (nodejs) and I was wandering if I could set different CAs for each of my existing paths/nodes.

My code right now (server.js) looks like this:

```<code>const options = {
    port: config.PORT,
    key: fs.readFileSync(config.KEY_PATH),
    cert: fs.readFileSync(config.CERT_PATH),
    ca: [
        fs.readFileSync(config.CA_CERT_PATH),
    ],
    passphrase: config.CERT_PASSPHRASE,
    port: config.PORT,
    requestCert: true,
    rejectUnauthorized: true
};

const server = https.createServer(options, app);

server.listen(config.PORT, () => {
    logger.info(`Server running on port ${config.PORT}`);
});
</code>```

In the app I have the node: /news with 3 sub-nodes: /public, /private, /admin.
As you can see in the code above the server uses a single CA for client authentication. Could I write a piece of code that lets me assign no CA for node /public, a CA for node /admin, and the same CA as admin plus a new CA for /private?

I hope I made myself understood about what I want to achieve.

Body:
I was experimenting with using mTLS in express (nodejs) and I was wandering if I could set different CAs for each of my existing paths/nodes.

My code right now (server.js) looks like this:

const options = {
    port: config.PORT,
    key: fs.readFileSync(config.KEY_PATH),
    cert: fs.readFileSync(config.CERT_PATH),
    ca: [
        fs.readFileSync(config.CA_CERT_PATH),
    ],
    passphrase: config.CERT_PASSPHRASE,
    port: config.PORT,
    requestCert: true,
    rejectUnauthorized: true
};

const server = https.createServer(options, app);

server.listen(config.PORT, () => {
    logger.info(`Server running on port ${config.PORT}`);
});

In the app I have the node: /news with 3 sub-nodes: /public, /private, /admin.
As you can see in the code above the server uses a single CA for client authentication. Could I write a piece of code that lets me assign no CA for node /public, a CA for node /admin, and the same CA as admin plus a new CA for /private?

I hope I made myself understood about what I want to achieve.


问:
Linking Error by building component for Clang Embarcadero XE11 win32
When i'm trying to create component for Clang Embarcadero XE11 win32.After compelation it showing no errors, but when it's going by Link that error apearing. Here's the listing of Properity Editor:
"[ilink32 Error] Error: Export tpdsc Mypnl::TPnlPropEdtr in module C:\PRG\XE11\EXAMPLES\CLANGCOMPONENT\WIN32\DEBUG\MUPNLPROPEDIT.OBJ references tpdsc Designeditors::TWideStringProperty in unit C:\PROGRAM FILES (X86)\EMBARCADERO\STUDIO\22.0\LIB\WIN32\RELEASE\DESIGNIDE.BPI|DesignEditors.pas"

What Am I doing wrong? What do i need to do to make it right? Thank you for your answers

```<code>#include "MyPnl.h"
#include <DesignEditors.hpp>
#include <System.WideStrings.hpp>
namespace Mypnl {

class TPnlPropEdtr : public TWideStringProperty {
    public:
        inline __fastcall virtual   __fastcall TPnlPropEdtr( const Designintf::_di_IDesigner ADesigner, int APropCount) :
                                                                                TWideStringProperty( ADesigner, APropCount) {};
        inline __fastcall  virtual ~TPnlPropEdtr( void) {};
        virtual Designintf::TPropertyAttributes __fastcall GetAttributes();
        virtual void __fastcall GetValues( Designintf::TGetWideStrProc Proc);
};
using namespace Mypnl;
#endif

*.cpp
#pragma hdrstop
#include "MuPnlPropEdit.h"

TPropertyAttributes __fastcall TPnlPropEdtr::GetAttributes()
{
    TPropertyAttributes Attributes;
    return Attributes << TPropertyAttribute::paValueList << TPropertyAttribute::paAutoUpdate;
}

void __fastcall TPnlPropEdtr::GetValues( Designintf::TGetWideStrProc Proc)
{
  Proc( L"COM1");
  Proc( L"COM2");
  Proc( L"COM3");
}
</code>```

Body:
When i'm trying to create component for Clang Embarcadero XE11 win32.After compelation it showing no errors, but when it's going by Link that error apearing. Here's the listing of Properity Editor:
"[ilink32 Error] Error: Export tpdsc Mypnl::TPnlPropEdtr in module C:\PRG\XE11\EXAMPLES\CLANGCOMPONENT\WIN32\DEBUG\MUPNLPROPEDIT.OBJ references tpdsc Designeditors::TWideStringProperty in unit C:\PROGRAM FILES (X86)\EMBARCADERO\STUDIO\22.0\LIB\WIN32\RELEASE\DESIGNIDE.BPI|DesignEditors.pas"

What Am I doing wrong? What do i need to do to make it right? Thank you for your answers

#include "MyPnl.h"
#include <DesignEditors.hpp>
#include <System.WideStrings.hpp>
namespace Mypnl {

class TPnlPropEdtr : public TWideStringProperty {
    public:
        inline __fastcall virtual   __fastcall TPnlPropEdtr( const Designintf::_di_IDesigner ADesigner, int APropCount) :
                                                                                TWideStringProperty( ADesigner, APropCount) {};
        inline __fastcall  virtual ~TPnlPropEdtr( void) {};
        virtual Designintf::TPropertyAttributes __fastcall GetAttributes();
        virtual void __fastcall GetValues( Designintf::TGetWideStrProc Proc);
};
using namespace Mypnl;
#endif

*.cpp
#pragma hdrstop
#include "MuPnlPropEdit.h"

TPropertyAttributes __fastcall TPnlPropEdtr::GetAttributes()
{
    TPropertyAttributes Attributes;
    return Attributes << TPropertyAttribute::paValueList << TPropertyAttribute::paAutoUpdate;
}

void __fastcall TPnlPropEdtr::GetValues( Designintf::TGetWideStrProc Proc)
{
  Proc( L"COM1");
  Proc( L"COM2");
  Proc( L"COM3");
}


问:
How to do inference with a tensorflow lite model?
I've converted a keras model and tried to do inference on a single sample following the example on the docs:

```<code># Load the TFLite model in TFLite Interpreter
interpreter = tf.lite.Interpreter('tflite_model')
# There is only 1 signature defined in the model,
# so it will return it by default.
# If there are multiple signatures then we can pass the name.
my_signature = interpreter.get_signature_runner()

# my_signature is callable with input as arguments.
# my_signature is callable with input as arguments.
output = my_signature(x=x, shape=x.shape, dtype=tf.float32)
# 'output' is dictionary with all outputs from the inference.
# In this case we have single output 'result'.
print(output['result'])
</code>```

Unfortunately I get the following error:

```<code>ValueError: Invalid number of inputs provided for running a SignatureDef, expected 1 vs provided 3
</code>```

I am not sure what causes the error, if I try to use just

```<code>output = my_signature(x=x)
</code>```

I get invalid argument x.

Thanks for any help you can provide.

Body:
I've converted a keras model and tried to do inference on a single sample following the example on the docs:

# Load the TFLite model in TFLite Interpreter
interpreter = tf.lite.Interpreter('tflite_model')
# There is only 1 signature defined in the model,
# so it will return it by default.
# If there are multiple signatures then we can pass the name.
my_signature = interpreter.get_signature_runner()

# my_signature is callable with input as arguments.
# my_signature is callable with input as arguments.
output = my_signature(x=x, shape=x.shape, dtype=tf.float32)
# 'output' is dictionary with all outputs from the inference.
# In this case we have single output 'result'.
print(output['result'])

Unfortunately I get the following error:

ValueError: Invalid number of inputs provided for running a SignatureDef, expected 1 vs provided 3

I am not sure what causes the error, if I try to use just

output = my_signature(x=x)

I get invalid argument x.

Thanks for any help you can provide.


问:
How to create sidebar menu with toggle button
I'm new to Blazor and I'm trying to create a sidebar menu with a toggle button.
I've tried to find references in the internet and I can't find any examples.
I'm trying to implement the following sidebar menu in Blazor using Bootstapper:
https://bbbootstrap.com/snippets/bootstrap-5-sidebar-menu-toggle-button-34132202

If someone can help me to implement this toggle, it would be very helpful. I just need a small example so I can implement it. The toggle is supposed to be exactly like the example. The sidebar needs to be minimized with icons.

Thanks!

I've tried to use the collapse example in the bootstrapper site.
I've tried to search everywhere to find examples and there are no examples in Blazor (for the exact sidebar menu).


问:
Chrome extension mv3 - How to update private extension that is not in web store
I've found this old question because I'm looking for a way to update a chrome extension that is not distributed on chrome web store and is private.

I've tried the same way that is into the linked question, but seems not working with mv3?Sometime I also have problems with CSP for RTDB (but it's another problem..)

Is there a modern way to achive the result?maybe a nodejs script?


问:
wall/write command alternative for Docker Linux?
I have a use case where I run multiple containers and I want to send messages to specific containers' shells to notify the user working on that shell, over SSH or VS Code or VS Code web.

wall/write commands are popular in Linux but it doesn't seem to work within Docker.

I understand wall or write is used to send messages to those who are logged into the system. who command usually lists all the users currently logged in. In the docker container with code-server running, I am accessing the shell. But who is not able to display that I am logged in. This is why it may not work.

Are there any alternatives? Or is there any way to make it work?


问:
Why can't I use jest namespace within .ts files?
I'm trying to decouple a variable from a .spec.ts file  using jest.Mocked type to a .ts file, but when I put into the .ts file it raises the error "Cannot find namespace 'jest' "

```<code>export const mockAxios = (): jest.Mocked<typeof axios> => {
  const mockedAxios = axios as jest.Mocked<typeof axios>
  mockedAxios.request.mockClear().mockResolvedValue(mockHttpResponse())
  return mockedAxios
}

</code>```

I couldn't understand why it only raises a error on .ts files and how to solve this issue.

Body:
I'm trying to decouple a variable from a .spec.ts file  using jest.Mocked type to a .ts file, but when I put into the .ts file it raises the error "Cannot find namespace 'jest' "

export const mockAxios = (): jest.Mocked<typeof axios> => {
  const mockedAxios = axios as jest.Mocked<typeof axios>
  mockedAxios.request.mockClear().mockResolvedValue(mockHttpResponse())
  return mockedAxios
}

I couldn't understand why it only raises a error on .ts files and how to solve this issue.