问:
Triggering several notifications in Apple Watch in short period of time makes them grouped
Im making a standalone Apple Watch app, testing on device, and its meant to play several bells with vibration (app can be closed and alerts should play) in a period of like 5 seconds or so, Im using local notifications for this and no matter what I try I only hear the first notification bell or if I extend in time maybe 2 bells, in the past alerts summary these consecutive notifications are listed but the bells are not played. I know there is a way to do this as I saw an app that plays several bells like this and is standalone Apple Watch app too. Im using swift, how can I do that? Thanks for any help

I made a separate code only to trigger some alerts in 10 seconds from now to show better my issue here:

```<code>import SwiftUI
import UserNotifications

struct ContentView: View
{
    var body: some View
    {
        VStack
        {
            Button("Request Permission")
            {
                UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { success, error in
                    if success {
                        print("All set!")
                    } else if let error = error {
                        print(error.localizedDescription)
                    }
                }
            }

            Button("Schedule Notification")
            {
                let content = UNMutableNotificationContent()
                content.title = "First notification"
                content.subtitle = "Whatever"
                content.sound = UNNotificationSound.defaultCritical

                // show this notification 10 seconds from now
                let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 10, repeats: false)

                // choose a random identifier
                let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)

                //----------/
                var content2 = [UNMutableNotificationContent](repeating: UNMutableNotificationContent(), count:100)

                var trigger2 = [UNNotificationTrigger](repeating: UNTimeIntervalNotificationTrigger(timeInterval: 60, repeats: true)
            , count:100)
                var request2 = [UNNotificationRequest](repeating: UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger),count:100)
                // add notification request
                UNUserNotificationCenter.current().add(request)

                for i in 0..<100
                {

                    content2[i] = UNMutableNotificationContent()
                    content2[i].title = "Chained notifications"
                    content2[i].subtitle = "whatever"
                    content2[i].sound = UNNotificationSound.defaultCritical
                    //content2[i].interruptionLevel = .active
                    content2[i].interruptionLevel = .critical
                    content2[i].categoryIdentifier="category\(i)"
                    content2[i].threadIdentifier="asadasaa\(i)"
                    trigger2[i] = UNTimeIntervalNotificationTrigger(timeInterval: 10+Double(i/4), repeats: false)

                    // choose a random identifier
                    request2[i] = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)
                    UNUserNotificationCenter.current().add(request2[i])
                }
                //-----------/

            }
            Button("Stop")
            {
                UNUserNotificationCenter.current().removeAllPendingNotificationRequests()
            }
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
</code>```

I tried several intervals between notifications, making them more separate or closer to each other and only first one plays or 2 or more bells if there is some longer intervals but most are grouped and only hear like one every second at the most I think, I read somewhere these are meant to be payed in 0.9 seconds at the shortest time but as said I have seen an app able to do this so there has to be a way

I was suggested to use different thead or so, but didnt work, tried other parameters of this too like to change revelance or so but nothing worked

The issue may work the same in iPhone if you are more familiar with it, so if you know a workaround for this let me know

Body:
Im making a standalone Apple Watch app, testing on device, and its meant to play several bells with vibration (app can be closed and alerts should play) in a period of like 5 seconds or so, Im using local notifications for this and no matter what I try I only hear the first notification bell or if I extend in time maybe 2 bells, in the past alerts summary these consecutive notifications are listed but the bells are not played. I know there is a way to do this as I saw an app that plays several bells like this and is standalone Apple Watch app too. Im using swift, how can I do that? Thanks for any help

I made a separate code only to trigger some alerts in 10 seconds from now to show better my issue here:

import SwiftUI
import UserNotifications

struct ContentView: View
{
    var body: some View
    {
        VStack
        {
            Button("Request Permission")
            {
                UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { success, error in
                    if success {
                        print("All set!")
                    } else if let error = error {
                        print(error.localizedDescription)
                    }
                }
            }

            Button("Schedule Notification")
            {
                let content = UNMutableNotificationContent()
                content.title = "First notification"
                content.subtitle = "Whatever"
                content.sound = UNNotificationSound.defaultCritical

                // show this notification 10 seconds from now
                let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 10, repeats: false)

                // choose a random identifier
                let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)

                //----------/
                var content2 = [UNMutableNotificationContent](repeating: UNMutableNotificationContent(), count:100)

                var trigger2 = [UNNotificationTrigger](repeating: UNTimeIntervalNotificationTrigger(timeInterval: 60, repeats: true)
            , count:100)
                var request2 = [UNNotificationRequest](repeating: UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger),count:100)
                // add notification request
                UNUserNotificationCenter.current().add(request)

                for i in 0..<100
                {

                    content2[i] = UNMutableNotificationContent()
                    content2[i].title = "Chained notifications"
                    content2[i].subtitle = "whatever"
                    content2[i].sound = UNNotificationSound.defaultCritical
                    //content2[i].interruptionLevel = .active
                    content2[i].interruptionLevel = .critical
                    content2[i].categoryIdentifier="category\(i)"
                    content2[i].threadIdentifier="asadasaa\(i)"
                    trigger2[i] = UNTimeIntervalNotificationTrigger(timeInterval: 10+Double(i/4), repeats: false)

                    // choose a random identifier
                    request2[i] = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)
                    UNUserNotificationCenter.current().add(request2[i])
                }
                //-----------/

            }
            Button("Stop")
            {
                UNUserNotificationCenter.current().removeAllPendingNotificationRequests()
            }
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

I tried several intervals between notifications, making them more separate or closer to each other and only first one plays or 2 or more bells if there is some longer intervals but most are grouped and only hear like one every second at the most I think, I read somewhere these are meant to be payed in 0.9 seconds at the shortest time but as said I have seen an app able to do this so there has to be a way

I was suggested to use different thead or so, but didnt work, tried other parameters of this too like to change revelance or so but nothing worked

The issue may work the same in iPhone if you are more familiar with it, so if you know a workaround for this let me know


来源: stackexchange

问:
Acces Forbidden subuser sendgrid api
I want to request the method, 'add a single recipent to a list', but in the headers of the method request me

"on-behalf-of": "The subuser's username. This header generates the API call as if the subuser account was making the call."

and when i put the subuser username the response of my petition it´s

```<code>{
    "errors": [
        {
            "field": null,
            "message": "access forbidden"
        }
    ]
}
</code>```

i would really apreciate any kind of help.

I already tried to, add all the acces to the subuser and it didn´t work, add an api key to the subuser but reading the documentation of the api of sendgrid it´s not necesary for what i need

ContentLicense: CC BY-SA 4.0

Title: Acces Forbidden subuser sendgrid api

Body:
I want to request the method, 'add a single recipent to a list', but in the headers of the method request me

"on-behalf-of": "The subuser's username. This header generates the API call as if the subuser account was making the call."

and when i put the subuser username the response of my petition it´s

{
    "errors": [
        {
            "field": null,
            "message": "access forbidden"
        }
    ]
}

i would really apreciate any kind of help.

I already tried to, add all the acces to the subuser and it didn´t work, add an api key to the subuser but reading the documentation of the api of sendgrid it´s not necesary for what i need


问:
Browserify cannot find module has been installed from local filesystem
I have several JavaScript files that requires several modules that are managed by NPM. I am trying to bundle these files together with Browserify. However, I am getting the following error:

 Cannot find module 'fairychess-web' from '...App.js'

(the full path has been elided).

This module is required in the following area of App.js:

    exports.__esModule = true;
    var jsx_runtime_1 = require("react/jsx-runtime");
    var react_1 = require("react");
    require("./App.css");
    var fairychess_web_1 = __importStar(require("fairychess-web"));
    var chess_lib_1 = require("./chess_lib");
    var net_lib_1 = require("./net_lib");
```
<p>My dependencies are in my <code>package.json</code> file as follows:</p>
<pre class="lang-json prettyprint-override"><code>    "dependencies": {
        "@types/node": "^18.11.11",
        "@types/react": "^18.0.26",
        "fairychess-web": "file:../fairychess-web/pkg",
        "http": "^0.0.1-security",
        "react": "^18.2.0",
        "react-dom": "^18.2.0",
        "ws": "^8.11.0"
    }
</code>```

As you can see, the offending fairychess-web module is defined locally rather than on the NPM registry. I think this is why Browserify is having trouble finding the module, because I'm not receiving any error messages about the previous imports of libraries downloaded from NPM, but I have no idea as to how to solve the problem.

A few notes that may be relevant

App.js and the rest of my files, like chess_lib and net_lib, were created though tsc run on TypeScript files.

The fairychess-web module is a Rust package that was compiled to WASM with wasm-bindgen. This created a TypeScript wrapper file through which I am interfacing the Rust code and my Typescript code.

This code was originally built on create-react-app. At that time there were no problems importing the local module, this problem only arose when I decided to manually build the project.

Body:
I have several JavaScript files that requires several modules that are managed by NPM. I am trying to bundle these files together with Browserify. However, I am getting the following error:

 Cannot find module 'fairychess-web' from '...App.js'

(the full path has been elided).

This module is required in the following area of App.js:

    exports.__esModule = true;
    var jsx_runtime_1 = require("react/jsx-runtime");
    var react_1 = require("react");
    require("./App.css");
    var fairychess_web_1 = __importStar(require("fairychess-web"));
    var chess_lib_1 = require("./chess_lib");
    var net_lib_1 = require("./net_lib");

My dependencies are in my package.json file as follows:

    "dependencies": {
        "@types/node": "^18.11.11",
        "@types/react": "^18.0.26",
        "fairychess-web": "file:../fairychess-web/pkg",
        "http": "^0.0.1-security",
        "react": "^18.2.0",
        "react-dom": "^18.2.0",
        "ws": "^8.11.0"
    }

