问:
How to configure backup path in gitlab helm chart installation?
I've installed gitlab on my k8s cluster using a helm chart.

Now I would like to create a local backup. As far as I found in the docs, there is the toolbox, in which I could just run backup-utility. But this works only for backups, which are stored in S3. I just need a local backup file in a specific directory.

So I came up with gitlab-rake gitlab:backup:create - also in the toolbox pod. It works, as I can find the file in /srv/gitlab/tmp/backups.
I didn't find an option where the backups should be moved to.

In omnibus installation there are config options like

```<code>gitlab_rails['backup_path'] = '/mnt/backups'
</code>```

in /etc/gitlab/gitlab.rb and then running sudo gitlab-ctl reconfigure.

How should I configure this in a helm chart installation?

```<code>global:
  edition: ce
gitlab:
  toolbox:
    enabled: true
    replicas: 1
    backups:
      cron:
        enabled: true
        persistence:
          enabled: true
          storageClass: longhorn
          accessMode: ReadWriteOnce
          size: 10Gi
    persistence:
      enabled: true
      storageClass: longhorn
      accessMode: 'ReadWriteOnce'
      size: '10Gi'
</code>```

Body:
I've installed gitlab on my k8s cluster using a helm chart.

Now I would like to create a local backup. As far as I found in the docs, there is the toolbox, in which I could just run backup-utility. But this works only for backups, which are stored in S3. I just need a local backup file in a specific directory.

So I came up with gitlab-rake gitlab:backup:create - also in the toolbox pod. It works, as I can find the file in /srv/gitlab/tmp/backups.
I didn't find an option where the backups should be moved to.

In omnibus installation there are config options like

gitlab_rails['backup_path'] = '/mnt/backups'

in /etc/gitlab/gitlab.rb and then running sudo gitlab-ctl reconfigure.

How should I configure this in a helm chart installation?

global:
  edition: ce
gitlab:
  toolbox:
    enabled: true
    replicas: 1
    backups:
      cron:
        enabled: true
        persistence:
          enabled: true
          storageClass: longhorn
          accessMode: ReadWriteOnce
          size: 10Gi
    persistence:
      enabled: true
      storageClass: longhorn
      accessMode: 'ReadWriteOnce'
      size: '10Gi'


来源: stackexchange

问:
How to send several consecutive actions to the same effect with different parameters?
When loading a component I try to make several calls to the same action with different parameters, this action is processed by an effect but only the one defined first is being executed.

component

```<code>ngOnInit() {
  this.store.dispatch(
    ComponentActions.fetchContent({
      pageSize: 5,
      pageNumber: 1,
      contentType: ContentType.bulletin,
    })
  );

  this.store.dispatch(
    ComponentActions.fetchContent({
      pageSize: 5,
      pageNumber: 1,
      contentType: ContentType.link,
    })
  );

  this.store.dispatch(
    ComponentActions.fetchContent({
      pageSize: 5,
      pageNumber: 1,
      contentType: ContentType.information,
    })
  );
}
</code>```

effect

```<code>fetchContent$ = createEffect(() =>
  this.actions$.pipe(
    ofType(ComponentActions.fetchContent),
    concatLatestFrom((action) => this.store.select(selectUserDealer)),
    tap(([action, dealer]) => [action, dealer]),
    exhaustMap(([action, dealer]) =>
      this.contentsService
        .fetch(
          distribuidor?.id!,
          action.contentType,
          action.pageSize,
          action.pageNumber
        )
        .pipe(map((response) => ({ response })))
    ),
    switchMap(({ response }) => [
      EffectsActions.setTotalRecords({
        payload: response.totalRecords,
      }),
      EffectsActions.successfulFetchContent({
        payload: response.payload,
      }),
    ]),
    catchError((error) =>
      of(EffectsActions.failedFetchContent({ payload: error }))
    )
  )
);
</code>```

What is the correct way to send several consecutive actions to the same effect with different parameters?

ContentLicense: CC BY-SA 4.0

Body:
When loading a component I try to make several calls to the same action with different parameters, this action is processed by an effect but only the one defined first is being executed.

component

ngOnInit() {
  this.store.dispatch(
    ComponentActions.fetchContent({
      pageSize: 5,
      pageNumber: 1,
      contentType: ContentType.bulletin,
    })
  );

  this.store.dispatch(
    ComponentActions.fetchContent({
      pageSize: 5,
      pageNumber: 1,
      contentType: ContentType.link,
    })
  );

  this.store.dispatch(
    ComponentActions.fetchContent({
      pageSize: 5,
      pageNumber: 1,
      contentType: ContentType.information,
    })
  );
}

effect

fetchContent$ = createEffect(() =>
  this.actions$.pipe(
    ofType(ComponentActions.fetchContent),
    concatLatestFrom((action) => this.store.select(selectUserDealer)),
    tap(([action, dealer]) => [action, dealer]),
    exhaustMap(([action, dealer]) =>
      this.contentsService
        .fetch(
          distribuidor?.id!,
          action.contentType,
          action.pageSize,
          action.pageNumber
        )
        .pipe(map((response) => ({ response })))
    ),
    switchMap(({ response }) => [
      EffectsActions.setTotalRecords({
        payload: response.totalRecords,
      }),
      EffectsActions.successfulFetchContent({
        payload: response.payload,
      }),
    ]),
    catchError((error) =>
      of(EffectsActions.failedFetchContent({ payload: error }))
    )
  )
);

What is the correct way to send several consecutive actions to the same effect with different parameters?


问:
Angular 14 ngFor not workin on API call. Nothing to show
Following is my Component:

```<code>export class UserListComponent implements OnInit {

  userList$:any;

  constructor(private httpClient: HttpClient) {
    this.userList$ = []
  }

  initUserList() {

    this.httpClient.get("https://localhost:44447/api/User/GetUserList").subscribe((res: any) => {
      this.userList$ = res.resultObject;
      console.log(res.resultObject)
    })

  }

  ngOnInit(): void {
    this.initUserList()
  }

}
</code>```

Following is my Template:

```<code><div *ngFor="let user of userList$">
  {{user.fullName}}
</div>
</code>```

The response returned from the service is written to the userList object. Console output as below

The response returned from the service is written to the userList object. But for some reason the template is not updating

Body:
Following is my Component:

export class UserListComponent implements OnInit {

  userList$:any;

  constructor(private httpClient: HttpClient) {
    this.userList$ = []
  }

  initUserList() {

    this.httpClient.get("https://localhost:44447/api/User/GetUserList").subscribe((res: any) => {
      this.userList$ = res.resultObject;
      console.log(res.resultObject)
    })

  }

  ngOnInit(): void {
    this.initUserList()
  }

}

Following is my Template:

  {{user.fullName}}

The response returned from the service is written to the userList object. Console output as below

The response returned from the service is written to the userList object. But for some reason the template is not updating


问:
Best way to update multiple attributes in nested state?
Just before I go about having to learn Redux or use Immer, I was wondering if anyone knew of a simple way to do this. I checked the React docs but I must be making a mistake somewhere, and need new sets of eyes on this.

I've got a users array of objects that is set to state {i.e. users, setUsers) , where each user object that has nested within it posts and concerts. Here's an example of one of them:

```<code>{
        "id": 305,
        "username": "L0V3MUSIC",
        "email": "kanisha.hansen@bayer.co",
        "posts": [
          {
                "id": 129,
                "body": "PLEASE EMAIL IF YOU HAVE 4 TICKETS ALTOGETHER! MY DAUGHTERS LOVE HER -- THX ",
                "for_sale": false,
                "tickets": 4,
                "concert_id": 51,
                "user_id": 305
          }
        ],
        "concerts": [
            {
                "id": 51,
                "date": "2023-07-22T00:00:00.000Z",
                "location": "Brooklyn Steel",
                "image": "https://i.imgur.com/SmFrzTC.jpg",
                "artist_id": 37
                }
           ]
},
</code>```

I've also got concerts state holding an array of objects  with the same information also and in the same way as above with users.

```<code>{
        "id": 51,
        "date": "2023-07-22T00:00:00.000Z",
        "location": "Brooklyn Steel",
        "image": "https://i.imgur.com/SmFrzTC.jpg",
        "artist_id": 37,
        "artist": {
                    "id": 37,
                    "name": "Adele",
                    "image": "https://i.imgur.com/zmGbfKS.jpg",
                    "genre": "Pop"
                 },
        "posts": [
            {
                    "id": 123,
                    "body": "2 tickets, $100 total OBO -- CHEAPEST YOU'LL EVER FIND FOR ADELE!!",
                    "for_sale": true,
                    "tickets": 2,
                    "concert_id": 51,
                    "user_id": 289
            },
            {
                    "id": 124,
                    "body": "3 tickets, $400 total OBO!",
                    "for_sale": true,
                    "tickets": 3,
                    "concert_id": 51,
                    "user_id": 289
           },
           {
                    "id": 129,
                    "body": "PLEASE EMAIL IF YOU HAVE 4 TICKETS ALTOGETHER! MY DAUGHTERS LOVE HER -- THX ",
                    "for_sale": false,
                    "tickets": 4,
                    "concert_id": 51,
                    "user_id": 305
         }
   ],
        "users": [
           {
                    "id": 289,
                    "username": "onlineguy1",
                    "email": "su@cronin.name"
            },
            {
                    "id": 305,
                    "username": "L0V3MUSIC",
                    "email": "kanisha.hansen@bayer.co"

              }
             ]
   },
</code>```

My issue is that I want to update a post that a user enters. I'd like to iterate either through users or through concerts, as I'm not sure which is best just yet given that both are 'symmetrical' in a sense. I don't want to have a posts state object though as I'm being graded on my ability to access users through concerts, and concerts through users.
currentUser is just the user that is currently logged in, and who would be the author of the created post. What I've tried to do a bunch of different ways is this: (here's my latest iteration)