As you can see, the offending fairychess-web module is defined locally rather than on the NPM registry. I think this is why Browserify is having trouble finding the module, because I'm not receiving any error messages about the previous imports of libraries downloaded from NPM, but I have no idea as to how to solve the problem.

A few notes that may be relevant

App.js and the rest of my files, like chess_lib and net_lib, were created though tsc run on TypeScript files.

The fairychess-web module is a Rust package that was compiled to WASM with wasm-bindgen. This created a TypeScript wrapper file through which I am interfacing the Rust code and my Typescript code.

This code was originally built on create-react-app. At that time there were no problems importing the local module, this problem only arose when I decided to manually build the project.


问:
Ionic Cordova Local Notification not subscribing to events on IOS 16.1.2
I have setup local notifications on IOS and l want to subscribe to Local notifications on the event onTrigger then l play custom audio or voice recording. Whats happening is if the app is in the foreground/active l do receive notifications and l do subscribe to event onTrigger. However if l lock my phone or place the app in the background the notification does popup but does not subscribe to the event onTrigger.

Is a a workaround to subscribe to events when the app is in the background or when device is locked?
Your Environment

Device OS is IOS 16.1.2
Ionic:

Ionic CLI : 5.4.5 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 5.9.4
@angular-devkit/build-angular : 12.1.4

Cordova:

Cordova CLI : 11.0.0
Cordova Platforms : ios 6.2.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 14 other plugins)

Utility:

cordova-res : 0.15.4
native-run : 1.6.0 (update available: 1.7.1)

System:

ios-deploy : 1.10.0
ios-sim : 8.0.2
NodeJS : v14.15.4 (/usr/local/bin/node)
npm : 6.14.10
OS : macOS
Xcode : Xcode 14.1 Build version 14B47b

Installed Plugins
cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
cordova-plugin-badge 0.8.8 "Badge"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-chooser 1.3.1 "Chooser"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-file 7.0.0 "File"
cordova-plugin-file-transfer 2.0.0-dev "File Transfer"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
cordova-plugin-media 6.1.0 "Media"
cordova-plugin-media-capture 4.0.0 "Capture"
cordova-plugin-native-ringtones 0.2.5 "NativeRingtones"
cordova-plugin-nativeaudio 3.0.9 "Cordova Native Audio"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"

Expected Behavior

I expect the local notifications to subscribe to event onTrigger when the notification is triggered whether its in the background or phone is locked .
Actual Behavior

The local notification does popup but doe


问:
Add fonts to image using Jib
We have Jib in out project instead of Docker containerization and now I have a task to add fonts to final image.

Commands that I need to reproduce with Jib and how it looks like with Docker:

```<code>RUN apk --no-cache add curl ttf-dejavu msttcorefonts-installer fontconfig \
  && update-ms-fonts \
  && fc-cache -f
</code>```

Actually I don't think that I need to add all fonts, I need only Times New Roman.

Also I would mention that I don't have any opportunity to change base image, so I can't add fonts to image before Jib using it.

Considering all points, what would you recommend eventually?

Title: Add fonts to image using Jib

Body:
We have Jib in out project instead of Docker containerization and now I have a task to add fonts to final image.

Commands that I need to reproduce with Jib and how it looks like with Docker:

RUN apk --no-cache add curl ttf-dejavu msttcorefonts-installer fontconfig \
  && update-ms-fonts \
  && fc-cache -f

Actually I don't think that I need to add all fonts, I need only Times New Roman.

Also I would mention that I don't have any opportunity to change base image, so I can't add fonts to image before Jib using it.

Considering all points, what would you recommend eventually?


问:
How to create child process while X11 connection is open?
I have a graphics application using GLUT (on top of X11 in Linux) and I want to create a child process for performing some utility task. However, the child process crashes and I get the following error:

```<code>X connection to :0 broken (explicit kill or server shutdown).
</code>```

It seems the child process somehow inherits the X11 connection. I tried to set FD_CLOEXEC on all fds, but it didn't help. Is it possible to create a child process while X11 connection is active?

See minimal reproducer with GLUT and old-school OpenGL used for brevity. This produces a bit different error than my actual application, but I would still expect it to work:

```<code>Resource temporarily unavailable
status=139
[xcb] Unknown sequence number while processing queue
[xcb] You called XInitThreads, this is not your fault
[xcb] Aborting, sorry about that.
Repro: xcb_io.c:278: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted (core dumped)
</code>```

CMakeLists.txt

```<code>cmake_minimum_required(VERSION 3.10)
project(Repro CXX)
cmake_policy(SET CMP0072 NEW)

find_package(GLUT REQUIRED)
if(NOT GLUT_FOUND)
    message(ERROR "GLUT not found!")
endif(NOT GLUT_FOUND)
find_package(OpenGL REQUIRED)
if(NOT OpenGL_FOUND)
    message(ERROR "OpenGL not found!")
endif(NOT OpenGL_FOUND)

add_executable(Repro main.cpp)
target_include_directories(Repro PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries(Repro PRIVATE ${GLUT_LIBRARIES} ${OPENGL_LIBRARY})
</code>```

main.cpp

#include <GL/gl.h>
#include <GL/glut.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <cstdio>

static void handleDisplay(void) {
  glClearColor(0.1, 0.1, 0.1, 0);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glBegin(GL_TRIANGLES);
  glVertex2i(0, 0);
  glVertex2i(1, 0);
  glVertex2i(0, 1);
  glEnd();
  glutSwapBuffers();
  glutPostRedisplay();
}

static void handleKeyboard(unsigned char key, int x, int y) {
  if (key == 'f') {
    const int pid = fork();
    if (pid == -1) {
      return;
    }

    if (pid == 0) {
      exit(0);
    } else {
      int status{};
      waitpid(pid, &status, 0);
      perror("");
      printf("status=%d\n", status);
    }
  }
}

int main(int argc, char **argv) {
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_ALPHA);
  glutCreateWindow("Repro");
  glutDisplayFunc(handleDisplay);
  glutKeyboardFunc(handleKeyboard);
  glutMainLoop();
}

```

Body:
I have a graphics application using GLUT (on top of X11 in Linux) and I want to create a child process for performing some utility task. However, the child process crashes and I get the following error:

X connection to :0 broken (explicit kill or server shutdown).

It seems the child process somehow inherits the X11 connection. I tried to set FD_CLOEXEC on all fds, but it didn't help. Is it possible to create a child process while X11 connection is active?

See minimal reproducer with GLUT and old-school OpenGL used for brevity. This produces a bit different error than my actual application, but I would still expect it to work:

Resource temporarily unavailable
status=139
[xcb] Unknown sequence number while processing queue
[xcb] You called XInitThreads, this is not your fault
[xcb] Aborting, sorry about that.
Repro: xcb_io.c:278: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
Aborted (core dumped)

CMakeLists.txt

cmake_minimum_required(VERSION 3.10)
project(Repro CXX)
cmake_policy(SET CMP0072 NEW)

find_package(GLUT REQUIRED)
if(NOT GLUT_FOUND)
    message(ERROR "GLUT not found!")
endif(NOT GLUT_FOUND)
find_package(OpenGL REQUIRED)
if(NOT OpenGL_FOUND)
    message(ERROR "OpenGL not found!")
endif(NOT OpenGL_FOUND)

add_executable(Repro main.cpp)
target_include_directories(Repro PRIVATE ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})
target_link_libraries(Repro PRIVATE ${GLUT_LIBRARIES} ${OPENGL_LIBRARY})

main.cpp

#include <GL/gl.h>
#include <GL/glut.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <cstdio>

static void handleDisplay(void) {
  glClearColor(0.1, 0.1, 0.1, 0);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glBegin(GL_TRIANGLES);
  glVertex2i(0, 0);
  glVertex2i(1, 0);
  glVertex2i(0, 1);
  glEnd();
  glutSwapBuffers();
  glutPostRedisplay();
}

static void handleKeyboard(unsigned char key, int x, int y) {
  if (key == 'f') {
    const int pid = fork();
    if (pid == -1) {
      return;
    }

    if (pid == 0) {
      exit(0);
    } else {
      int status{};
      waitpid(pid, &status, 0);
      perror("");
      printf("status=%d\n", status);
    }
  }
}

int main(int argc, char **argv) {
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_ALPHA);
  glutCreateWindow("Repro");
  glutDisplayFunc(handleDisplay);
  glutKeyboardFunc(handleKeyboard);
  glutMainLoop();
}


问:
I have an error when I try to install Discord canvas easy
During my free time I develop a discord bot, but when I try to install discord-canvas-easy. Error. Someone have a solution ?
I'm on MacBook Pro M1 Pro (intel chip)

```<code>luca@MBP-M1Pro-Luca IweZix-2.1 % npm i discord-canvas-easy@3.2.0
npm WARN deprecated @discordjs/collection@0.7.0: no longer supported
npm WARN deprecated @discordjs/builders@0.16.0: no longer supported
npm ERR! code 1
npm ERR! path /Users/luca/Library/CloudStorage/OneDrive-Personnel/IweZix-2.1/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build --update-binary
npm ERR! Failed to execute '/Users/luca/.nvm/versions/node/v16.14.0/bin/node /Users/luca/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/luca/Library/CloudStorage/OneDrive-Personnel/IweZix-2.1/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/luca/Library/CloudStorage/OneDrive-Personnel/IweZix-2.1/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.10
npm ERR! node-pre-gyp info using node@16.14.0 | darwin | arm64
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas@2.10.2 and node@16.14.0 (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.3.0
npm ERR! gyp info using node@16.14.0 | darwin | arm64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.3.0
npm ERR! gyp info using node@16.14.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.9.10 found at "/opt/homebrew/opt/python@3.9/bin/python3.9"
npm ERR! gyp info spawn /opt/homebrew/opt/python@3.9/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/luca/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/luca/Library/CloudStorage/OneDrive-Personnel/IweZix-2.1/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/luca/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/luca/Library/Caches/node-gyp/16.14.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/luca/Library/Caches/node-gyp/16.14.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/luca/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/luca/Library/Caches/node-gyp/16.14.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/luca/Library/CloudStorage/OneDrive-Personnel/IweZix-2.1/node_modules/canvas',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/Users/luca/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:325:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit
{...}

</code>```

I try to update node, update npm, install latest discord-canvas-easy

Body:
During my free time I develop a discord bot, but when I try to install discord-canvas-easy. Error. Someone have a solution ?
I'm on MacBook Pro M1 Pro (intel chip)

luca@MBP-M1Pro-Luca IweZix-2.1 % npm i discord-canvas-easy@3.2.0
npm WARN deprecated @discordjs/collection@0.7.0: no longer supported
npm WARN deprecated @discordjs/builders@0.16.0: no longer supported
npm ERR! code 1
npm ERR! path /Users/luca/Library/CloudStorage/OneDrive-Personnel/IweZix-2.1/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build --update-binary
npm ERR! Failed to execute '/Users/luca/.nvm/versions/node/v16.14.0/bin/node /Users/luca/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/luca/Library/CloudStorage/OneDrive-Personnel/IweZix-2.1/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/luca/Library/CloudStorage/OneDrive-Personnel/IweZix-2.1/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.10
npm ERR! node-pre-gyp info using node@16.14.0 | darwin | arm64
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas@2.10.2 and node@16.14.0 (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.3.0
npm ERR! gyp info using node@16.14.0 | darwin | arm64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.3.0
npm ERR! gyp info using node@16.14.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.9.10 found at "/opt/homebrew/opt/python@3.9/bin/python3.9"
npm ERR! gyp info spawn /opt/homebrew/opt/python@3.9/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/luca/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/luca/Library/CloudStorage/OneDrive-Personnel/IweZix-2.1/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/luca/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/luca/Library/Caches/node-gyp/16.14.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/luca/Library/Caches/node-gyp/16.14.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/luca/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/luca/Library/Caches/node-gyp/16.14.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/luca/Library/CloudStorage/OneDrive-Personnel/IweZix-2.1/node_modules/canvas',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/Users/luca/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:325:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit
{...}

I try to update node, update npm, install latest discord-canvas-easy


问:
creating a prediction layer for species distribution models error: Error in eval(predvars, data, env) : object 'z.bio2' not found
I have run a GLM using matrix data from my species presence-absence data and 5 climatic variables (glm_gorilla)

And bioclim_hist_local contains a matrix of cells with climatic predictor values cropped to my species distribution area.

I am now trying to create a prediction layer for my species distribution maps.

#model predictions and evaluation

create a prediction layer

```<code>glm_pred <- predict(glm_gorilla, bioclim_hist_local, type='response')

glm_pred34 <- predict(glm_gorilla34,bioclim_hist_local, type='response')
</code>```

results in this error: Error in eval(predvars, data, env) : object 'z.bio2' not found

I have tried swapping bioclim_hist_local and glm_gorilla around but this hasn't helped.

I have looked at similar problems of stackoverflow but none of the solutions work.

please help!

Body:
I have run a GLM using matrix data from my species presence-absence data and 5 climatic variables (glm_gorilla)

And bioclim_hist_local contains a matrix of cells with climatic predictor values cropped to my species distribution area.

I am now trying to create a prediction layer for my species distribution maps.

#model predictions and evaluation

create a prediction layer

glm_pred <- predict(glm_gorilla, bioclim_hist_local, type='response')

glm_pred34 <- predict(glm_gorilla34,bioclim_hist_local, type='response')

results in this error: Error in eval(predvars, data, env) : object 'z.bio2' not found

I have tried swapping bioclim_hist_local and glm_gorilla around but this hasn't helped.

I have looked at similar problems of stackoverflow but none of the solutions work.

please help!


问:
Duplicating State in .then function
```<code>export default function App() {
  const[ogposts, setOgposts] = useState([])
  const[posts, setPosts] = useState([]);

  useEffect(()=>{
    const restApi = 'https://reqres.in/api/users/';

    fetch(restApi)
      .then(res=> res.json())
      .then(res=> {setOgposts(res.data); setPosts(ogposts)})
  },[])

  return (
    <div>
      <table>
        <tr>
          <th> Id </th>
          <th> FirstName </th>
          <th> LastName </th>
          <th> EmailId </th>
        </tr>
        <tr>
          <td>{posts.map((e)=>(<p>{e.id}</p>))}</td>
          <td>{posts.map((e)=>(<p>{e.first_name}</p>))}</td>
          <td>{posts.map((e)=>(<p>{e.last_name}</p>))}</td>
          <td>{posts.map((e)=>(<p>{e.email}</p>))}</td>
        </tr>
      </table>
    </div>
  );
}
</code>```

In the Above code, when I try to duplicate the state of posts to ogposts, but only ogposts has the values of API. When I console.log posts, it shows Empty array. What is wrong in the above code? I want to duplicate the value of ogposts to posts Please help

In the Above code, when I try to duplicate the state of posts to ogposts, but only ogposts has the values of API. When I console.log posts, it shows Empty array. What is wrong in the above code? I want to duplicate the value of ogposts to posts Please help

Title: Duplicating State in .then function

Body:
export default function App() {
  const[ogposts, setOgposts] = useState([])
  const[posts, setPosts] = useState([]);

  useEffect(()=>{
    const restApi = 'https://reqres.in/api/users/';

    fetch(restApi)
      .then(res=> res.json())
      .then(res=> {setOgposts(res.data); setPosts(ogposts)})
  },[])

  return (

           Id
           FirstName
           LastName
           EmailId

          {posts.map((e)=>(
{e.id}
))}
          {posts.map((e)=>(
{e.first_name}
))}
          {posts.map((e)=>(
{e.last_name}
))}
          {posts.map((e)=>(
{e.email}
))}

  );
}

In the Above code, when I try to duplicate the state of posts to ogposts, but only ogposts has the values of API. When I console.log posts, it shows Empty array. What is wrong in the above code? I want to duplicate the value of ogposts to posts Please help

In the Above code, when I try to duplicate the state of posts to ogposts, but only ogposts has the values of API. When I console.log posts, it shows Empty array. What is wrong in the above code? I want to duplicate the value of ogposts to posts Please help


问:
Local JSON file editing with HTML/JS
I have a python app that uses two dictionaries.
They are used to display an image or gif based on a string input.
The string comes from an RFID scanner reading tags.

I want to make it easy for anyone to edit which file is associated with each ID.
This will be run locally in a linux environment (Raspberry Pi).
I have an HTML page with a table on it like this:

ID
anatomical location
File

1313213212
Left apex
c:/users/etc

1313541324
Right apex
c:/users/etc

3423541324
Sub xiphoid
c:/users/etc

The 'file' box would be the only one that would be a form element to allow the user to choose which image is associated with that ID.

When clicking 'submit' how do I save the ID and File information in a JSON file like this:

```<code>"1313213212": "c:/users/etc/picture1.png"
</code>```

so it could be loaded in the Python script as a dictionary?

Title: Local JSON file editing with HTML/JS

Body:
I have a python app that uses two dictionaries.
They are used to display an image or gif based on a string input.
The string comes from an RFID scanner reading tags.

I want to make it easy for anyone to edit which file is associated with each ID.
This will be run locally in a linux environment (Raspberry Pi).
I have an HTML page with a table on it like this:

ID
anatomical location
File

1313213212
Left apex
c:/users/etc

1313541324
Right apex
c:/users/etc

3423541324
Sub xiphoid
c:/users/etc

The 'file' box would be the only one that would be a form element to allow the user to choose which image is associated with that ID.

When clicking 'submit' how do I save the ID and File information in a JSON file like this:

"1313213212": "c:/users/etc/picture1.png"

so it could be loaded in the Python script as a dictionary?


问:
Selenium chromedriver send_keysmesses up message in Ubuntu - works fine in Windows
I have a Python script with Selenium that includes this code to fill a form:

```<code>search_word = 'Witty'
my_link = 'https://w1tty.page.link/ZXAy8GSX7XxpnHZC7'
driver.find_element_by_xpath("//div[@placeholder='Please write your message here...']").send_keys('Hello,\n\nif you need a link for ' + search_word + ' here it is:\n\n' + my_link + '\n\nGreetings\nRZX')
</code>```

Under Windows 10 (Python 3.10.8, Chromedriver 108.0.5359.71)  I get:

Hello,

if you need a link for Witty here it is:

w1tty.page.link/ZXA…ZC7

Greetings

RZX

Under Ubuntu 22.04 (Python 3.10.6, Chromedriver 108.0.5359.94) running the same code I get:

ZXAy8GSX7XxpnHZC7

Greetings

RZXw1tty.page.linkHello,

if you need a link to Witty here it is:

https:

When I run the same message as "print" the format is perfect. I guess it's about Selenium send_keys function.

Body:
I have a Python script with Selenium that includes this code to fill a form:

search_word = 'Witty'
my_link = 'https://w1tty.page.link/ZXAy8GSX7XxpnHZC7'
driver.find_element_by_xpath("//div[@placeholder='Please write your message here...']").send_keys('Hello,\n\nif you need a link for ' + search_word + ' here it is:\n\n' + my_link + '\n\nGreetings\nRZX')

Under Windows 10 (Python 3.10.8, Chromedriver 108.0.5359.71)  I get:

Hello,

if you need a link for Witty here it is:

w1tty.page.link/ZXA…ZC7

Greetings

RZX

Under Ubuntu 22.04 (Python 3.10.6, Chromedriver 108.0.5359.94) running the same code I get:

ZXAy8GSX7XxpnHZC7

Greetings

RZXw1tty.page.linkHello,

if you need a link to Witty here it is:

https:

When I run the same message as "print" the format is perfect. I guess it's about Selenium send_keys function.


问:
Can you limit the number of options that get listed in the react-select dropdown?
I would like to show only 30 options in the dropdown using the react-select dropdown. Is this possible ? I would like to display everything else based on the autocomplete feature of the library. Is there a configuration that i can set ?</p>


问:
Matplotib: problems with ax.quiver in 3D
I wrote the following code for plotting dipoles with a certain magnitude in 3D. The vectors are normed and I would like to plot the color according to the norm(=magnitude). I encounter two problems:

The arrows aren't colored fully. For some it's only the head, for others only the shaft

The colorbar doesn't use the same colormap and goes from 0 to 1, instead of 0 to 40 (the order of magnitude of the norms)

```<code>def plot_dipoles(pind, x, y, z, u, v, w):

    magnitude = np.sqrt(u**2 + v**2 + w**2)
    ax = plt.axes(projection="3d")

    norm = matplotlib.colors.Normalize()
    norm.autoscale(magnitude)
    cm = matplotlib.cm.copper

    sm = matplotlib.cm.ScalarMappable(cmap=cm, norm=norm)
    sm.set_array([])

    quiv = ax.quiver(x, y, z, u, v, w, color=cm(norm(magnitude)), label="Induced dipoles", pivot="middle")

    plt.colorbar(quiv, ax=ax)
    plt.show()

</code>```

Setting ax.quiver(x, y, z, u, v, w, color = magnitude, cmap = plasma) doesn't work, so I have compiled some code together from things I found online, but I don't understand what it's doing exactly.

Body:
I wrote the following code for plotting dipoles with a certain magnitude in 3D. The vectors are normed and I would like to plot the color according to the norm(=magnitude). I encounter two problems:

The arrows aren't colored fully. For some it's only the head, for others only the shaft

The colorbar doesn't use the same colormap and goes from 0 to 1, instead of 0 to 40 (the order of magnitude of the norms)

def plot_dipoles(pind, x, y, z, u, v, w):

    magnitude = np.sqrt(u**2 + v**2 + w**2)
    ax = plt.axes(projection="3d")

    norm = matplotlib.colors.Normalize()
    norm.autoscale(magnitude)
    cm = matplotlib.cm.copper

    sm = matplotlib.cm.ScalarMappable(cmap=cm, norm=norm)
    sm.set_array([])

    quiv = ax.quiver(x, y, z, u, v, w, color=cm(norm(magnitude)), label="Induced dipoles", pivot="middle")

    plt.colorbar(quiv, ax=ax)
    plt.show()

Setting ax.quiver(x, y, z, u, v, w, color = magnitude, cmap = plasma) doesn't work, so I have compiled some code together from things I found online, but I don't understand what it's doing exactly.


问:
Showing react app in my HTML Javascript app
I have a react app and I have generated a bundle.min.js by creating webapack.config.js which looks like the following:

```<code>const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const glob = require('glob');

module.exports = {
  entry: {
    "bundle.js": glob.sync("build/static/?(js|css)/main.*.?(js|css)").map(f => path.resolve(__dirname, f)),
  },
  output: {
    filename: "build/static/js/bundle.min.js",
  },
  module: {
    rules: [
      {
        test: /\.css$/,
        use: ["style-loader", "css-loader"],
      },
    ],
  },
  plugins: [new UglifyJsPlugin()],
}
</code>```

I copied the bundle.min.js from the dist\build\static\js folder and included it in the script tag inside my HTML code index.html as shown below:

```<code><html>
  <head></head>
  <body>
    <h1>Bundle Testing</h1>
    <p>
      Here it comes:
    </p>
    <script src="bundle.min.js"/>
  </body>
</html>
</code>```

But it doesn't show my app. How should I render my app content inside this HTML code? I'm sure I'm missing something.

Body:
I have a react app and I have generated a bundle.min.js by creating webapack.config.js which looks like the following:

const path = require('path');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const glob = require('glob');

module.exports = {
  entry: {
    "bundle.js": glob.sync("build/static/?(js|css)/main.*.?(js|css)").map(f => path.resolve(__dirname, f)),
  },
  output: {
    filename: "build/static/js/bundle.min.js",
  },
  module: {
    rules: [
      {
        test: /\.css$/,
        use: ["style-loader", "css-loader"],
      },
    ],
  },
  plugins: [new UglifyJsPlugin()],
}

I copied the bundle.min.js from the dist\build\static\js folder and included it in the script tag inside my HTML code index.html as shown below:

Bundle Testing

      Here it comes:


问:
What's causing rjags "Node inconsistent with parents" error
I'm trying to run a bird occupancy model using rjags and I'm getting an error saying: Error in node ytb[1,2,9,1:5,1] Node inconsistent with parents. The vector that the error references is a vector of 5 0s because it represents a survey where no birds of species h were detected in any of the time bins. I've defined my initial values as follows:

```<code>Zin <- apply(jags.data$y, c(1,2,3), function(x) max(x,na.rm=T))
Zin[Zin == -Inf] <- NA # replace -inf (generated from max() function with NA)

inits<-function(){
  list(z=Zin,
       mean_alpha0.psi = runif(1, -3, 3),
       sd_alpha0 = runif(1),
       sd_eps = runif(1),
       mean_phi0=rnorm(nspeciesSub),
       sd_phi0=runif(nspeciesSub)
  )
}
</code>```

Zin is a matrix where Zin[h,i,j] = 1 if there was ever an observation of bird species h at property i and point j.

ytb is referenced in this line of my model:
ytb[h, i, j, 1:ntbins, v] ~ dmulti(pi_pa_normalized[h, i, j, 1:ntbins, v], z[h,i,j])

Here is the full model:

```<code>model{
#-----------------------------------------------------------------------------------------------------
# 1) Priors
#-----------------------------------------------------------------------------------------------------

  ######## Abundance ########
  mean_alpha0.psi ~ dnorm(0, 0.01)   # Mean intercept for occupancy probability for all species
  sd_alpha0 ~ dunif(0, 10)      # Standard deviation on mean abundance for all species
  prec_alpha0 <- 1 / (sd_alpha0 ^ 2)

  for (h in 1:nspecies) {
     alpha0.psi[h] ~ dnorm(mean_alpha0.psi, prec_alpha0) # Mean log abundance per point for species h

    # Uninformative priors on covariates
    alpha1[h] ~ dnorm(mu_alpha1, tau_alpha1) # Effect of fire frequency for each species
    alpha2[h] ~ dnorm(mu_alpha2, tau_alpha2) # Effect of ground cover for each species
    alpha3[h] ~ dnorm(mu_alpha3, tau_alpha3) # Effect of vegetation height for each species
    alpha4[h] ~ dnorm(mu_alpha4, tau_alpha4) # Effect of total basal area for each species
    alpha5[h] ~ dnorm(mu_alpha5, tau_alpha5) # Effect of % deciduous area for each species
  } # close h

  sd_eps ~ dexp(1) # Standard deviation for random property effect
  prec_eps <- 1 / (sd_eps ^ 2) # Precision for random property effect

  for (i in 1:nprops) {
    eps[i] ~ dnorm(0, prec_eps) # Random property effect
  } # close i

  mu_alpha1 ~ dnorm(0, 0.001)
  tau_alpha1 ~ dgamma(0.01, 0.01)

  mu_alpha2 ~ dnorm(0, 0.001)
  tau_alpha2 ~ dgamma(0.01, 0.01)

  mu_alpha3 ~ dnorm(0, 0.001)
  tau_alpha3 ~ dgamma(0.01, 0.01)

  mu_alpha4 ~ dnorm(0, 0.001)
  tau_alpha4 ~ dgamma(0.01, 0.01)

  mu_alpha5 ~ dnorm(0, 0.001)
  tau_alpha5 ~ dgamma(0.01, 0.01)

  ######## Availability #########
  for (h in 1:nspecies) {
    mean_phi0[h] ~ dnorm(0, 0.001)    # Mean availability for each species
    sd_phi0[h] ~ dexp(1)              # Standard deviation of availability for each species
    prec_phi0[h] <- 1 / (sd_phi0[h] ^ 2)

    for (i in 1:nprops) {
      for (j in 1:npoints_site[i]) {
        phi0[h, i, j] ~ dnorm(mean_phi0[h], prec_phi0[h]) # Mean availability for species h at property i and point j
      } # close j
    } # close i
  } # close h

  phi1 ~ dnorm(0, 0.001) # coefficient of day of year in availiabity linear model
  phi2 ~ dnorm(0, 0.001) # coefficient of day of year^2 in availiabity linear model
  phi3 ~ dnorm(0, 0.001) # coefficient of time after sunrise in availiabity linear model
  phi4 ~ dnorm(0, 0.001) # coefficient of temp in availiabity linear model
  phi5 ~ dnorm(0, 0.001) # coefficient of wind in availiabity linear model

#-----------------------------------------------------------------------------------------------------
# 2) Ecological process model
#-----------------------------------------------------------------------------------------------------

  for (h in 1:nspecies) {
    for (i in 1:nprops) {
      for (j in 1:npoints_site[i]) {
        z[h,i,j] ~ dbern(psi[h,i,j]) # True occupancy based on occupancy probability
        psi[h,i,j] <- 1 / (1 + exp(-lpsi.lim[h,i,j]))
        lpsi.lim[h,i,j] <- min(999, max(-999, lpsi[h,i,j]))
        lpsi[h,i,j] <- alpha0.psi[h] + alpha1[h] * fire[i, j] + alpha2[h] * ground[i, j] + alpha3[h] *
          height[i, j] + alpha4[h] * tba[i, j] + alpha5[h] * decid[i, j] + eps[i]

#-----------------------------------------------------------------------------------------------------
# 3) Observational process model
#-----------------------------------------------------------------------------------------------------

        ###### Availability with time removal ######
        for (v in 1:vh[i, j]) {
          # loop over each visit (v) to each site

          # Availability is a function of intercept + covariates

          y[h,i,j,v] ~ dbern(mu.p[h,i,j,v]) # Detection/non-detection
          mu.p[h,i,j,v] <- z[h,i,j] * pa[h,i,j,v] # mu.p conditional on bird being present at site

          logit(p[h,i,j,v]) <- phi0[h, i, j] + phi1 * obs_date[i, j, v] + phi2 * obs_date[i, j, v] * obs_date[i, j, v] + phi3 * obs_time[i, j, v] + phi4 * obs_temp[i, j, v] + phi5 * obs_wind[i, j, v]

          for (z in 1:ntbins) {
            # Probability of being available in each time bin
            # pi_pa in time bin >1 conditional on not being detected before
            pi_pa[h, i, j, z, v] <-
              p[h, i, j, v] * pow(1 - p[h, i, j, v], (z - 1))
            pi_pa_normalized[h, i, j, z, v] <-
              pi_pa[h, i, j, z, v] / pa[h, i, j, v]
          } # close z

          # Probability ever available
          pa[h, i, j, v] <- sum(pi_pa[h, i, j, 1:ntbins, v])

          # Time data - when were detections mentally removed?
          ytb[h, i, j, 1:ntbins, v] ~ dmulti(pi_pa_normalized[h, i, j, 1:ntbins, v], z[h,i,j])

        } # close v
      } # close j
    } # close i
  } # close h
}
</code>```

I've messed with the initial values for z, making them all 1s or all 0s, in addition to what I've tried written above, but I always run into an error saying either "invalid parent node" or "node inconsistent with parents."

Body:
I'm trying to run a bird occupancy model using rjags and I'm getting an error saying: Error in node ytb[1,2,9,1:5,1] Node inconsistent with parents. The vector that the error references is a vector of 5 0s because it represents a survey where no birds of species h were detected in any of the time bins. I've defined my initial values as follows:

Zin <- apply(jags.data$y, c(1,2,3), function(x) max(x,na.rm=T))
Zin[Zin == -Inf] <- NA # replace -inf (generated from max() function with NA)

inits<-function(){
  list(z=Zin,
       mean_alpha0.psi = runif(1, -3, 3),
       sd_alpha0 = runif(1),
       sd_eps = runif(1),
       mean_phi0=rnorm(nspeciesSub),
       sd_phi0=runif(nspeciesSub)
  )
}

Zin is a matrix where Zin[h,i,j] = 1 if there was ever an observation of bird species h at property i and point j.

ytb is referenced in this line of my model:
ytb[h, i, j, 1:ntbins, v] ~ dmulti(pi_pa_normalized[h, i, j, 1:ntbins, v], z[h,i,j])

Here is the full model:

model{
#-----------------------------------------------------------------------------------------------------
# 1) Priors
#-----------------------------------------------------------------------------------------------------

  ######## Abundance ########
  mean_alpha0.psi ~ dnorm(0, 0.01)   # Mean intercept for occupancy probability for all species
  sd_alpha0 ~ dunif(0, 10)      # Standard deviation on mean abundance for all species
  prec_alpha0 <- 1 / (sd_alpha0 ^ 2)

  for (h in 1:nspecies) {
     alpha0.psi[h] ~ dnorm(mean_alpha0.psi, prec_alpha0) # Mean log abundance per point for species h

    # Uninformative priors on covariates
    alpha1[h] ~ dnorm(mu_alpha1, tau_alpha1) # Effect of fire frequency for each species
    alpha2[h] ~ dnorm(mu_alpha2, tau_alpha2) # Effect of ground cover for each species
    alpha3[h] ~ dnorm(mu_alpha3, tau_alpha3) # Effect of vegetation height for each species
    alpha4[h] ~ dnorm(mu_alpha4, tau_alpha4) # Effect of total basal area for each species
    alpha5[h] ~ dnorm(mu_alpha5, tau_alpha5) # Effect of % deciduous area for each species
  } # close h

  sd_eps ~ dexp(1) # Standard deviation for random property effect
  prec_eps <- 1 / (sd_eps ^ 2) # Precision for random property effect

  for (i in 1:nprops) {
    eps[i] ~ dnorm(0, prec_eps) # Random property effect
  } # close i

  mu_alpha1 ~ dnorm(0, 0.001)
  tau_alpha1 ~ dgamma(0.01, 0.01)

  mu_alpha2 ~ dnorm(0, 0.001)
  tau_alpha2 ~ dgamma(0.01, 0.01)

  mu_alpha3 ~ dnorm(0, 0.001)
  tau_alpha3 ~ dgamma(0.01, 0.01)

  mu_alpha4 ~ dnorm(0, 0.001)
  tau_alpha4 ~ dgamma(0.01, 0.01)

  mu_alpha5 ~ dnorm(0, 0.001)
  tau_alpha5 ~ dgamma(0.01, 0.01)

  ######## Availability #########
  for (h in 1:nspecies) {
    mean_phi0[h] ~ dnorm(0, 0.001)    # Mean availability for each species
    sd_phi0[h] ~ dexp(1)              # Standard deviation of availability for each species
    prec_phi0[h] <- 1 / (sd_phi0[h] ^ 2)

    for (i in 1:nprops) {
      for (j in 1:npoints_site[i]) {
        phi0[h, i, j] ~ dnorm(mean_phi0[h], prec_phi0[h]) # Mean availability for species h at property i and point j
      } # close j
    } # close i
  } # close h

  phi1 ~ dnorm(0, 0.001) # coefficient of day of year in availiabity linear model
  phi2 ~ dnorm(0, 0.001) # coefficient of day of year^2 in availiabity linear model
  phi3 ~ dnorm(0, 0.001) # coefficient of time after sunrise in availiabity linear model
  phi4 ~ dnorm(0, 0.001) # coefficient of temp in availiabity linear model
  phi5 ~ dnorm(0, 0.001) # coefficient of wind in availiabity linear model

#-----------------------------------------------------------------------------------------------------
# 2) Ecological process model
#-----------------------------------------------------------------------------------------------------

  for (h in 1:nspecies) {
    for (i in 1:nprops) {
      for (j in 1:npoints_site[i]) {
        z[h,i,j] ~ dbern(psi[h,i,j]) # True occupancy based on occupancy probability
        psi[h,i,j] <- 1 / (1 + exp(-lpsi.lim[h,i,j]))
        lpsi.lim[h,i,j] <- min(999, max(-999, lpsi[h,i,j]))
        lpsi[h,i,j] <- alpha0.psi[h] + alpha1[h] * fire[i, j] + alpha2[h] * ground[i, j] + alpha3[h] *
          height[i, j] + alpha4[h] * tba[i, j] + alpha5[h] * decid[i, j] + eps[i]

#-----------------------------------------------------------------------------------------------------
# 3) Observational process model
#-----------------------------------------------------------------------------------------------------

        ###### Availability with time removal ######
        for (v in 1:vh[i, j]) {
          # loop over each visit (v) to each site

          # Availability is a function of intercept + covariates

          y[h,i,j,v] ~ dbern(mu.p[h,i,j,v]) # Detection/non-detection
          mu.p[h,i,j,v] <- z[h,i,j] * pa[h,i,j,v] # mu.p conditional on bird being present at site

          logit(p[h,i,j,v]) <- phi0[h, i, j] + phi1 * obs_date[i, j, v] + phi2 * obs_date[i, j, v] * obs_date[i, j, v] + phi3 * obs_time[i, j, v] + phi4 * obs_temp[i, j, v] + phi5 * obs_wind[i, j, v]

          for (z in 1:ntbins) {
            # Probability of being available in each time bin
            # pi_pa in time bin >1 conditional on not being detected before
            pi_pa[h, i, j, z, v] <-
              p[h, i, j, v] * pow(1 - p[h, i, j, v], (z - 1))
            pi_pa_normalized[h, i, j, z, v] <-
              pi_pa[h, i, j, z, v] / pa[h, i, j, v]
          } # close z

          # Probability ever available
          pa[h, i, j, v] <- sum(pi_pa[h, i, j, 1:ntbins, v])

          # Time data - when were detections mentally removed?
          ytb[h, i, j, 1:ntbins, v] ~ dmulti(pi_pa_normalized[h, i, j, 1:ntbins, v], z[h,i,j])

        } # close v
      } # close j
    } # close i
  } # close h
}

I've messed with the initial values for z, making them all 1s or all 0s, in addition to what I've tried written above, but I always run into an error saying either "invalid parent node" or "node inconsistent with parents."


问:
Trying to confirm if <string key, string value> was inserted/deleted into concurrent_unordered_map
I'm working on a project to send requests between a client and a server.  Each request sent from the client will be get, put, and delete requests to alter a

tbb::concurrent_unordered_map<string key, string value> map global variable.

The put request is formatted to look for a pair that has the same key.  If it finds a matching key, alter the string value.  If a matching key is not found in the map, create a new key value pair and insert it into the map.  For delete, since multiple clients can connect to the server at any time, the erase method is unsafe and should be locked using mutex locks.

I've written the method to perform the get request and and another method to format the response, but am struggling to write the methods for the put and delete request.

Here is what I have so far:

```<code>bool handle_put_request(string key, string value) {
    pair<tbb::concurrent_unordered_map<string, string>::iterator, bool> pair= map.insert({key, value});
    if (pair->second) {
        return "OK";
    } else {
        return "ERROR";
    }
}

string handle_delete_request(string key) {
    delete_req.lock();
    int delete_value = map.unsafe_erase(key);
    delete_req.unlock();
    if(delete_value == 1) {
        return "OK";
    } else {
        return "ERROR";
    }

}
</code>```

For both requests, I want to determine if the request went through correctly, then return a string so that another method can format the response and send it back to the server.  I believe put is correct but I don't have a way to test it as my connection to the server isn't working yet.  I'm unsure of the return type of the unsafe_erase method so does this look correct.

Body:
I'm working on a project to send requests between a client and a server.  Each request sent from the client will be get, put, and delete requests to alter a

tbb::concurrent_unordered_map<string key, string value> map global variable.

The put request is formatted to look for a pair that has the same key.  If it finds a matching key, alter the string value.  If a matching key is not found in the map, create a new key value pair and insert it into the map.  For delete, since multiple clients can connect to the server at any time, the erase method is unsafe and should be locked using mutex locks.

I've written the method to perform the get request and and another method to format the response, but am struggling to write the methods for the put and delete request.

Here is what I have so far:

bool handle_put_request(string key, string value) {
    pair<tbb::concurrent_unordered_map<string, string>::iterator, bool> pair= map.insert({key, value});
    if (pair->second) {
        return "OK";
    } else {
        return "ERROR";
    }
}

string handle_delete_request(string key) {
    delete_req.lock();
    int delete_value = map.unsafe_erase(key);
    delete_req.unlock();
    if(delete_value == 1) {
        return "OK";
    } else {
        return "ERROR";
    }

}

For both requests, I want to determine if the request went through correctly, then return a string so that another method can format the response and send it back to the server.  I believe put is correct but I don't have a way to test it as my connection to the server isn't working yet.  I'm unsure of the return type of the unsafe_erase method so does this look correct.


问:
Run ballon.py from Mask_RCNN project
I am trying to run balloon.py from https://github.com/matterport/Mask_RCNN on Pycharm, using tensorflow 2.11 and python 3.8. I have been able to make changes to model.py to accomodate tensorflow 2.11. Now, when I try to run balloons.py from Pycharm, the issue I am running into is this:

```<code>usage: balloon.py [-h] [--dataset /path/to/balloon/dataset/] --weights
              /path/to/weights.h5 [--logs /path/to/logs/]
              [--image path or URL to image]
              [--video path or URL to video]
              <command>
balloon.py: error: the following arguments are required: <command>, --weights
</code>```

I think the error stems from this section of balloons.py:

```<code>if __name__ == '__main__':
import argparse

# Parse command line arguments
parser = argparse.ArgumentParser(
    description='Train Mask R-CNN to detect balloons.')
parser.add_argument("command",
                    metavar="<command>",
                    help="'train' or 'splash'")
parser.add_argument('--dataset', required=False,
                    metavar="/path/to/balloon/dataset/",
                    help='Directory of the Balloon dataset')
parser.add_argument('--weights', required=True,
                    metavar="/path/to/weights.h5",
                    help="Path to weights .h5 file or 'coco'")
parser.add_argument('--logs', required=False,
                    default=DEFAULT_LOGS_DIR,
                    metavar="/path/to/logs/",
                    help='Logs and checkpoints directory (default=logs/)')
parser.add_argument('--image', required=False,
                    metavar="path or URL to image",
                    help='Image to apply the color splash effect on')
parser.add_argument('--video', required=False,
                    metavar="path or URL to video",
                    help='Video to apply the color splash effect on')
args = parser.parse_args()
</code>```

I am not sure how to correct this.

The only modification I've made to this project is changing the root directory to where I'm storing this project.

Title: Run ballon.py from Mask_RCNN project

Body:
I am trying to run balloon.py from https://github.com/matterport/Mask_RCNN on Pycharm, using tensorflow 2.11 and python 3.8. I have been able to make changes to model.py to accomodate tensorflow 2.11. Now, when I try to run balloons.py from Pycharm, the issue I am running into is this:

usage: balloon.py [-h] [--dataset /path/to/balloon/dataset/] --weights
              /path/to/weights.h5 [--logs /path/to/logs/]
              [--image path or URL to image]
              [--video path or URL to video]
              <command>
balloon.py: error: the following arguments are required: <command>, --weights

I think the error stems from this section of balloons.py:

if __name__ == '__main__':
import argparse

# Parse command line arguments
parser = argparse.ArgumentParser(
    description='Train Mask R-CNN to detect balloons.')
parser.add_argument("command",
                    metavar="<command>",
                    help="'train' or 'splash'")
parser.add_argument('--dataset', required=False,
                    metavar="/path/to/balloon/dataset/",
                    help='Directory of the Balloon dataset')
parser.add_argument('--weights', required=True,
                    metavar="/path/to/weights.h5",
                    help="Path to weights .h5 file or 'coco'")
parser.add_argument('--logs', required=False,
                    default=DEFAULT_LOGS_DIR,
                    metavar="/path/to/logs/",
                    help='Logs and checkpoints directory (default=logs/)')
parser.add_argument('--image', required=False,
                    metavar="path or URL to image",
                    help='Image to apply the color splash effect on')
parser.add_argument('--video', required=False,
                    metavar="path or URL to video",
                    help='Video to apply the color splash effect on')
args = parser.parse_args()

I am not sure how to correct this.

The only modification I've made to this project is changing the root directory to where I'm storing this project.


问:
GraphQLError: Type <TYPE> must define one or more fields
Problem

When I try to start this Federated Property Service, I get an error that says: GraphQLError: Type Property must define one or more fields.

The Schema that it generates looks correct, and has those fields populated, but when I add the @Directive('@key(fields: "id")') It generates this error.

Property Model

```<code>import { Directive, Field, ID, ObjectType } from "@nestjs/graphql";

@ObjectType()
export class Address {
  @Field()
  addressLineOne: string;

  @Field()
  addressLineTwo: string;

  @Field()
  addressLineThree: string;

  @Field()
  postcode: string;
}

@ObjectType()
@Directive('@key(fields: "id")')
export class Property {
  @Field((type) => ID)
  id: string;

  @Field()
  owner: string;

  @Field()
  propertyUPRN: string;

  @Field()
  address: Address;
}
</code>```

Property Resolver

```<code>import { Query, Resolver, ResolveReference } from "@nestjs/graphql";
import { Property } from "./models/property.model";
import { PropertiesService } from "./properties.service";

@Resolver((of) => Property)
export class PropertiesResolver {
  constructor(private readonly propertiesService: PropertiesService) {}

  @Query((returns) => [Property])
  public async findAllProperties(): Promise<Property[]> {
    return this.propertiesService.findAll();
  }

  @ResolveReference()
  public async resolveReference(ref: { __typename: string; id: string }): Promise<Property> {
    return await this.propertiesService.findOneById(ref.id);
  }
}

</code>```

Auto Generated Schema

```<code># ------------------------------------------------------
# THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
# ------------------------------------------------------

directive @key(fields: String!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE

directive @extends on OBJECT | INTERFACE

directive @external on OBJECT | FIELD_DEFINITION

directive @requires(fields: String!) on FIELD_DEFINITION

directive @provides(fields: String!) on FIELD_DEFINITION

directive @shareable on FIELD_DEFINITION | OBJECT

directive @link(url: String!, import: [link__Import]) on SCHEMA

directive @tag(name: String!) repeatable on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

directive @inaccessible on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

directive @override(from: String!) on FIELD_DEFINITION

type Address {
  addressLineOne: String!
  addressLineTwo: String!
  addressLineThree: String!
  postcode: String!
}

type Property {
  id: ID!
  owner: String!
  propertyUPRN: String!
  address: Address!
}

type Query {
  findAllProperties: [Property!]!
}

scalar link__Import
</code>```

Package JSON

```<code>{
  "name": "nest-typescript-starter",
  "version": "1.0.0",
  "description": "Nest TypeScript starter repository",
  "license": "MIT",
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint '{src,apps,libs,test}/**/*.ts' --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "echo 'No e2e tests implemented yet.'"
  },
  "dependencies": {
    "@apollo/federation": "^0.38.1",
    "@apollo/subgraph": "^2.2.2",
    "@nestjs/apollo": "10.0.17",
    "@nestjs/common": "9.0.1",
    "@nestjs/core": "9.0.1",
    "@nestjs/graphql": "10.0.18",
    "@nestjs/mongoose": "^9.2.1",
    "@nestjs/platform-express": "9.0.1",
    "apollo-server": "3.9.0",
    "apollo-server-express": "3.9.0",
    "class-transformer": "0.5.1",
    "class-validator": "0.13.2",
    "graphql": "16.5.0",
    "graphql-query-complexity": "0.11.0",
    "graphql-subscriptions": "2.0.0",
    "mongoose": "^6.8.0",
    "reflect-metadata": "0.1.13",
    "rxjs": "7.5.5"
  },
  "devDependencies": {
    "@nestjs/cli": "9.0.0",
    "@nestjs/schematics": "9.0.1",
    "@nestjs/testing": "9.0.1",
    "@types/express": "4.17.13",
    "@types/node": "18.0.3",
    "@types/supertest": "2.0.12",
    "@typescript-eslint/eslint-plugin": "5.30.5",
    "@typescript-eslint/parser": "5.30.5",
    "eslint": "8.19.0",
    "eslint-config-prettier": "8.5.0",
    "eslint-plugin-import": "2.26.0",
    "jest": "28.1.2",
    "prettier": "2.7.1",
    "supertest": "6.2.4",
    "ts-jest": "28.0.5",
    "ts-loader": "9.3.1",
    "ts-node": "10.8.2",
    "tsconfig-paths": "4.0.0",
    "typescript": "4.7.4"
  }
}
</code>```

Body:
Problem

When I try to start this Federated Property Service, I get an error that says: GraphQLError: Type Property must define one or more fields.

The Schema that it generates looks correct, and has those fields populated, but when I add the @Directive('@key(fields: "id")') It generates this error.

Property Model

import { Directive, Field, ID, ObjectType } from "@nestjs/graphql";

@ObjectType()
export class Address {
  @Field()
  addressLineOne: string;

  @Field()
  addressLineTwo: string;

  @Field()
  addressLineThree: string;

  @Field()
  postcode: string;
}

@ObjectType()
@Directive('@key(fields: "id")')
export class Property {
  @Field((type) => ID)
  id: string;

  @Field()
  owner: string;

  @Field()
  propertyUPRN: string;

  @Field()
  address: Address;
}

Property Resolver

import { Query, Resolver, ResolveReference } from "@nestjs/graphql";
import { Property } from "./models/property.model";
import { PropertiesService } from "./properties.service";

@Resolver((of) => Property)
export class PropertiesResolver {
  constructor(private readonly propertiesService: PropertiesService) {}

  @Query((returns) => [Property])
  public async findAllProperties(): Promise<Property[]> {
    return this.propertiesService.findAll();
  }

  @ResolveReference()
  public async resolveReference(ref: { __typename: string; id: string }): Promise<Property> {
    return await this.propertiesService.findOneById(ref.id);
  }
}

Auto Generated Schema

# ------------------------------------------------------
# THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
# ------------------------------------------------------

directive @key(fields: String!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE

directive @extends on OBJECT | INTERFACE

directive @external on OBJECT | FIELD_DEFINITION

directive @requires(fields: String!) on FIELD_DEFINITION

directive @provides(fields: String!) on FIELD_DEFINITION

directive @shareable on FIELD_DEFINITION | OBJECT

directive @link(url: String!, import: [link__Import]) on SCHEMA

directive @tag(name: String!) repeatable on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

directive @inaccessible on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

directive @override(from: String!) on FIELD_DEFINITION

type Address {
  addressLineOne: String!
  addressLineTwo: String!
  addressLineThree: String!
  postcode: String!
}

type Property {
  id: ID!
  owner: String!
  propertyUPRN: String!
  address: Address!
}

type Query {
  findAllProperties: [Property!]!
}

scalar link__Import

Package JSON

{
  "name": "nest-typescript-starter",
  "version": "1.0.0",
  "description": "Nest TypeScript starter repository",
  "license": "MIT",
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint '{src,apps,libs,test}/**/*.ts' --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "echo 'No e2e tests implemented yet.'"
  },
  "dependencies": {
    "@apollo/federation": "^0.38.1",
    "@apollo/subgraph": "^2.2.2",
    "@nestjs/apollo": "10.0.17",
    "@nestjs/common": "9.0.1",
    "@nestjs/core": "9.0.1",
    "@nestjs/graphql": "10.0.18",
    "@nestjs/mongoose": "^9.2.1",
    "@nestjs/platform-express": "9.0.1",
    "apollo-server": "3.9.0",
    "apollo-server-express": "3.9.0",
    "class-transformer": "0.5.1",
    "class-validator": "0.13.2",
    "graphql": "16.5.0",
    "graphql-query-complexity": "0.11.0",
    "graphql-subscriptions": "2.0.0",
    "mongoose": "^6.8.0",
    "reflect-metadata": "0.1.13",
    "rxjs": "7.5.5"
  },
  "devDependencies": {
    "@nestjs/cli": "9.0.0",
    "@nestjs/schematics": "9.0.1",
    "@nestjs/testing": "9.0.1",
    "@types/express": "4.17.13",
    "@types/node": "18.0.3",
    "@types/supertest": "2.0.12",
    "@typescript-eslint/eslint-plugin": "5.30.5",
    "@typescript-eslint/parser": "5.30.5",
    "eslint": "8.19.0",
    "eslint-config-prettier": "8.5.0",
    "eslint-plugin-import": "2.26.0",
    "jest": "28.1.2",
    "prettier": "2.7.1",
    "supertest": "6.2.4",
    "ts-jest": "28.0.5",
    "ts-loader": "9.3.1",
    "ts-node": "10.8.2",
    "tsconfig-paths": "4.0.0",
    "typescript": "4.7.4"
  }
}


问:
All ports not available with React npm run start
So up until yesterday I was able to do npm start no issues.

The versions of things I'm running

```<code>OSX Mojave...
 npm: '8.19.3',
  node: '19.2.0',
</code>```

Now it is saying that port 3000 is in use. I've done all the tricks to see if 3000 is in use is isn't

changed the port to 3001 3005 4444 and various other and it doesn't work.

Still the same message.

serve -s build works great and runs the app on 3000. no idea what is going on..

```<code>error message
✔ Something is already running on port 4001.

Would you like to run the app on another port instead? … no
</code>```

I've tried

```<code>user@computer >> npx kill-port 4001
Could not kill process on port 4001. No process running on port.
user@computer >>  mtbcrm_react % lsof -i tcp:4001
</code>```

Body:
So up until yesterday I was able to do npm start no issues.

The versions of things I'm running

OSX Mojave...
 npm: '8.19.3',
  node: '19.2.0',

Now it is saying that port 3000 is in use. I've done all the tricks to see if 3000 is in use is isn't

changed the port to 3001 3005 4444 and various other and it doesn't work.

Still the same message.

serve -s build works great and runs the app on 3000. no idea what is going on..

error message
✔ Something is already running on port 4001.

Would you like to run the app on another port instead? … no

I've tried

user@computer >> npx kill-port 4001
Could not kill process on port 4001. No process running on port.
user@computer >>  mtbcrm_react % lsof -i tcp:4001


问:
flutter/dart: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 5140 pos 12: '_history.isNotEmpty': is not true
I have used persistent_bottom_nav_bar: ^5.0.2 and I have used bunch of pages and every page has app bar and on app bar is logout button when I try to logout It throw this mentioned exception.(Long story short).
any help would be appreciated thanks.
the following is scenario like which I have implemented :

```<code>  class LoginPage extends StatefulWidget {
      const LoginPage({Key? key}) : super(key: key);

      @override
      State<LoginPage> createState() => _LoginPageState();
    }

    class _LoginPageState extends State<LoginPage> {
      GlobalKey<FormState> formKey = GlobalKey<FormState>();

      @override
      Widget build(BuildContext context) {
        return SafeArea(
          child: Scaffold(
            body: ListView(
              children: [
                Form(
                  key: formKey,
                  child: Column(
                    children: [
                      FloatingActionButton(
                        onPressed: () async {
                          if (formKey.currentState!.validate()) {
                            if (accessToken != null) {
                              Navigator.push(
                                context,
                                MaterialPageRoute(
                                  builder: (context) => MultiProvider(
                                    providers: [
                                      ChangeNotifierProvider<DashboardProvider>(
                                          create: (context) => DashboardProvider()),
                                    ],
                                    child: Dashboard(),
                                  ),
                                ),
                              );
                            }
                          }
                        },
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
        );
      }
    }

    ////////////////////////////////////////////////////////////////////////////////
    class Dashboard extends StatefulWidget {
      Dashboard({Key? key}) : super(key: key);

      static PersistentTabController controller =
          PersistentTabController(initialIndex: 0);
      @override
      State<Dashboard> createState() => _DashboardState();
    }

    class _DashboardState extends State<Dashboard> {
      List<Widget> _buildScreen() {
        return [
          HomePage(),
          FoTotalOrdersLocation(),
        ];
      }

      List<PersistentBottomNavBarItem> _navigationBarItems() {
        return [
          PersistentBottomNavBarItem(
            icon: Icon(
              Icons.home,
              size: 30,
            ),
            textStyle: TextStyle(fontSize: 20),
            title: ("Home"),
          ),
          PersistentBottomNavBarItem(
            icon: Icon(
              Icons.location_on,
              size: 30,
            ),
            textStyle: TextStyle(fontSize: 20),
            title: ("Location"),
          ),
        ];
      }

      @override
      void initState() {
        super.initState();
        if (Dashboard.controller.index == 0) {}
      }

      @override
      Widget build(BuildContext context) {
        print("build called");
        return Scaffold(
          body: ChangeNotifierProvider(
            create: (context) => FoHomePageProvider(context),
            child: PersistentTabView(
              context,
              controller: Dashboard.controller,
              screens: _buildScreen(),
              items: _navigationBarItems(),
              onItemSelected: (val) async {},
            ),
          ),
        );
      }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////

    class HomePage extends StatelessWidget {
      const HomePage({Key? key}) : super(key: key);

      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            leading: IconButton(
              onPressed: () {
                Navigator.popUntil(
                  context,
                  ModalRoute.withName(' /loginPage'),
                );
              },
              icon: Icon(Icons.logout),
            ),
          ),
          body:ElevatedButtonWidget(
                    text: "Next",

                    onPressed: () {
                            Navigator.push(
                              context,
                              MaterialPageRoute(
                                builder: (context) =>  UsersPage(),
                                ),
                              ),
                            );
                          }

                  ),
        );
      }
    }
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////
    import 'package:flutter/material.dart';

    class UsersPage extends StatelessWidget {
      const UsersPage({Key? key}) : super(key: key);

      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            leading: IconButton(
              onPressed: () {
                Navigator.popUntil(
                  context,
                  ModalRoute.withName(' /loginPage'),
                );
              },
              icon: Icon(Icons.logout),
            ),
          ),
          body: Text("Users page"),
        );
      }
    }
</code>```

when I try to logout the following exception is thrown :

```<code>════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building Navigator(dirty, dependencies: [UnmanagedRestorationScope, HeroControllerScope], state: NavigatorState#5900b(tickers: tracking 0 tickers)):
'package:flutter/src/widgets/navigator.dart': Failed assertion: line 5140 pos 12: '_history.isNotEmpty': is not true.
package:flutter/…/widgets/navigator.dart:5140
2
</code>```

Body:
I have used persistent_bottom_nav_bar: ^5.0.2 and I have used bunch of pages and every page has app bar and on app bar is logout button when I try to logout It throw this mentioned exception.(Long story short).
any help would be appreciated thanks.
the following is scenario like which I have implemented :

  class LoginPage extends StatefulWidget {
      const LoginPage({Key? key}) : super(key: key);

      @override
      State<LoginPage> createState() => _LoginPageState();
    }

    class _LoginPageState extends State<LoginPage> {
      GlobalKey<FormState> formKey = GlobalKey<FormState>();

      @override
      Widget build(BuildContext context) {
        return SafeArea(
          child: Scaffold(
            body: ListView(
              children: [
                Form(
                  key: formKey,
                  child: Column(
                    children: [
                      FloatingActionButton(
                        onPressed: () async {
                          if (formKey.currentState!.validate()) {
                            if (accessToken != null) {
                              Navigator.push(
                                context,
                                MaterialPageRoute(
                                  builder: (context) => MultiProvider(
                                    providers: [
                                      ChangeNotifierProvider<DashboardProvider>(
                                          create: (context) => DashboardProvider()),
                                    ],
                                    child: Dashboard(),
                                  ),
                                ),
                              );
                            }
                          }
                        },
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
        );
      }
    }

    ////////////////////////////////////////////////////////////////////////////////
    class Dashboard extends StatefulWidget {
      Dashboard({Key? key}) : super(key: key);

      static PersistentTabController controller =
          PersistentTabController(initialIndex: 0);
      @override
      State<Dashboard> createState() => _DashboardState();
    }

    class _DashboardState extends State<Dashboard> {
      List<Widget> _buildScreen() {
        return [
          HomePage(),
          FoTotalOrdersLocation(),
        ];
      }

      List<PersistentBottomNavBarItem> _navigationBarItems() {
        return [
          PersistentBottomNavBarItem(
            icon: Icon(
              Icons.home,
              size: 30,
            ),
            textStyle: TextStyle(fontSize: 20),
            title: ("Home"),
          ),
          PersistentBottomNavBarItem(
            icon: Icon(
              Icons.location_on,
              size: 30,
            ),
            textStyle: TextStyle(fontSize: 20),
            title: ("Location"),
          ),
        ];
      }

      @override
      void initState() {
        super.initState();
        if (Dashboard.controller.index == 0) {}
      }

      @override
      Widget build(BuildContext context) {
        print("build called");
        return Scaffold(
          body: ChangeNotifierProvider(
            create: (context) => FoHomePageProvider(context),
            child: PersistentTabView(
              context,
              controller: Dashboard.controller,
              screens: _buildScreen(),
              items: _navigationBarItems(),
              onItemSelected: (val) async {},
            ),
          ),
        );
      }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////

    class HomePage extends StatelessWidget {
      const HomePage({Key? key}) : super(key: key);

      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            leading: IconButton(
              onPressed: () {
                Navigator.popUntil(
                  context,
                  ModalRoute.withName(' /loginPage'),
                );
              },
              icon: Icon(Icons.logout),
            ),
          ),
          body:ElevatedButtonWidget(
                    text: "Next",

                    onPressed: () {
                            Navigator.push(
                              context,
                              MaterialPageRoute(
                                builder: (context) =>  UsersPage(),
                                ),
                              ),
                            );
                          }

                  ),
        );
      }
    }
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////
    import 'package:flutter/material.dart';

    class UsersPage extends StatelessWidget {
      const UsersPage({Key? key}) : super(key: key);

      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            leading: IconButton(
              onPressed: () {
                Navigator.popUntil(
                  context,
                  ModalRoute.withName(' /loginPage'),
                );
              },
              icon: Icon(Icons.logout),
            ),
          ),
          body: Text("Users page"),
        );
      }
    }

when I try to logout the following exception is thrown :

════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building Navigator(dirty, dependencies: [UnmanagedRestorationScope, HeroControllerScope], state: NavigatorState#5900b(tickers: tracking 0 tickers)):
'package:flutter/src/widgets/navigator.dart': Failed assertion: line 5140 pos 12: '_history.isNotEmpty': is not true.
package:flutter/…/widgets/navigator.dart:5140
2


问:
Virt-manager, GPU passthrough "Preparing host device" freeze
I'm trying to do a macos vm with gpu passthrough with virt-manager, but everytime I run my vm with  my GPU, libvirtd totally freeze.

If anyone got an idea about this topic, that could be nice :)

I followed this tutorial : https://www.youtube.com/watch?v=eTX10QlFJ6c

I cannot restart libvirtd service, access to qemu/kvm connection etc...
I set in virt-manager my gpu via pci passthrough, my bios rom, set my keyboard and mouse

When I start my vm, nothing happen except in logs

```<code>sudo tail -f /var/log/libvirt/libvirtd.log

2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6697 : Create domain masterKey
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6701 : Setting up storage
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6705 : Setting up host devices
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6709 : Prepare chardev source backends
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6713 : Prepare device secrets
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6717 : Prepare bios/uefi paths
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6723 : Preparing external devices
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6728 : Aligning guest memory
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6742 : Preparing monitor state
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6751 : Updating guest CPU definition
2022-12-13 21:24:09.923+0000: 616: debug : qemuProcessPrepareHost:7184 : Preparing network devices
2022-12-13 21:24:09.923+0000: 616: debug : qemuProcessPrepareHost:7189 : Preparing host devices

</code>```

And then get stuck here, nothing else happen

Body:
I'm trying to do a macos vm with gpu passthrough with virt-manager, but everytime I run my vm with  my GPU, libvirtd totally freeze.

If anyone got an idea about this topic, that could be nice :)

I followed this tutorial : https://www.youtube.com/watch?v=eTX10QlFJ6c

I cannot restart libvirtd service, access to qemu/kvm connection etc...
I set in virt-manager my gpu via pci passthrough, my bios rom, set my keyboard and mouse

When I start my vm, nothing happen except in logs

sudo tail -f /var/log/libvirt/libvirtd.log

2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6697 : Create domain masterKey
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6701 : Setting up storage
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6705 : Setting up host devices
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6709 : Prepare chardev source backends
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6713 : Prepare device secrets
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6717 : Prepare bios/uefi paths
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6723 : Preparing external devices
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6728 : Aligning guest memory
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6742 : Preparing monitor state
2022-12-13 21:24:09.901+0000: 616: debug : qemuProcessPrepareDomain:6751 : Updating guest CPU definition
2022-12-13 21:24:09.923+0000: 616: debug : qemuProcessPrepareHost:7184 : Preparing network devices
2022-12-13 21:24:09.923+0000: 616: debug : qemuProcessPrepareHost:7189 : Preparing host devices

And then get stuck here, nothing else happen


问:
Angular HTTP_INTERCEPTOR without change detection
In my app I have created a HTTP_INTERCEPTOR. It works, but the problem is that after completing the component is not detecting the changes.

Interceptor:

```<code>    request: HttpRequest<any>,
    next: HttpHandler
      ): Observable<HttpEvent<any>> {

    const user = this.authenticationService.userValue;
    const isLoggedIn = user && user.token;
    const isApiUrl = request.url.startsWith(environment.apiUrl);
    if (isLoggedIn && isApiUrl) {
        request = request.clone({
            setHeaders: {
                Authorization: `Bearer ${user.token}`
            }
        });
    }
    return next.handle(request)
)
</code>```

Component function:

```<code>test() {
    const url_ = "https://localhost:44320/api/Plan/Get?start=2022-12-16&end=2023-01-16";
    this.http.request("post", url_, {}).subscribe(res => {
      this.employees = res;  // <-- Is not detected in view
    });
}
</code>```

I have tried wrapping the interceptor return in NgZone.run() but this does not help. I have tried ApplicationRef.tick() in the intercepter, which also does not help.

It does however work if I use the ChangeDetectorRef.detectChanges() in the component, but it seems very cumbersome having to do this after each request in each component.

Any help or suggestion will be highly appreciated, thanks.

Body:
In my app I have created a HTTP_INTERCEPTOR. It works, but the problem is that after completing the component is not detecting the changes.

Interceptor:

    request: HttpRequest<any>,
    next: HttpHandler
      ): Observable<HttpEvent<any>> {

    const user = this.authenticationService.userValue;
    const isLoggedIn = user && user.token;
    const isApiUrl = request.url.startsWith(environment.apiUrl);
    if (isLoggedIn && isApiUrl) {
        request = request.clone({
            setHeaders: {
                Authorization: `Bearer ${user.token}`
            }
        });
    }
    return next.handle(request)
)

Component function:

test() {
    const url_ = "https://localhost:44320/api/Plan/Get?start=2022-12-16&end=2023-01-16";
    this.http.request("post", url_, {}).subscribe(res => {
      this.employees = res;  // <-- Is not detected in view
    });
}

I have tried wrapping the interceptor return in NgZone.run() but this does not help. I have tried ApplicationRef.tick() in the intercepter, which also does not help.

It does however work if I use the ChangeDetectorRef.detectChanges() in the component, but it seems very cumbersome having to do this after each request in each component.

Any help or suggestion will be highly appreciated, thanks.