```<code>  if (response.status >= 200 && response.status <= 299) {
        response.json().then((createdPost) => {
          console.log('createdPost: ', createdPost);
          const updatedPosts = currentUser.posts.map((eachPost) => {
            if (eachPost.id === createdPost.id) {
              return createdPost;
            } else {
              return eachPost;
            }
          });
          console.log('updatedPosts: ', updatedPosts);
          setCurrentUser(...currentUser, currentUser.posts: updatedPosts)
          // FIGURE OUT HOW TO UPDATE THE STATE OF THE ABOVE
          // THEN MAP THROUGH USERS AND UPDATE THAT USER WITH CURRENTUSER INSTEAD
        });
        setError([]);
        setSuccess('Your post has been created!');
        setSubmitted(true);
      } else {
</code>```

What I have above is updating the currentUser's posts and have an updated collection of the currentUser's post, and then ideally update the users state itself with this currentUser (and his updated posts) replacing currentUser (and his now outdated posts, given that they don't include the newly created post). But I've managed to confuse myself through the nesting and mapping and staring at this too long.

Is there a concise way to go about either updating the posts altogether then iterating through the user then updating users state, in a way that doesn't require redux or a plugin? Or is there a better way to go about handling this entirely? I'm assuming for sure that I'm being sloppy in getting this done so I'll take any steps in the right direction

Body:
Just before I go about having to learn Redux or use Immer, I was wondering if anyone knew of a simple way to do this. I checked the React docs but I must be making a mistake somewhere, and need new sets of eyes on this.

I've got a users array of objects that is set to state {i.e. users, setUsers) , where each user object that has nested within it posts and concerts. Here's an example of one of them:

{
        "id": 305,
        "username": "L0V3MUSIC",
        "email": "kanisha.hansen@bayer.co",
        "posts": [
          {
                "id": 129,
                "body": "PLEASE EMAIL IF YOU HAVE 4 TICKETS ALTOGETHER! MY DAUGHTERS LOVE HER -- THX ",
                "for_sale": false,
                "tickets": 4,
                "concert_id": 51,
                "user_id": 305
          }
        ],
        "concerts": [
            {
                "id": 51,
                "date": "2023-07-22T00:00:00.000Z",
                "location": "Brooklyn Steel",
                "image": "https://i.imgur.com/SmFrzTC.jpg",
                "artist_id": 37
                }
           ]
},

I've also got concerts state holding an array of objects  with the same information also and in the same way as above with users.

{
        "id": 51,
        "date": "2023-07-22T00:00:00.000Z",
        "location": "Brooklyn Steel",
        "image": "https://i.imgur.com/SmFrzTC.jpg",
        "artist_id": 37,
        "artist": {
                    "id": 37,
                    "name": "Adele",
                    "image": "https://i.imgur.com/zmGbfKS.jpg",
                    "genre": "Pop"
                 },
        "posts": [
            {
                    "id": 123,
                    "body": "2 tickets, $100 total OBO -- CHEAPEST YOU'LL EVER FIND FOR ADELE!!",
                    "for_sale": true,
                    "tickets": 2,
                    "concert_id": 51,
                    "user_id": 289
            },
            {
                    "id": 124,
                    "body": "3 tickets, $400 total OBO!",
                    "for_sale": true,
                    "tickets": 3,
                    "concert_id": 51,
                    "user_id": 289
           },
           {
                    "id": 129,
                    "body": "PLEASE EMAIL IF YOU HAVE 4 TICKETS ALTOGETHER! MY DAUGHTERS LOVE HER -- THX ",
                    "for_sale": false,
                    "tickets": 4,
                    "concert_id": 51,
                    "user_id": 305
         }
   ],
        "users": [
           {
                    "id": 289,
                    "username": "onlineguy1",
                    "email": "su@cronin.name"
            },
            {
                    "id": 305,
                    "username": "L0V3MUSIC",
                    "email": "kanisha.hansen@bayer.co"

              }
             ]
   },

My issue is that I want to update a post that a user enters. I'd like to iterate either through users or through concerts, as I'm not sure which is best just yet given that both are 'symmetrical' in a sense. I don't want to have a posts state object though as I'm being graded on my ability to access users through concerts, and concerts through users.
currentUser is just the user that is currently logged in, and who would be the author of the created post. What I've tried to do a bunch of different ways is this: (here's my latest iteration)

  if (response.status >= 200 && response.status <= 299) {
        response.json().then((createdPost) => {
          console.log('createdPost: ', createdPost);
          const updatedPosts = currentUser.posts.map((eachPost) => {
            if (eachPost.id === createdPost.id) {
              return createdPost;
            } else {
              return eachPost;
            }
          });
          console.log('updatedPosts: ', updatedPosts);
          setCurrentUser(...currentUser, currentUser.posts: updatedPosts)
          // FIGURE OUT HOW TO UPDATE THE STATE OF THE ABOVE
          // THEN MAP THROUGH USERS AND UPDATE THAT USER WITH CURRENTUSER INSTEAD
        });
        setError([]);
        setSuccess('Your post has been created!');
        setSubmitted(true);
      } else {

What I have above is updating the currentUser's posts and have an updated collection of the currentUser's post, and then ideally update the users state itself with this currentUser (and his updated posts) replacing currentUser (and his now outdated posts, given that they don't include the newly created post). But I've managed to confuse myself through the nesting and mapping and staring at this too long.

Is there a concise way to go about either updating the posts altogether then iterating through the user then updating users state, in a way that doesn't require redux or a plugin? Or is there a better way to go about handling this entirely? I'm assuming for sure that I'm being sloppy in getting this done so I'll take any steps in the right direction


问:
Ionic additional app content (app in app)
Current situation
I have multiple ionic react apps for different purposes. Lets say: one is a recipe app, the second a restaurant reservation app and the third a restaurant rating app.

All apps are distributed as single apps to the app stores. They have their own splash screens, icons etc.

The situation I want
I would like to create a single base app where users can sign in to their account. The base app will show their homepage with greeting and a list of apps (modules) that are available for install.

Lets say i’m an user and I would like to use the reservation app. In my base app I click on the reservation app icon and the app is installed within my base app and ready for use. If I choose to removd the app, it will be removed from my base app.

With this concept, users can use multiple apps from one single app and with one account (all data is written to databases and connected to their signed in account).

Let’s say I host all modules (apps) on azure or whatsoever, each time I upload a new ionic app to azure, the new extra module is shown in the base app as downloadable content.

Why do I want this?
It might happen, that in the future, I have over 10 applications. I own all these apps under 1 name. It would be much more user friendly to make them available to my users via one base app rather than having 10 or more apps in the stores for download.

Also, it would be much easier to expand the content each time. In stead of making a new build, upload it to the stores etc.

Why not build all the apps in one code base?
The app simply would get too big over time. Also, i do not want to make new builds each time and add them for review to the stores. Third, the users can decide what modules / apps they want to download in app.

I can not find an existing example. Is this possible and if so, what would be the first steps?

I have not tried anything yet.


问:
Problem with CMake and SQL Build on Mac in Azerothcore
```<code>CMake Error at src/cmake/macros/FindMySQL.cmake:302 (message):
  Could not find MySQL headers! Please install the development libraries and
  headers
Call Stack (most recent call first):
  CMakeLists.txt:102 (find_package)
</code>```

The problem I'm facing is in the configuration step.
Unsure of what exactly I have to change, is it just the path to the server? I.e.:/opt/homebrew/var/mysql/

I've tried that, and it's throwing the above error.

https://www.azerothcore.org/wiki/macos-core-installation#:~:text=Configuring%20for%20compiling,lib/libcrypto.dylib%22

I've tried identifying the path of the sql server, installed with Brew. Including that in the script.

Body:
CMake Error at src/cmake/macros/FindMySQL.cmake:302 (message):
  Could not find MySQL headers! Please install the development libraries and
  headers
Call Stack (most recent call first):
  CMakeLists.txt:102 (find_package)

The problem I'm facing is in the configuration step.
Unsure of what exactly I have to change, is it just the path to the server? I.e.:/opt/homebrew/var/mysql/

I've tried that, and it's throwing the above error.

https://www.azerothcore.org/wiki/macos-core-installation#:~:text=Configuring%20for%20compiling,lib/libcrypto.dylib%22

I've tried identifying the path of the sql server, installed with Brew. Including that in the script.


问:
Recreate HK2 injection at some future time
I'm using HK2 for my DI. The DI is injected as a Singleton.class.

This all works well, except I now have a use case that the DI needs to be updated. Imagine that I am injecting a List<SomeClass> using HK2. When the app boots, the List contains N elements.

At some future time, I have an internal API that I want this list to be updated if I hit. Right now, I have to reboot the app for the new List to show up.

How can I "refresh/update" the dependencies in HK2?


问:
Can I build spring-native boot image in low resources machine (like AWS CodeBuild Linux Small 2vCPUs / 3gb ram)?
I want to build boot build image for GraalVM spring native project using AWS CodeBuild called from AWS CodePipeline, but the build process stops at missing RAM resources. I tried the default spring builder and the following one: paketobuildpacks/builder:tiny.

The specification of the machine is Linux Small - BUILD_GENERAL1_SMALL - LINUX_CONTAINER    3 GB RAM, 2 vCPUs and 64 GB of disk space. The image of the environment is aws/codebuild/standard:6.0.

At my local MacBook M1 Pro, it takes around 5.5 GB of ram (checked in Docker Desktop stats), so
I tried at the second plan of BUILD_GENERAL1_MEDIUM as well, and the process went couple lines further, but at the end it was killed as well.

The partial stack trace can be found below (must be cut due to SO spam limits):

```<code>> Task :infrastructure:bootBuildImage
Building image 'docker.io/library/experiences-service:latest'
    [creator]     [1/7] Initializing...                                           (12.1s @ 0.56GB)
    [creator]      Version info: 'GraalVM 22.3.0 Java 17 CE'
    [creator]      Java version info: '17.0.5+8-LTS'
    [creator]      C compiler: gcc (linux, x86_64, 7.5.0)
    [creator]      Garbage collector: Serial GC
    [creator]      1 user-specific feature(s)
    [creator]      - org.springframework.aot.nativex.feature.PreComputeFieldFeature
    [creator]     The bundle named: i18n.Parsing, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
    [creator]     The bundle named: i18n.Scalars, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
    [creator]     [2/7] Performing analysis...  [**********]                     (114.5s @ 2.31GB)
    [creator]       28,561 (93.30%) of 30,612 classes reachable
    [creator]       44,044 (68.12%) of 64,654 fields reachable
    [creator]      130,512 (64.11%) of 203,567 methods reachable
    [creator]        1,232 classes,   473 fields, and 5,577 methods registered for reflection
    [creator]           82 classes,    76 fields, and    64 methods registered for JNI access
    [creator]            4 native libraries: dl, pthread, rt, z
    [creator]     OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000006b5380000, 1065353216, 0) failed; error='Not enough space' (errno=12)
    [creator]     #
    [creator]     # There is insufficient memory for the Java Runtime Environment to continue.
    [creator]     # Native memory allocation (mmap) failed to map 1065353216 bytes for committing reserved memory.
    [creator]     # An error report file with more information is saved as:
    [creator]     # /layers/paketo-buildpacks_native-image/native-image/hs_err_pid178.log
    [creator]     Error: Image build request failed with exit status 1
    [creator]     unable to invoke layer creator
    [creator]     unable to contribute native-image layer
</code>```

Sometimes the process is finished by code 137:

```<code>[creator]     [2/7] Performing analysis...  [**********]                     (122.4s @ 3.24GB)
    [creator]       28,561 (93.30%) of 30,612 classes reachable
    [creator]       44,044 (68.12%) of 64,654 fields reachable
    [creator]      130,512 (64.11%) of 203,565 methods reachable
    [creator]        1,232 classes,   473 fields, and 5,577 methods registered for reflection
    [creator]           82 classes,    76 fields, and    64 methods registered for JNI access
    [creator]            4 native libraries: dl, pthread, rt, z
    [creator]     Error: Image build request failed with exit status 137
</code>```

I tried to pass some limits of resources using

passing arguments to the gradle using gradle.properties:
org.gradle.jvmargs=-Xmx512m

passing argument JAVA_TOOL_OPTIONS and BPL_JVM_THREAD_COUNT to the BuildBootImage gradle tasks using the following code. In the logs the limit is logged but there is nothing in results.

```<code>    tasks.withType<org.springframework.boot.gradle.tasks.bundling.BootBuildImage> {
        if (org.apache.tools.ant.taskdefs.condition.Os.isArch("aarch64")) {
            builder.set("dashaun/java-native-builder-arm64:latest")
        } else {
            builder.set("paketobuildpacks/builder:tiny")
        }
        environment.set(
            mapOf(
                "JAVA_TOOL_OPTIONS" to "-Xmx512m",
                "BPL_JVM_THREAD_COUNT" to "50",
                "BP_NATIVE_IMAGE" to "true",
                "BP_JVM_VERSION" to "17",
                "BP_NATIVE_IMAGE_BUILD_ARGUMENTS" to "--initialize-at-run-time=io.netty.handler.ssl.BouncyCastleAlpnSslUtils"
            )
        )
        imageName.set(rootProject.name)
    }
</code>```

I am looking for any option to pass to the Docker environment or paketobuildpacks to limit used resources?

Body:
I want to build boot build image for GraalVM spring native project using AWS CodeBuild called from AWS CodePipeline, but the build process stops at missing RAM resources. I tried the default spring builder and the following one: paketobuildpacks/builder:tiny.

The specification of the machine is Linux Small - BUILD_GENERAL1_SMALL - LINUX_CONTAINER    3 GB RAM, 2 vCPUs and 64 GB of disk space. The image of the environment is aws/codebuild/standard:6.0.

At my local MacBook M1 Pro, it takes around 5.5 GB of ram (checked in Docker Desktop stats), so
I tried at the second plan of BUILD_GENERAL1_MEDIUM as well, and the process went couple lines further, but at the end it was killed as well.

The partial stack trace can be found below (must be cut due to SO spam limits):

> Task :infrastructure:bootBuildImage
Building image 'docker.io/library/experiences-service:latest'
    [creator]     [1/7] Initializing...                                           (12.1s @ 0.56GB)
    [creator]      Version info: 'GraalVM 22.3.0 Java 17 CE'
    [creator]      Java version info: '17.0.5+8-LTS'
    [creator]      C compiler: gcc (linux, x86_64, 7.5.0)
    [creator]      Garbage collector: Serial GC
    [creator]      1 user-specific feature(s)
    [creator]      - org.springframework.aot.nativex.feature.PreComputeFieldFeature
    [creator]     The bundle named: i18n.Parsing, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
    [creator]     The bundle named: i18n.Scalars, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
    [creator]     [2/7] Performing analysis...  [**********]                     (114.5s @ 2.31GB)
    [creator]       28,561 (93.30%) of 30,612 classes reachable
    [creator]       44,044 (68.12%) of 64,654 fields reachable
    [creator]      130,512 (64.11%) of 203,567 methods reachable
    [creator]        1,232 classes,   473 fields, and 5,577 methods registered for reflection
    [creator]           82 classes,    76 fields, and    64 methods registered for JNI access
    [creator]            4 native libraries: dl, pthread, rt, z
    [creator]     OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000006b5380000, 1065353216, 0) failed; error='Not enough space' (errno=12)
    [creator]     #
    [creator]     # There is insufficient memory for the Java Runtime Environment to continue.
    [creator]     # Native memory allocation (mmap) failed to map 1065353216 bytes for committing reserved memory.
    [creator]     # An error report file with more information is saved as:
    [creator]     # /layers/paketo-buildpacks_native-image/native-image/hs_err_pid178.log
    [creator]     Error: Image build request failed with exit status 1
    [creator]     unable to invoke layer creator
    [creator]     unable to contribute native-image layer

Sometimes the process is finished by code 137:

[creator]     [2/7] Performing analysis...  [**********]                     (122.4s @ 3.24GB)
    [creator]       28,561 (93.30%) of 30,612 classes reachable
    [creator]       44,044 (68.12%) of 64,654 fields reachable
    [creator]      130,512 (64.11%) of 203,565 methods reachable
    [creator]        1,232 classes,   473 fields, and 5,577 methods registered for reflection
    [creator]           82 classes,    76 fields, and    64 methods registered for JNI access
    [creator]            4 native libraries: dl, pthread, rt, z
    [creator]     Error: Image build request failed with exit status 137

I tried to pass some limits of resources using

passing arguments to the gradle using gradle.properties:
org.gradle.jvmargs=-Xmx512m

passing argument JAVA_TOOL_OPTIONS and BPL_JVM_THREAD_COUNT to the BuildBootImage gradle tasks using the following code. In the logs the limit is logged but there is nothing in results.

    tasks.withType<org.springframework.boot.gradle.tasks.bundling.BootBuildImage> {
        if (org.apache.tools.ant.taskdefs.condition.Os.isArch("aarch64")) {
            builder.set("dashaun/java-native-builder-arm64:latest")
        } else {
            builder.set("paketobuildpacks/builder:tiny")
        }
        environment.set(
            mapOf(
                "JAVA_TOOL_OPTIONS" to "-Xmx512m",
                "BPL_JVM_THREAD_COUNT" to "50",
                "BP_NATIVE_IMAGE" to "true",
                "BP_JVM_VERSION" to "17",
                "BP_NATIVE_IMAGE_BUILD_ARGUMENTS" to "--initialize-at-run-time=io.netty.handler.ssl.BouncyCastleAlpnSslUtils"
            )
        )
        imageName.set(rootProject.name)
    }

I am looking for any option to pass to the Docker environment or paketobuildpacks to limit used resources?


问:
Autolock Google Sheets cell after data is entered
I am looking to restrict a user edit a cell post updating data in it. Only the owner of the sheet should have access to update data in the cell in google sheets

eg: User1 has access to the sheet and can update data in a cell. Once user1 updates the data and come out of the cell, user1 and rest of the users who have access to the sheet shouldn't have access to edit the cell. I have the below code, but users who have updated the cell still have access to edit the data in it. Please help.

Here is the sheet - https://docs.google.com/spreadsheets/d/1f4z_7Tuy54e6T3bEoTVHwvsusrfG2t9dLX7KeO9oYX0/edit?usp=sharing

```<code>function onEdit(e){
const sh = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
if (e.range.columnStart != 4) return;
let protection = sh.getRange(e.range.rowStart,1,1,sh.getMaxColumns()).protect();
var me = Session.getEffectiveUser();
protection.addEditor(me);
protection.removeEditors(protection.getEditors());
if (protection.canDomainEdit()) {
protection.setDomainEdit(false);
 }
}
</code>```

Body:
I am looking to restrict a user edit a cell post updating data in it. Only the owner of the sheet should have access to update data in the cell in google sheets

eg: User1 has access to the sheet and can update data in a cell. Once user1 updates the data and come out of the cell, user1 and rest of the users who have access to the sheet shouldn't have access to edit the cell. I have the below code, but users who have updated the cell still have access to edit the data in it. Please help.

Here is the sheet - https://docs.google.com/spreadsheets/d/1f4z_7Tuy54e6T3bEoTVHwvsusrfG2t9dLX7KeO9oYX0/edit?usp=sharing

function onEdit(e){
const sh = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
if (e.range.columnStart != 4) return;
let protection = sh.getRange(e.range.rowStart,1,1,sh.getMaxColumns()).protect();
var me = Session.getEffectiveUser();
protection.addEditor(me);
protection.removeEditors(protection.getEditors());
if (protection.canDomainEdit()) {
protection.setDomainEdit(false);
 }
}


问:
How can you use the value of one cell to index into a column in excel?
I am trying to create several sets of graphs with numeric values on the Y-axis and time values on the x-axis. The row numbers are located in cells and I would like to use them as an index when I enter the data into the "Series values" box when making a graph.

The current equation for the X-axis (time values) is =Sheet1!$B$2944:$B$3408 and ideally it would be something like =Sheet1!$B$(value from cell):$B$(value from cell). I have tried to use the MATCH and INDEX functions in the series values box but I keep getting "function not valid". So those may not be appropriate or I might not be entering them right. I am not sure how else to go out about this problem.


问:
cannot open source file "mysql/mysql.h" VS code ubuntu
I am trying to build a messaging application by relying on a database, however I can't really get started because of this error.

I tried updating the gcc compiler, vs code, re-installing mysql shell, putting #include <mysql.h> or #include "mysql.h" but it still doesn't work. My version of ubuntu is Ubuntu 22.04.1 LTS.


问:
In Cypress, how to create a stub of inner component and invoke its update:modelValue to check if the parent component has correctly received it?
I have a complex inner component in my parent component (parent component is one of steps in a wizard, inner component displays a dynamic subform and collects inputs.
I have my inner component fully tested. It emits onUpdate:modelValue.
Now I want to test the wizard step component - the parent component.
I want to abstract that so I stub the inner component with ... well, currently a div but I am willing to substitute that with anything that will work.
My goal is to trigger the onUpdate:modelValue in the inner component to check that the parent component is in fact handing this event and triggers its own (parent component is one step in a wizard so it will bubble it up to the wizard aka. stepper to decide if the "next" button should be activated or stay disabled.

This is my helper function for binding component for cypress test:

```<code>function mountAndBind(values: any) {
    const modelValueEventSpy = cy.spy().as("modelUpdate");
    const validityEventSpy = cy.spy().as("validityUpdate");
    const internalModelValueEventSpy = cy.spy().as("internalModelUpdate");
    const internalValidityEventSpy = cy.spy().as("internalValidityUpdate");

    cy.mount(ParrentCompoenent, {
      global: {
        stubs: {
          InnerComponent: h(
            "div",
            {
              class: "internal",
              "onUpdate:modelValue": internalModelValueEventSpy
            },
            "metadata details"
          ),
        },
      },
      props: {
        "onUpdate:modelValue": modelValueEventSpy,
        modelValue: values,
      },
    });
  }
</code>```

And this is the test that fails on the last assertion:

```<code> it("shows the step, and when option chosen, shows details.", () => {
    mountAndBind({});
    cy.contains("metadata details").should("not.exist");
    // that's a custom cypress command - a helper.
    cy.selectChooseOption("parentSelectOptions", "abc");
    cy.wait("@webapirequest_for_details");
    cy.contains("metadata details").should("exist");
    cy.get(".internal").trigger("onUpdate:modelValue", { someField: "value" });
    cy.get("@modelUpdate").should("have.been.calledWith", { someField: "value" });
  });
</code>```

Body:
I have a complex inner component in my parent component (parent component is one of steps in a wizard, inner component displays a dynamic subform and collects inputs.
I have my inner component fully tested. It emits onUpdate:modelValue.
Now I want to test the wizard step component - the parent component.
I want to abstract that so I stub the inner component with ... well, currently a div but I am willing to substitute that with anything that will work.
My goal is to trigger the onUpdate:modelValue in the inner component to check that the parent component is in fact handing this event and triggers its own (parent component is one step in a wizard so it will bubble it up to the wizard aka. stepper to decide if the "next" button should be activated or stay disabled.

This is my helper function for binding component for cypress test:

function mountAndBind(values: any) {
    const modelValueEventSpy = cy.spy().as("modelUpdate");
    const validityEventSpy = cy.spy().as("validityUpdate");
    const internalModelValueEventSpy = cy.spy().as("internalModelUpdate");
    const internalValidityEventSpy = cy.spy().as("internalValidityUpdate");

    cy.mount(ParrentCompoenent, {
      global: {
        stubs: {
          InnerComponent: h(
            "div",
            {
              class: "internal",
              "onUpdate:modelValue": internalModelValueEventSpy
            },
            "metadata details"
          ),
        },
      },
      props: {
        "onUpdate:modelValue": modelValueEventSpy,
        modelValue: values,
      },
    });
  }

And this is the test that fails on the last assertion:

 it("shows the step, and when option chosen, shows details.", () => {
    mountAndBind({});
    cy.contains("metadata details").should("not.exist");
    // that's a custom cypress command - a helper.
    cy.selectChooseOption("parentSelectOptions", "abc");
    cy.wait("@webapirequest_for_details");
    cy.contains("metadata details").should("exist");
    cy.get(".internal").trigger("onUpdate:modelValue", { someField: "value" });
    cy.get("@modelUpdate").should("have.been.calledWith", { someField: "value" });
  });


问:
flutter - send data to OneDrive
I want to use OneDrive as a cloud storage to which my app should send data automatically. With below code (slightly modified example from https://pub.dev/packages/flutter_onedrive), the connection can be established but I have two questions:

how to do the connection automatically, i. e. transparent to the current user? As it is now, I have to manually log in and complete 2FA every time the app is started. Is there an access token or something similar that can be used?

what is the OneDrive directory structure? I have a file 'test.txt' in what appears to be the root folder, but nothing is downloaded.

Here's the code I've used:

```<code>import 'package:flutter/material.dart';
import 'package:flutter_onedrive/flutter_onedrive.dart';

final onedrive = OneDrive(
    redirectURL: "your redirectURL",
    clientID: "your clientID");

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  static const String _title = 'Onedrive interaction';

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: _title,
      home: Center(child: MyStatefulWidget(),
      )
    );
  }
}

class MyStatefulWidget extends StatefulWidget {
  const MyStatefulWidget({super.key});

  @override
  State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}

class _MyStatefulWidgetState extends State<MyStatefulWidget> {

  @override
  Widget build(BuildContext context) {
    return buildConnectButton(context);
  }
}

FutureBuilder buildConnectButton(BuildContext context) {
  return FutureBuilder(
    future: onedrive.isConnected(),
    builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
      if (!snapshot.hasData) {
        print('no data');
        return const Center(child: CircularProgressIndicator());
      }

      if (snapshot.data ?? false) {
        // Has connected
        print('connected');
        return const Text("Connected");

      } else {
        // Hasn't connected
        return ElevatedButton(
          child: const Text("Connect"),
          onPressed: () async {
            final success = await onedrive.connect(context);
            if (success) {
              print('accessing data');
              // Download files
              final txtBytes = await onedrive.pull("/test.txt");
              // Upload files
              print(txtBytes);
              await onedrive.push(txtBytes!, "/test2.txt");
            }
          },
        );
      }
    },
  );
}

</code>```

The whole interaction with OneDrive is pretty overwhelming and there are numerous options to set. Ideally, my app would be able to send data only to a specific folder without having to sign in every time.

Title: flutter - send data to OneDrive

Body:
I want to use OneDrive as a cloud storage to which my app should send data automatically. With below code (slightly modified example from https://pub.dev/packages/flutter_onedrive), the connection can be established but I have two questions:

how to do the connection automatically, i. e. transparent to the current user? As it is now, I have to manually log in and complete 2FA every time the app is started. Is there an access token or something similar that can be used?

what is the OneDrive directory structure? I have a file 'test.txt' in what appears to be the root folder, but nothing is downloaded.

Here's the code I've used:

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

final onedrive = OneDrive(
    redirectURL: "your redirectURL",
    clientID: "your clientID");

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  static const String _title = 'Onedrive interaction';

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: _title,
      home: Center(child: MyStatefulWidget(),
      )
    );
  }
}

class MyStatefulWidget extends StatefulWidget {
  const MyStatefulWidget({super.key});

  @override
  State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}

class _MyStatefulWidgetState extends State<MyStatefulWidget> {

  @override
  Widget build(BuildContext context) {
    return buildConnectButton(context);
  }
}

FutureBuilder buildConnectButton(BuildContext context) {
  return FutureBuilder(
    future: onedrive.isConnected(),
    builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
      if (!snapshot.hasData) {
        print('no data');
        return const Center(child: CircularProgressIndicator());
      }

      if (snapshot.data ?? false) {
        // Has connected
        print('connected');
        return const Text("Connected");

      } else {
        // Hasn't connected
        return ElevatedButton(
          child: const Text("Connect"),
          onPressed: () async {
            final success = await onedrive.connect(context);
            if (success) {
              print('accessing data');
              // Download files
              final txtBytes = await onedrive.pull("/test.txt");
              // Upload files
              print(txtBytes);
              await onedrive.push(txtBytes!, "/test2.txt");
            }
          },
        );
      }
    },
  );
}

The whole interaction with OneDrive is pretty overwhelming and there are numerous options to set. Ideally, my app would be able to send data only to a specific folder without having to sign in every time.


问:
How to force a static library at a specific memory address
I am building some applications that use a static library and I would want to force linker to put .text and .data sections of the static library (.a file) at specific addresses using GNU linker but I couldn't find a way how the linker script can be modified to force/put the libx.a at a specific address considering that this library has .text and .data sections.

Is there any way to do it?

I tried the below but linker does nothing:

```<code>    .text_libx :
    {
        . = ALIGN(4);
        KEEP(*libx.a*(.text .text.*))
     } >FLASH_libx
</code>```

where FLASH_libx is defined to a desired address.

```<code></code>```

Body:
I am building some applications that use a static library and I would want to force linker to put .text and .data sections of the static library (.a file) at specific addresses using GNU linker but I couldn't find a way how the linker script can be modified to force/put the libx.a at a specific address considering that this library has .text and .data sections.

Is there any way to do it?

I tried the below but linker does nothing:

    .text_libx :
    {
        . = ALIGN(4);
        KEEP(*libx.a*(.text .text.*))
     } >FLASH_libx

where FLASH_libx is defined to a desired address.


问:
Xamarin CollectionView.GestureRecognizers not working?
I have a collection view that I want to do something when someone clicks on it (regardless if they select an Item, or even if there are no items). Basically if the user taps anywhere in the collection view I want to run a command. But I can't seem to get it to fire. Is this simply not supported by collection view?

```<code><CollectionView x:Name="addedContactCollection" BackgroundColor="AliceBlue" ItemsSource="{Binding  RecentComments}" SelectionMode="None">
            <CollectionView.GestureRecognizers>
                <TapGestureRecognizer
                                NumberOfTapsRequired="1"
                                Command="{Binding CollectionTapped}">
                </TapGestureRecognizer>
            </CollectionView.GestureRecognizers>
</code>```

Running the exact same gesture code on any other item seems to work fine. I assume its because collection view propagates the gesture to the items.

So is the right thing to do to wrap the collection view in something? or is there a property to collection view that will make this work?

Body:
I have a collection view that I want to do something when someone clicks on it (regardless if they select an Item, or even if there are no items). Basically if the user taps anywhere in the collection view I want to run a command. But I can't seem to get it to fire. Is this simply not supported by collection view?

<CollectionView x:Name="addedContactCollection" BackgroundColor="AliceBlue" ItemsSource="{Binding  RecentComments}" SelectionMode="None">
            <CollectionView.GestureRecognizers>
                <TapGestureRecognizer
                                NumberOfTapsRequired="1"
                                Command="{Binding CollectionTapped}">
                </TapGestureRecognizer>
            </CollectionView.GestureRecognizers>

Running the exact same gesture code on any other item seems to work fine. I assume its because collection view propagates the gesture to the items.

So is the right thing to do to wrap the collection view in something? or is there a property to collection view that will make this work?


问:
How to split modules in vue.js
I am just starting with vue.js and cannot work out how to split the code into separate files. I am using Visual Studio Code, and have copied a basic 'hello world' example from vuejs.org, which works fine:

```<code><script type="module">
import { createApp, ref } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.js'

createApp({
  setup() {

    const message = ref('Hello World!')

    return {
      message
    }
  }
}).mount('#app')
</script>

<div id="app">
  <h1>{{ message }}</h1>
</div>
</code>```

but I will want to add a lot of javascript so wish to split my code into files. I have followed the example for splitting modules on vuejs.org and have tried the following html/js, but when I run the code in a browser I get an error:

[Vue warn]: Property "message" was accessed during render but is not defined on instance.   at

So what am I missing? I have found some posts mentioning this error but they all relate to much more complex scenarios than my simple 'hello world'!

```<code><script type="module">
   import { createApp, ref } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.js'
   import MySetup from './setup.js'

  createApp(MySetup).mount('#app')
</script>

<div id="app">
  <h1>{{ message }}</h1>
</div>
</code>```

and setup.js:

```<code>export default {
  setup() {
    const message = ref('Hello World!')

    return {
      message
    }
  }
}
</code>```

Title: How to split modules in vue.js

Body:
I am just starting with vue.js and cannot work out how to split the code into separate files. I am using Visual Studio Code, and have copied a basic 'hello world' example from vuejs.org, which works fine:

{{ message }}

but I will want to add a lot of javascript so wish to split my code into files. I have followed the example for splitting modules on vuejs.org and have tried the following html/js, but when I run the code in a browser I get an error:

[Vue warn]: Property "message" was accessed during render but is not defined on instance.   at

So what am I missing? I have found some posts mentioning this error but they all relate to much more complex scenarios than my simple 'hello world'!

{{ message }}

and setup.js:

export default {
  setup() {
    const message = ref('Hello World!')

    return {
      message
    }
  }
}


问:
Writing results of query in a file only works until X result
So first of all, my query has about 1700 results, and I need to write them into a .txt file.
My problem here is that no matter how I try, it only works if I limit MY QUERY to 1310 results, using 'TOP 1310' on it. Otherwise nothing is written in the file.

I have tried both fopen() and file_put_contents() on the php side of the thing, neither works.

I have tried to limit the number of results using php so i could divide the string, through a while loop. Didn't work.

I have already tried to use set_time_limit(0); and ignore_user_abort(1); so it doesn't time out, didn't work.

I have tried to give php more memory, didn't work.

Here is my php code:

```<code>$objCLC = $objLote->getCLC($codlote);
    if($objCLC){
    foreach($objCLC as $idx => $value){
        $WRITE .= $objCLC[$idx]->corpo.'
         ';
    }

if(file_put_contents('path.txt', $WRITE)){
    $_SESSION['msg'] = 1; // To show 'Success!' on screen
    echo '<script>window.location=window.location.href;</script>';
    exit ();
}else{
    $_SESSION['msg'] = 2; // To show 'Error!' on screen
    echo '<script>window.location=window.location.href;</script>';
    exit ();
    }

</code>```

Here is the query code, important to notice that the query does work as expected by itself:

```<code>public function getCLC($codlote){

  $query = "SELECT SOMETHING FROM SOMETHING";
  $res = $this->execConsult($query);
  if($res && is_array($res)){
    $count = 0;
    foreach($res as $idx => $value){
        $dados[$count] = new ltCLC();
        $dados[$count]->corpo = $res[$idx]['CORPO'];
        $count++;
    }
    return $dados;
}
return false;
}

</code>```
```<code>class ltCLC {
    public $corpo = false;
}
</code>```

Any variable inconsistencies are because i tried to substitute them for the post.

How can I make so that every result is written into the file? I still think php couldn't handle it, but i'm not sure.

Body:
So first of all, my query has about 1700 results, and I need to write them into a .txt file.
My problem here is that no matter how I try, it only works if I limit MY QUERY to 1310 results, using 'TOP 1310' on it. Otherwise nothing is written in the file.

I have tried both fopen() and file_put_contents() on the php side of the thing, neither works.

I have tried to limit the number of results using php so i could divide the string, through a while loop. Didn't work.

I have already tried to use set_time_limit(0); and ignore_user_abort(1); so it doesn't time out, didn't work.

I have tried to give php more memory, didn't work.

Here is my php code:

$objCLC = $objLote->getCLC($codlote);
    if($objCLC){
    foreach($objCLC as $idx => $value){
        $WRITE .= $objCLC[$idx]->corpo.'
         ';
    }

if(file_put_contents('path.txt', $WRITE)){
    $_SESSION['msg'] = 1; // To show 'Success!' on screen
    echo '';
    exit ();
}else{
    $_SESSION['msg'] = 2; // To show 'Error!' on screen
    echo '';
    exit ();
    }

Here is the query code, important to notice that the query does work as expected by itself:

public function getCLC($codlote){

  $query = "SELECT SOMETHING FROM SOMETHING";
  $res = $this->execConsult($query);
  if($res && is_array($res)){
    $count = 0;
    foreach($res as $idx => $value){
        $dados[$count] = new ltCLC();
        $dados[$count]->corpo = $res[$idx]['CORPO'];
        $count++;
    }
    return $dados;
}
return false;
}

class ltCLC {
    public $corpo = false;
}

Any variable inconsistencies are because i tried to substitute them for the post.

How can I make so that every result is written into the file? I still think php couldn't handle it, but i'm not sure.


问:
Does the Web Speech API in Chrome (and Edge) use an offsite server for STT?
Recently I found the Web Speech API as well as a simple HTML/JS speech-to-text example from Google.

I started playing with the API and made changes to the JS and HTML in the example above to see how it performed.  There does not appear to be any network behavior in the debugging console, however, since speech-to-text is a native API, I wonder if the browser itself makes any off-site request to a third-party server for the purpose of converting speech to text, or if it truly is built into the browser directly and would function in a completely offline environment.

Question: Is the web speech API completely private such that all voice-to-text conversion happens on a local machine, or does it make remote requests?

(I realize that this is, perhaps, only tangentially related to programming in JS/HTML... so if it is OT then please point me to where on SE that this question should be asked so I can close and move it.)


问:
APCu, composer, Symfony
I have the following Server configuration (this is the Web Version):

```<code>System  Linux dd19338 5.15.0-52-generic #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022 x86_64
Build Date  Nov 28 2022 09:57:52
Build System    Linux
Server API  FPM/FastCGI
Virtual Directory Support   disabled
Configuration File (php.ini) Path   /etc/php81/fpm
Loaded Configuration File   /etc/php81/fpm/php.ini
Scan this dir for additional .ini files     /etc/php81/cgi/conf.d

This program makes use of the Zend Scripting Language Engine:
Zend Engine v4.1.13, Copyright (c) Zend Technologies
with Zend OPcache v8.1.13, Copyright (c), by Zend Technologies
</code>```

This is the CLI version:

```<code>PHP 8.1.13 (cli) (built: Nov 28 2022 09:57:52) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.13, Copyright (c), by Zend Technologies
</code>```

This is how I deploy my Symfony 6.2 project after uploading the files to the server:

```<code>composer install --no-dev --optimize-autoloader --apcu-autoloader
composer dump-autoload --no-dev --optimize --apcu
APP_ENV=prod APP_DEBUG=0 php bin/console cache:clear
</code>```

This is my cache.yaml:

```<code>framework:
    cache:
        app: cache.adapter.apcu
</code>```

Problem: For some hours everything runs fine. But then I'm getting 403 - Forbidden error (user is correctly correctly authenticated). When I run the deployment again (which clears the cache), everything runs again without any other changes for some hours.

Can I run the composer commands with apcu optimization on a server running FPM/FastCGI, where the APCu cache is not shared?

Any other ideas where I can start looking for the source of the problem?

Thank you and best Regards

Dimitri

Title: APCu, composer, Symfony

Body:
I have the following Server configuration (this is the Web Version):

System  Linux dd19338 5.15.0-52-generic #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022 x86_64
Build Date  Nov 28 2022 09:57:52
Build System    Linux
Server API  FPM/FastCGI
Virtual Directory Support   disabled
Configuration File (php.ini) Path   /etc/php81/fpm
Loaded Configuration File   /etc/php81/fpm/php.ini
Scan this dir for additional .ini files     /etc/php81/cgi/conf.d

This program makes use of the Zend Scripting Language Engine:
Zend Engine v4.1.13, Copyright (c) Zend Technologies
with Zend OPcache v8.1.13, Copyright (c), by Zend Technologies

This is the CLI version:

PHP 8.1.13 (cli) (built: Nov 28 2022 09:57:52) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.13, Copyright (c), by Zend Technologies

This is how I deploy my Symfony 6.2 project after uploading the files to the server:

composer install --no-dev --optimize-autoloader --apcu-autoloader
composer dump-autoload --no-dev --optimize --apcu
APP_ENV=prod APP_DEBUG=0 php bin/console cache:clear

This is my cache.yaml:

framework:
    cache:
        app: cache.adapter.apcu

Problem: For some hours everything runs fine. But then I'm getting 403 - Forbidden error (user is correctly correctly authenticated). When I run the deployment again (which clears the cache), everything runs again without any other changes for some hours.

Can I run the composer commands with apcu optimization on a server running FPM/FastCGI, where the APCu cache is not shared?

Any other ideas where I can start looking for the source of the problem?

Thank you and best Regards

Dimitri


问:
How do I make a file download link with node.js and html?
my current code, which is just a basic node.js server and html  tag, and this does download the file. But if I open the file in notepad, I can see that it actually just downloaded the html code for my site, and named it whatever the intended file was

Here is the HTML download code:

```<code><a download href="./examplefile.txt" target="_blank">example</a>
</code>```

and here is the node.js server code:

```<code>const fs = require('fs');
const http = require('http');
const port = 25565

const server = http.createServer(function(req, res) {
    res.writeHead(200, { 'Content-Type': 'text/html' })
    fs.readFile("index.html", function(error, data) {
        if (error) {
            res.writeHead(404, { "Content-type": "text/html" })
            res.write('<h1>file not found - 404<h1>')
            console.log(error)
        } else {
            res.write(data)
            console.log('activity has happened')
        }
        res.end()
    })
})

server.listen(port, function(error) {
    if (error) {
        console.log('something happend bad', error);
    } else {
        console.log('server working on port ' + port)
    }
})
</code>```

Body:
my current code, which is just a basic node.js server and html  tag, and this does download the file. But if I open the file in notepad, I can see that it actually just downloaded the html code for my site, and named it whatever the intended file was

Here is the HTML download code:

example

and here is the node.js server code:

const fs = require('fs');
const http = require('http');
const port = 25565

const server = http.createServer(function(req, res) {
    res.writeHead(200, { 'Content-Type': 'text/html' })
    fs.readFile("index.html", function(error, data) {
        if (error) {
            res.writeHead(404, { "Content-type": "text/html" })
            res.write('
file not found - 404
')
            console.log(error)
        } else {
            res.write(data)
            console.log('activity has happened')
        }
        res.end()
    })
})

server.listen(port, function(error) {
    if (error) {
        console.log('something happend bad', error);
    } else {
        console.log('server working on port ' + port)
    }
})


问:
react-map-gl - adding a radius circle to the canvas
I am trying to add a radius circle using Layer to MapboxGL using React, however, I can't figure out how to have it fit to the bounds of the canvas. In other words, I need to add a static layer inside of the canvas that keeps the same dimensions when the zoom level changes.

```<code>let Obj = {
  "circle-radius": {
    stops: [
      [0, 0],
      [10, 220]
    ],
    base: 2
  },
  "circle-color": "rgba(29,161,242,.2)",
  "circle-stroke-color": "rgba(29,161,242,.2)",
  "circle-opacity": 1,
  "circle-stroke-opacity": 1,
  "circle-stroke-width": 1
};
<Layer
  type="circle"
  id="circle"
  paint={Obj}
  coordinates={[location.lng, location.lat]}
>
  <Feature coordinates={[location.lng, location.lat]} />
</Layer>;
</code>```

Imagine this is our radius circle, if I were to zoom out 100km, the circle will still be this size even though the map distance has changed and the map area is larger:

Body:
I am trying to add a radius circle using Layer to MapboxGL using React, however, I can't figure out how to have it fit to the bounds of the canvas. In other words, I need to add a static layer inside of the canvas that keeps the same dimensions when the zoom level changes.

let Obj = {
  "circle-radius": {
    stops: [
      [0, 0],
      [10, 220]
    ],
    base: 2
  },
  "circle-color": "rgba(29,161,242,.2)",
  "circle-stroke-color": "rgba(29,161,242,.2)",
  "circle-opacity": 1,
  "circle-stroke-opacity": 1,
  "circle-stroke-width": 1
};
<Layer
  type="circle"
  id="circle"
  paint={Obj}
  coordinates={[location.lng, location.lat]}
>
  <Feature coordinates={[location.lng, location.lat]} />
</Layer>;

Imagine this is our radius circle, if I were to zoom out 100km, the circle will still be this size even though the map distance has changed and the map area is larger:


问:
How to switch between SFML-drawing and OpenGL-drawing in C++ program?
I want to switch between drawing with SFML graphics module and drawing with OpenGL(glfw3 + glad + SFML/OpenGL.hpp), where switching is based on elapsed time. I tried to do it like this:

main_loop:

```<code>#include "glfw3.h"
#include"glad.h"
#include<SFML/Graphics.hpp>
#include<SFML/OpenGL.hpp>

...

window->setActive(true);

if (elapsed_seconds % 2 == 0)
    draw_OpenGL(window); // window is sf::RenderWindow*
else
    draw_SFML(window);

</code>```

draw_OpenGL:

```<code>void draw_OpenGL(..., sf::RenderWindow* window){

    ... // glUniform and other stuff

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glUseProgram(shader);
    glBindTextureUnit(0, texture);
    glBindVertexArray(VAO);
    glDrawArrays(GL_TRIANGLES, 0, vertexCount);

    window->display();
}
</code>```

draw_SFML:

```<code>void draw_SFML(sf::RenderWindow* window){

    ... // Defining 'shape'

    window->pushGLStates();

    window->clear(sf::Color::Black);
    window->draw(shape);

    window->popGLStates();

    window->display();
}
</code>```

I followed official guide, but didn't succeed - while OpenGl draws fine, instead of SFML-made picture it draws nothing and just swaps buffers. I think my problem is in popGLStates/pushGLStates lines, because both draw_OpeGL and draw_SFML work as expected if I'm not switching between them. I also looked at some exemples of SFML+OpenGl code, but as far as I saw, they were using popGLStates/pushGLStates the same way. Do someone know how can I fix this problem?

Body:
I want to switch between drawing with SFML graphics module and drawing with OpenGL(glfw3 + glad + SFML/OpenGL.hpp), where switching is based on elapsed time. I tried to do it like this:

main_loop:

#include "glfw3.h"
#include"glad.h"
#include<SFML/Graphics.hpp>
#include<SFML/OpenGL.hpp>

...

window->setActive(true);

if (elapsed_seconds % 2 == 0)
    draw_OpenGL(window); // window is sf::RenderWindow*
else
    draw_SFML(window);

draw_OpenGL:

void draw_OpenGL(..., sf::RenderWindow* window){

    ... // glUniform and other stuff

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glUseProgram(shader);
    glBindTextureUnit(0, texture);
    glBindVertexArray(VAO);
    glDrawArrays(GL_TRIANGLES, 0, vertexCount);

    window->display();
}

draw_SFML:

void draw_SFML(sf::RenderWindow* window){

    ... // Defining 'shape'

    window->pushGLStates();

    window->clear(sf::Color::Black);
    window->draw(shape);

    window->popGLStates();

    window->display();
}

I followed official guide, but didn't succeed - while OpenGl draws fine, instead of SFML-made picture it draws nothing and just swaps buffers. I think my problem is in popGLStates/pushGLStates lines, because both draw_OpeGL and draw_SFML work as expected if I'm not switching between them. I also looked at some exemples of SFML+OpenGl code, but as far as I saw, they were using popGLStates/pushGLStates the same way. Do someone know how can I fix this problem?


问:
openpyxl format cell decimal precision
I have a data frame that I exported to excel.  I'm looking for Python method to change the formatting for a column to maintain the float integrity of 6 decimal place precision.

ie..

11.123456 is being displayed as 11.12 in excel.

I know how to change the formatting in excel but am trying to include this in my python code.

I have imported the openpylx library and the BUILTIN_FORMATS does not have a preset.  I cannot find a way to manually build the format to 6 decimal places.

Title: openpyxl format cell decimal precision


问:
How do I display folders under public_html in a browser in a deployed react app?
For a simple html-css webpage I could access a folder of music files under the public_html and display those music files in a browser. But now I have used a React App with create-react-app. How do I access a folder I have put on a server under public_html like so  public_html/songs/? Current behavior when I try to hit an endpoint like
mysite.com/songs in a browser, it just displays React App home page regardless of the URL address, which in essence is mysite.com


问:
Python: cannot import librosa library --> OSError: cannot load library 'libsndfile.so' :
I am running my python code on the cloud using paperspace gradient.  My code utilizes the librosa library.  It was all working fine just a couple weeks ago meaning the entire codebase runs without error.

But today it seems like there's something wrong with librosa.  When I try to do "import librosa" I get the following error:

OSError: cannot load library 'libsndfile.so': libsndfile.so: cannot open shared object file: No such file or directory

I don't know what this means or how to rectify it.  I have tried updating both my pip and my wheel.  I have also tried pip installing soundfile as well.  But the error remains.


问:
Trouble installing Python 3.7.3 via pyenv on macOS 13.0.1 with Rosetta
I have an iTerm instance configured to run with Rosetta, using homebrew (x86 version) and pyenv (x86 version) but when I try to run pyenv86 install 3.7.3 I still get the following:

```<code>BUILD FAILED (OS X 13.0.1 using python-build 20180424)
</code>```

More specifically in the logs:

```<code>checking for clang++... no
configure:

  By default, distutils will build C++ extension modules with "clang++".
  If this is not intended, then set CXX on the configure command line.

checking for the platform triplet based on compiler characteristics... darwin
configure: error: internal configure error for the platform triplet, please file a bug report
make: *** No targets specified and no makefile found.  Stop.
</code>```

I have the following setup:

```<code>$ arch
i386
</code>```
```<code>$ which brew86
brew86: aliased to arch --x86_64 /usr/local/Homebrew/bin/brew
</code>```
```<code>$ which pyenv86
pyenv86: aliased to arch -x86_64 pyenv
</code>```
```<code>$ echo $PATH
/opt/homebrew/bin:/Users/abhinavmulagada/.pyenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
</code>```

This is what my ~/.zshrc looks like:

```<code># rosetta setup
if [ $(arch) = "i386" ]; then
        alias brew86='arch --x86_64 /usr/local/Homebrew/bin/brew'
        alias pyenv86="arch -x86_64 pyenv"
fi

# pyenv
if command -v pyenv 1>/dev/null 2>&1; then
    eval "$(pyenv init -)"
fi

path=('/opt/homebrew/bin' $path)
export PATH
</code>```

Any advice would be greatly appreciated, been stuck on this for a while.

Thanks!

Body:
I have an iTerm instance configured to run with Rosetta, using homebrew (x86 version) and pyenv (x86 version) but when I try to run pyenv86 install 3.7.3 I still get the following:

BUILD FAILED (OS X 13.0.1 using python-build 20180424)

More specifically in the logs:

checking for clang++... no
configure:

  By default, distutils will build C++ extension modules with "clang++".
  If this is not intended, then set CXX on the configure command line.

checking for the platform triplet based on compiler characteristics... darwin
configure: error: internal configure error for the platform triplet, please file a bug report
make: *** No targets specified and no makefile found.  Stop.

I have the following setup:

$ arch
i386

$ which brew86
brew86: aliased to arch --x86_64 /usr/local/Homebrew/bin/brew

$ which pyenv86
pyenv86: aliased to arch -x86_64 pyenv

$ echo $PATH
/opt/homebrew/bin:/Users/abhinavmulagada/.pyenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin

This is what my ~/.zshrc looks like:

# rosetta setup
if [ $(arch) = "i386" ]; then
        alias brew86='arch --x86_64 /usr/local/Homebrew/bin/brew'
        alias pyenv86="arch -x86_64 pyenv"
fi

# pyenv
if command -v pyenv 1>/dev/null 2>&1; then
    eval "$(pyenv init -)"
fi

path=('/opt/homebrew/bin' $path)
export PATH

Any advice would be greatly appreciated, been stuck on this for a while.

Thanks!


问:
How to rotate around a point towards the position of the mouse
I have a top down game and need to create a shield with physics. The problem is, I'm using the transform component to move and rotate the shield around the player, and I need to use Rigidbody2D.

I need to make the shield do two things:

Orbit around the player

Apply force to move the shield to the point on the orbit closest to the mouse cursor.

Increase force depending on how far away the object is from the desired location.

I simplified as much as I could, please don't mark as too complicated. I'll elaborate if needed. I don't know how to do this, and could really use some help.
Thanks!

ALSO, if someone asks, "shield position" in the code is just a crosshair that already orbits the player using the transform component. I just told the shield to copy its position and rotation. But that won't work because I need physics.

```<code>using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Shield : MonoBehaviour
{

    public Transform ShieldPosition;
    private Transform tf;

    // Start is called before the first frame update
    void Start()
    {
        tf = transform;
    }

    // Update is called once per frame
    void Update()
    {
            tf.position = ShieldPosition.position;
            tf.rotation = ShieldPosition.rotation;
    }
}
</code>```

Body:
I have a top down game and need to create a shield with physics. The problem is, I'm using the transform component to move and rotate the shield around the player, and I need to use Rigidbody2D.

I need to make the shield do two things:

Orbit around the player

Apply force to move the shield to the point on the orbit closest to the mouse cursor.

Increase force depending on how far away the object is from the desired location.

I simplified as much as I could, please don't mark as too complicated. I'll elaborate if needed. I don't know how to do this, and could really use some help.
Thanks!

ALSO, if someone asks, "shield position" in the code is just a crosshair that already orbits the player using the transform component. I just told the shield to copy its position and rotation. But that won't work because I need physics.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Shield : MonoBehaviour
{

    public Transform ShieldPosition;
    private Transform tf;

    // Start is called before the first frame update
    void Start()
    {
        tf = transform;
    }

    // Update is called once per frame
    void Update()
    {
            tf.position = ShieldPosition.position;
            tf.rotation = ShieldPosition.rotation;
    }
}


问:
TFLite On-device saving signature function crashes
I'm attempting to learn how to implement on-device training for a school project, however I've stumbled on a roadblock. The signature function for saving crashes the app, the other signature functions like train and infer work just fine. The guide I'm using is this.

Basically, I'm trying to personalize the model by training, then saving the model but whenever I attempt to save the model, the app crashes on launch. Any guides on how to save a model in Android after training on device?

Edit: I hope adding the code helps clear some confusion.

-------Code used to save the model------

```<code>SAVED_MODEL_DIR = "saved_model"

tf.saved_model.save(
    m,
    SAVED_MODEL_DIR,
    signatures={
        'train':
            m.train.get_concrete_function(),
        'infer':
            m.infer.get_concrete_function(),
        'save':
            m.save.get_concrete_function(),
        'restore':
            m.restore.get_concrete_function(),
    })

converter = tf.lite.TFLiteConverter.from_saved_model(SAVED_MODEL_DIR)
converter.target_spec.supported_ops = [
    tf.lite.OpsSet.TFLITE_BUILTINS,
    tf.lite.OpsSet.SELECT_TF_OPS
]

converter.experimental_enable_resource_variables = True
tflite_model = converter.convert()
with open('model.tflite', 'wb') as f:
  f.write(tflite_model)
</code>```

-------Code to save Model in Android (Kotlin)------

```<code>class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        Interpreter(modelPath()).use { interpreter ->
            val outputFile = File(filesDir, "model.tflite")
            val inputs: MutableMap<String, Any> = HashMap()
            inputs["checkpoint_path"] = outputFile.absolutePath
            val outputs: Map<String, Any> = HashMap()
            interpreter.runSignature(inputs, outputs, "save")
        }
    }

    private fun modelPath(): File {
        val file = File(this.filesDir, "model.tflite")
        if (file.exists() && file.length() > 0) {
            return file
        }
        this.applicationContext.assets.open("model.tflite").use { f ->
            FileOutputStream(file).use { os ->
                val buffer = ByteArray(4 * 1024)
                var read: Int
                while (f.read(buffer).also { read = it } != -1) {
                    os.write(buffer, 0, read)
                }
                os.flush()
            }
            return file
        }
    }
}
</code>```

-------Model Code------
It's the same model from the TFLite on device training guide.

```<code>class Model(tf.Module):

  def __init__(self):
    self.model = tf.keras.Sequential([
        tf.keras.layers.Flatten(input_shape=(IMG_SIZE, IMG_SIZE), name='flatten'),
        tf.keras.layers.Dense(128, activation='relu', name='dense_1'),
        tf.keras.layers.Dense(10, name='dense_2')
    ])

    self.model.compile(
        optimizer='sgd',
        loss=tf.keras.losses.CategoricalCrossentropy(from_logits=True))

  # The `train` function takes a batch of input images and labels.
  @tf.function(input_signature=[
      tf.TensorSpec([None, IMG_SIZE, IMG_SIZE], tf.float32),
      tf.TensorSpec([None, 10], tf.float32),
  ])
  def train(self, x, y):
    with tf.GradientTape() as tape:
      prediction = self.model(x)
      loss = self.model.loss(y, prediction)
    gradients = tape.gradient(loss, self.model.trainable_variables)
    self.model.optimizer.apply_gradients(
        zip(gradients, self.model.trainable_variables))
    result = {"loss": loss}
    return result

  @tf.function(input_signature=[
      tf.TensorSpec([None, IMG_SIZE, IMG_SIZE], tf.float32),
  ])
  def infer(self, x):
    logits = self.model(x)
    probabilities = tf.nn.softmax(logits, axis=-1)
    return {
        "output": probabilities,
        "logits": logits
    }

  @tf.function(input_signature=[tf.TensorSpec(shape=[], dtype=tf.string)])
  def save(self, checkpoint_path):
    tensor_names = [weight.name for weight in self.model.weights]
    tensors_to_save = [weight.read_value() for weight in self.model.weights]
    tf.raw_ops.Save(
        filename=checkpoint_path, tensor_names=tensor_names,
        data=tensors_to_save, name='save')
    return {
        "checkpoint_path": checkpoint_path
    }

  @tf.function(input_signature=[tf.TensorSpec(shape=[], dtype=tf.string)])
  def restore(self, checkpoint_path):
    restored_tensors = {}
    for var in self.model.weights:
      restored = tf.raw_ops.Restore(
          file_pattern=checkpoint_path, tensor_name=var.name, dt=var.dtype,
          name='restore')
      var.assign(restored)
      restored_tensors[var.name] = restored
    return restored_tensors
</code>```

This is the output after running the app, however there isn't much to see because the app crashes instantly

Body:
I'm attempting to learn how to implement on-device training for a school project, however I've stumbled on a roadblock. The signature function for saving crashes the app, the other signature functions like train and infer work just fine. The guide I'm using is this.

Basically, I'm trying to personalize the model by training, then saving the model but whenever I attempt to save the model, the app crashes on launch. Any guides on how to save a model in Android after training on device?

Edit: I hope adding the code helps clear some confusion.

-------Code used to save the model------

SAVED_MODEL_DIR = "saved_model"

tf.saved_model.save(
    m,
    SAVED_MODEL_DIR,
    signatures={
        'train':
            m.train.get_concrete_function(),
        'infer':
            m.infer.get_concrete_function(),
        'save':
            m.save.get_concrete_function(),
        'restore':
            m.restore.get_concrete_function(),
    })

converter = tf.lite.TFLiteConverter.from_saved_model(SAVED_MODEL_DIR)
converter.target_spec.supported_ops = [
    tf.lite.OpsSet.TFLITE_BUILTINS,
    tf.lite.OpsSet.SELECT_TF_OPS
]

converter.experimental_enable_resource_variables = True
tflite_model = converter.convert()
with open('model.tflite', 'wb') as f:
  f.write(tflite_model)

-------Code to save Model in Android (Kotlin)------

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        Interpreter(modelPath()).use { interpreter ->
            val outputFile = File(filesDir, "model.tflite")
            val inputs: MutableMap<String, Any> = HashMap()
            inputs["checkpoint_path"] = outputFile.absolutePath
            val outputs: Map<String, Any> = HashMap()
            interpreter.runSignature(inputs, outputs, "save")
        }
    }

    private fun modelPath(): File {
        val file = File(this.filesDir, "model.tflite")
        if (file.exists() && file.length() > 0) {
            return file
        }
        this.applicationContext.assets.open("model.tflite").use { f ->
            FileOutputStream(file).use { os ->
                val buffer = ByteArray(4 * 1024)
                var read: Int
                while (f.read(buffer).also { read = it } != -1) {
                    os.write(buffer, 0, read)
                }
                os.flush()
            }
            return file
        }
    }
}

-------Model Code------
It's the same model from the TFLite on device training guide.

class Model(tf.Module):

  def __init__(self):
    self.model = tf.keras.Sequential([
        tf.keras.layers.Flatten(input_shape=(IMG_SIZE, IMG_SIZE), name='flatten'),
        tf.keras.layers.Dense(128, activation='relu', name='dense_1'),
        tf.keras.layers.Dense(10, name='dense_2')
    ])

    self.model.compile(
        optimizer='sgd',
        loss=tf.keras.losses.CategoricalCrossentropy(from_logits=True))

  # The `train` function takes a batch of input images and labels.
  @tf.function(input_signature=[
      tf.TensorSpec([None, IMG_SIZE, IMG_SIZE], tf.float32),
      tf.TensorSpec([None, 10], tf.float32),
  ])
  def train(self, x, y):
    with tf.GradientTape() as tape:
      prediction = self.model(x)
      loss = self.model.loss(y, prediction)
    gradients = tape.gradient(loss, self.model.trainable_variables)
    self.model.optimizer.apply_gradients(
        zip(gradients, self.model.trainable_variables))
    result = {"loss": loss}
    return result

  @tf.function(input_signature=[
      tf.TensorSpec([None, IMG_SIZE, IMG_SIZE], tf.float32),
  ])
  def infer(self, x):
    logits = self.model(x)
    probabilities = tf.nn.softmax(logits, axis=-1)
    return {
        "output": probabilities,
        "logits": logits
    }

  @tf.function(input_signature=[tf.TensorSpec(shape=[], dtype=tf.string)])
  def save(self, checkpoint_path):
    tensor_names = [weight.name for weight in self.model.weights]
    tensors_to_save = [weight.read_value() for weight in self.model.weights]
    tf.raw_ops.Save(
        filename=checkpoint_path, tensor_names=tensor_names,
        data=tensors_to_save, name='save')
    return {
        "checkpoint_path": checkpoint_path
    }

  @tf.function(input_signature=[tf.TensorSpec(shape=[], dtype=tf.string)])
  def restore(self, checkpoint_path):
    restored_tensors = {}
    for var in self.model.weights:
      restored = tf.raw_ops.Restore(
          file_pattern=checkpoint_path, tensor_name=var.name, dt=var.dtype,
          name='restore')
      var.assign(restored)
      restored_tensors[var.name] = restored
    return restored_tensors

This is the output after running the app, however there isn't much to see because the app crashes instantly


问:
Cannot type dash (-) on visual studio code?
I cannot type this character (-) on visual studio code. I get a pop-up every time saying "Cannot read properties of undefined (reading 'comments')". I just started a new project and haven't written any code as of yet.

So I don't get why I cannot write a dash/hyphen when it always has worked until know. Let me know if you have a solution to this problem.

Here is my settings.json in vs code.

```<code>{
"tabnine.experimentalAutoImports": true,
"security.workspace.trust.untrustedFiles": "open",
"explorer.confirmDelete": false,
"settingsSync.ignoredSettings": [

]
</code>```

}

Body:
I cannot type this character (-) on visual studio code. I get a pop-up every time saying "Cannot read properties of undefined (reading 'comments')". I just started a new project and haven't written any code as of yet.

So I don't get why I cannot write a dash/hyphen when it always has worked until know. Let me know if you have a solution to this problem.

Here is my settings.json in vs code.

{
"tabnine.experimentalAutoImports": true,
"security.workspace.trust.untrustedFiles": "open",
"explorer.confirmDelete": false,
"settingsSync.ignoredSettings": [

]

}


问:
Expected 1 arguments, but got 0, LocalStorage
I'm stuck with local Storage 2days

I have no idea how to solve this problems,

I tried save input values to local Storage, but it's something very wrong going..

I thought this is very simple resolve, but not to me

atom.tsx

```<code>import { atom, selector } from "recoil";
import { getLocalStorage } from "./util/localstorage";

export interface ITodo {
  id: number;
  text: string;
}

export interface IToDoState {
  [key: string]: ITodo[];
}

export const toDoState = atom<IToDoState>({
  key: "toDos",
  default: getLocalStorage() ?? {
    "To Do": [],
    Doing: [],
    Done: [],
  },
});
</code>```

localStorage.tsx

```<code>import { IToDoState, toDoState } from "../atoms";

export const setLocalStorage = (toDos: IToDoState) => {
  return localStorage.setItem("toDos", JSON.stringify({ toDos }));
};

export const getLocalStorage = (toDos: string) => {
  const localToDos = localStorage.getItem(toDos);
  if (localToDos) {
    return JSON.parse(localToDos);
  }
};
</code>```

Board.tsx

```<code>function Board({ toDos, boardId }: IBoardProps) {
  const setToDos = useSetRecoilState(toDoState);
  const { register, setValue, handleSubmit } = useForm<IForm>();
  const onValid = ({ toDo }: IForm) => {
    const newToDo = {
      id: Date.now(),
      text: toDo,
    };

    setToDos((allBoards) => {
      console.log(allBoards);
      return {
        ...allBoards,
        [boardId]: [...allBoards[boardId], newToDo],
      };
    });

    setValue("toDo", "");
  };
  useEffect(() => {
    setLocalStorage({ toDos });
  }, [{ ...setToDos }]);
</code>```

Body:
I'm stuck with local Storage 2days

I have no idea how to solve this problems,

I tried save input values to local Storage, but it's something very wrong going..

I thought this is very simple resolve, but not to me

atom.tsx

import { atom, selector } from "recoil";
import { getLocalStorage } from "./util/localstorage";

export interface ITodo {
  id: number;
  text: string;
}

export interface IToDoState {
  [key: string]: ITodo[];
}

export const toDoState = atom<IToDoState>({
  key: "toDos",
  default: getLocalStorage() ?? {
    "To Do": [],
    Doing: [],
    Done: [],
  },
});

localStorage.tsx

import { IToDoState, toDoState } from "../atoms";

export const setLocalStorage = (toDos: IToDoState) => {
  return localStorage.setItem("toDos", JSON.stringify({ toDos }));
};

export const getLocalStorage = (toDos: string) => {
  const localToDos = localStorage.getItem(toDos);
  if (localToDos) {
    return JSON.parse(localToDos);
  }
};

Board.tsx

function Board({ toDos, boardId }: IBoardProps) {
  const setToDos = useSetRecoilState(toDoState);
  const { register, setValue, handleSubmit } = useForm<IForm>();
  const onValid = ({ toDo }: IForm) => {
    const newToDo = {
      id: Date.now(),
      text: toDo,
    };

    setToDos((allBoards) => {
      console.log(allBoards);
      return {
        ...allBoards,
        [boardId]: [...allBoards[boardId], newToDo],
      };
    });

    setValue("toDo", "");
  };
  useEffect(() => {
    setLocalStorage({ toDos });
  }, [{ ...setToDos }]);