问:
How to get child model having one to one relation with default User model of Django?
I created a model having one-to-one relation with default User model to extend it for providing some permission for tabs in my website. Now I want to not show the tab options to the users not having permissions to access them.

user permission model:

from django.contrib.auth.models import User

class userpermissions(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE, primary_key=True)
```
<p>Checking whether the user has permission or not I created a function which is supposed to get the <code>userpermission</code> model instance of the logged in user. For which I used the following code:</p>
<pre class="lang-py prettyprint-override"><code>def check(user):
    up = User.userpermissions_set.get(id=user.id)
</code>```

Now when user logs in the login function will call this check function and redirect to the tab that the user can access and also send the up variable containing all the permissions of the user so that the Navbar template can hide those tabs which the user has no access to.

Now the problem that I am facing is when I run the server it shows this error:

AttributeError at /
type object 'User' has no attribute 'userpermissions_set'

I saw on YouTube that to get the instance of child model (I don't know what to call it) we need to use it's name all in small case with _set (e.g. parent.child_set.all())

As per the error on browser it seems the wrong way to get the child model data (again - I don't know what to call it).

I was expecting to get all child model data but it did not work.

Body:
I created a model having one-to-one relation with default User model to extend it for providing some permission for tabs in my website. Now I want to not show the tab options to the users not having permissions to access them.

user permission model:

from django.contrib.auth.models import User

class userpermissions(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE, primary_key=True)

Checking whether the user has permission or not I created a function which is supposed to get the userpermission model instance of the logged in user. For which I used the following code:

def check(user):
    up = User.userpermissions_set.get(id=user.id)

Now when user logs in the login function will call this check function and redirect to the tab that the user can access and also send the up variable containing all the permissions of the user so that the Navbar template can hide those tabs which the user has no access to.

Now the problem that I am facing is when I run the server it shows this error:

AttributeError at /
type object 'User' has no attribute 'userpermissions_set'

I saw on YouTube that to get the instance of child model (I don't know what to call it) we need to use it's name all in small case with _set (e.g. parent.child_set.all())

As per the error on browser it seems the wrong way to get the child model data (again - I don't know what to call it).

I was expecting to get all child model data but it did not work.


来源: stackexchange

问:
Turbo stream renders as plain text when user visits different page in the mean time
Our app makes API calls that tend to take a few seconds. The results come back in various turbo frames that are updated using turbo streams from the controllers. When the user accesses a page that fires off an API call in the controller, and then navigates to a different page while the API call is ongoing, the resulting turbo stream renders as plain text

```<code>
    def data
      response = read_lan_status_response('LanStatus', 2, lan_status_params)
      stream = response.success? ? '' : turbo_flash_message(type: :danger, message: response.message)
      stream = (stream || '') + turbo_stream.update(
        'lan_status',
        partial: 'ip/dashboard/lan_status',
        locals: { data: response.result[:body] }
      )
      render turbo_stream: stream

</code>```

The above controller action involves an API call that typically takes a few seconds, the result is displayed in a lan_status partial that is used to update a lan_status turbo frame on the page that fired triggered the controller action, in this case the dashboard page:

```<code>              = turbo_frame_tag 'lan_status'
                = render 'lan_status'
</code>```

When the user navigates to a different page in the app while the controller action is ongoing, the request will still come back and render as a string that looks like a turbo stream:

```<code><turbo-stream action="update" target="lan_status"><template> ... </template></turbo-stream>
</code>```

I want it to simply ignore these turbo streams if the user has navigated to a different page. I have tried creating hidden turbo frames with the same target names on the other pages to "catch" the incoming streams but this didn't work (and in any case, the problem still seems to happen if the user navigates to a different page, and then back to the original page, so the issue is not the presence or absence of the turbo frame target, I think). Is there an obvious solution to this that I'm not seeing?

ContentLicense: CC BY-SA 4.0

Body:
Our app makes API calls that tend to take a few seconds. The results come back in various turbo frames that are updated using turbo streams from the controllers. When the user accesses a page that fires off an API call in the controller, and then navigates to a different page while the API call is ongoing, the resulting turbo stream renders as plain text

    def data
      response = read_lan_status_response('LanStatus', 2, lan_status_params)
      stream = response.success? ? '' : turbo_flash_message(type: :danger, message: response.message)
      stream = (stream || '') + turbo_stream.update(
        'lan_status',
        partial: 'ip/dashboard/lan_status',
        locals: { data: response.result[:body] }
      )
      render turbo_stream: stream

The above controller action involves an API call that typically takes a few seconds, the result is displayed in a lan_status partial that is used to update a lan_status turbo frame on the page that fired triggered the controller action, in this case the dashboard page:

              = turbo_frame_tag 'lan_status'
                = render 'lan_status'

When the user navigates to a different page in the app while the controller action is ongoing, the request will still come back and render as a string that looks like a turbo stream:

<turbo-stream action="update" target="lan_status"><template> ... </template></turbo-stream>

I want it to simply ignore these turbo streams if the user has navigated to a different page. I have tried creating hidden turbo frames with the same target names on the other pages to "catch" the incoming streams but this didn't work (and in any case, the problem still seems to happen if the user navigates to a different page, and then back to the original page, so the issue is not the presence or absence of the turbo frame target, I think). Is there an obvious solution to this that I'm not seeing?


问:
Is there a way to use two different amplify graphql endpoints for datastores in flutter?
We need to use two differnet endpoints from aws amplify with datastore in flutter.
The documentation from aws uses an singleton for amplify, so we can only have one endpoint, or am i miss something?
We use this plugin: https://pub.dev/packages/amplify_datastore
Is there a way to use the two endpoints?

I tried two instances of the class AmplifyClass, but it does not work, I also just got one database file, so I think that way wont work.


问:
Can't push projects to GitHub from Visual Studio unless its running in admin mode
Not sure if this is a bug or feature, fairly often I'll need to run VS as admin and whenever I create a project and create a new GitHub repository, then I HAVE to run VS as admin every subsequent time to be able to push to that repository, otherwise it'll just show no Git changes and pushing will just fail.

I'm guessing it sort of created the repository with elevated permissions, hence why I cant push when running VS normally, is there any way to revert this?


问:
How to save a graph with ggsave in a Windows folder structure?
I have following folder structure.

C:\Folders\Subfolder\Sub-Subfolder\Sub-Sub-Subfloder and also have file called grphics01.pdf and I want to save grphics01.pdf file to this C:\Folders\Subfolder\Sub-Subfolder\Sub-Sub-Subfloder folder.

My current working directory is different than this folder structure.

When I am using following code:

```<code>directory <- "C:\\Folders\\Subfolder\\Sub-Subfolder\\Sub-Sub-Subfloder\\"
ggsave(filename = here(directory, "graphics01.pdf"), width = 30, height = 20, units = "cm",
        device = cairo_pdf())
</code>```

I am getting this error:

```<code>Error in grDevices::pdf(file = filename, ..., version = version) :
cannot open file 'C:\Folders\Subfolder\Sub-Subfolder\Sub-Sub-Subfloder\/graphics.pdf'

</code>```

As per my understanding, Sub-Sub-Subfloder\/graphics.pdf the front-slash in-front of the file name is causing the error.

Is there any way can I convert this front-slash to a back-slash?

I have to resolve the issue by using "here" package and defining

```<code>ggsave(path = directory, filename = "graphics01.pdf, device = pdf)
</code>```

But I am getting the same eror.

Body:
I have following folder structure.

C:\Folders\Subfolder\Sub-Subfolder\Sub-Sub-Subfloder and also have file called grphics01.pdf and I want to save grphics01.pdf file to this C:\Folders\Subfolder\Sub-Subfolder\Sub-Sub-Subfloder folder.

My current working directory is different than this folder structure.

When I am using following code:

directory <- "C:\\Folders\\Subfolder\\Sub-Subfolder\\Sub-Sub-Subfloder\\"
ggsave(filename = here(directory, "graphics01.pdf"), width = 30, height = 20, units = "cm",
        device = cairo_pdf())

I am getting this error:

Error in grDevices::pdf(file = filename, ..., version = version) :
cannot open file 'C:\Folders\Subfolder\Sub-Subfolder\Sub-Sub-Subfloder\/graphics.pdf'

As per my understanding, Sub-Sub-Subfloder\/graphics.pdf the front-slash in-front of the file name is causing the error.

Is there any way can I convert this front-slash to a back-slash?

I have to resolve the issue by using "here" package and defining

ggsave(path = directory, filename = "graphics01.pdf, device = pdf)

But I am getting the same eror.


问:
Flutter Screenshot Package From Widget Width Was Called On Null
I am working with the Screenshot package to capture an image of a LinearPercentIndicator widget. However, I keep getting the error when the function is called

```<code>NoSuchMethodError: The getter 'width' was called on null.
Receiver: null
Tried calling: width
</code>```

I am not sure where this error is coming from. Any suggestions? The function is below

```<code>  Future<String> progressBarPath(double progress) async {
    final progressFile = File('${(await getTemporaryDirectory()).path}/image.png');
    var indicator = LinearPercentIndicator(
      percent: progress > 1.0 ? 1.0 : progress,
      width: 100,
      lineHeight: 13,
      animation: true,
      animationDuration: 1000,
      progressColor: FlutterFlowTheme.primaryColor,
      backgroundColor: Color(0xFFF1F4F8),
      center: Text(
        formatNumber(
            progress > 1.0 ? 1.0 : progress,
            formatType: FormatType.percent),
        style: FlutterFlowTheme.bodyText1.override(
          fontFamily: 'Lato',
          color: Colors.black,
          fontSize: 12,
          fontWeight: FontWeight.bold,
        ),
      ),
      barRadius: Radius.circular(20),
    );

//this is where the conversion to an image should occur
    screenshotController.captureFromWidget(
      InheritedTheme.captureAll(context, Material(child: indicator)),
          delay: Duration(seconds: 1),
    ).then((capturedProgress) async {
      await progressFile.create(recursive: true);
      await progressFile.writeAsBytes(capturedProgress);
    });
    print(progressFile.path);
    return progressFile.path;
  }
</code>```

Body:
I am working with the Screenshot package to capture an image of a LinearPercentIndicator widget. However, I keep getting the error when the function is called

NoSuchMethodError: The getter 'width' was called on null.
Receiver: null
Tried calling: width

I am not sure where this error is coming from. Any suggestions? The function is below

  Future<String> progressBarPath(double progress) async {
    final progressFile = File('${(await getTemporaryDirectory()).path}/image.png');
    var indicator = LinearPercentIndicator(
      percent: progress > 1.0 ? 1.0 : progress,
      width: 100,
      lineHeight: 13,
      animation: true,
      animationDuration: 1000,
      progressColor: FlutterFlowTheme.primaryColor,
      backgroundColor: Color(0xFFF1F4F8),
      center: Text(
        formatNumber(
            progress > 1.0 ? 1.0 : progress,
            formatType: FormatType.percent),
        style: FlutterFlowTheme.bodyText1.override(
          fontFamily: 'Lato',
          color: Colors.black,
          fontSize: 12,
          fontWeight: FontWeight.bold,
        ),
      ),
      barRadius: Radius.circular(20),
    );

//this is where the conversion to an image should occur
    screenshotController.captureFromWidget(
      InheritedTheme.captureAll(context, Material(child: indicator)),
          delay: Duration(seconds: 1),
    ).then((capturedProgress) async {
      await progressFile.create(recursive: true);
      await progressFile.writeAsBytes(capturedProgress);
    });
    print(progressFile.path);
    return progressFile.path;
  }


问:
Is it possible to process semantic segmentation with a masked image in Tensorflow Lite?
I'm working on an AndroidApp with TensorFlow Lite to process semantic segmentation.
https://www.tensorflow.org/lite/api_docs/java/org/tensorflow/lite/InterpreterApi

Also I'm using U2net model and processing images which are already masked like below.
enter image description here

Problem is masked area could be circle or elliptical shape, so it can't be done with normal process.
Throwing this image into interpreter results in getting just same image in which circle area is white color.
So I have to cut out the circle and throw it, but only the circle area is included.

Throwing cut-out image does't work, because it's out of shape.
The arrays must be square just like normal images.

I counld't find any lead to solve this problem.
Any advice would be appriciated.

Thank you.


问:
How to Preprocess a Dataset with Categorical and Numerical Data
Let's say we have a dataset with categorical and numerical data. I want to know if:

(1) it is okay to scale the whole dataset after encoding the categorical data (using label encoding, say), or

(2) it is okay to scale only the columns with numerical data

Note:

If (1), the columns with categorical data will become scaled too

If (2), there will be a bias towards the categorical data (the values of categorical data will be 0, 1, 2 etc if label encoder is used, say. The values of numerical data will be between 0 and 1 if MinMaxScaler is used, say)

I have tried both options. However, I have my reservations for them.

Thanks.


问:
How to update isValid when required rule in Controller change?
I use your library with primereact, I am therefore obliged to use the Controller on my fields. The rules of my Controller evolve according to the status of my form. When the status change, the dictionnary of the errors becomes not empty (the rules are applied) but the value of formState.isValid is not updating as long as I am not input an information in a field. Have you some ideas to help me ?

Here an exemple of my code :

```<code>import { useAppSelector } from "../../../../../hooks";
import { InputNumber } from "primereact/inputnumber";
import { Controller, useFormContext } from "react-hook-form";
import { DealStatusEnum } from "../../../../../models/enums/DealStatusEnum";

const Example = () => {
  // Variables
  const dealStatus = useAppSelector((state) => state.validationForm.dealStatus);

  // React-hook-form
  const {
    control,
    formState: { isValid },
  } = useFormContext();

  const test = () => {
    if (dealStatus === DealStatusEnum.DRAFT) {
      return true;
    } else {
      return false;
    }
  };

  useEffect(() => {
    console.log(isValid);
  });

  // ------------------------------------------------------------ render ------------------------------------------------------------------
  return (
    <div className="grid xl:col-6 xl:col-offset-3 col-offset-1 col-10 mg-top">
      <div className="xl:col-6  col-12">
        <Controller
          name="example"
          control={control}
          rules={{
            required: test(),
          }}
          render={({
            field: { onChange, onBlur, value },
            fieldState: { error },
          }) => (
            <InputNumber
              id="exampleInput"
              className={error ? "invalid" : "valid"}
              value={value}
              onChange={(e) => {
                onChange(e.value);
              }}
              onBlur={() => {
                onBlur();
              }}
              mode="decimal"
              locale="en-US"
              maxFractionDigits={2}
              disabled={false}
            />
          )}
        />
      </div>
    </div>
  );
};

export default Example;
</code>```

I have test to update the library, the should register attributes, but nothing fix the problem

Thanks and I wish you a good day

Body:
I use your library with primereact, I am therefore obliged to use the Controller on my fields. The rules of my Controller evolve according to the status of my form. When the status change, the dictionnary of the errors becomes not empty (the rules are applied) but the value of formState.isValid is not updating as long as I am not input an information in a field. Have you some ideas to help me ?

Here an exemple of my code :

import { useAppSelector } from "../../../../../hooks";
import { InputNumber } from "primereact/inputnumber";
import { Controller, useFormContext } from "react-hook-form";
import { DealStatusEnum } from "../../../../../models/enums/DealStatusEnum";

const Example = () => {
  // Variables
  const dealStatus = useAppSelector((state) => state.validationForm.dealStatus);

  // React-hook-form
  const {
    control,
    formState: { isValid },
  } = useFormContext();

  const test = () => {
    if (dealStatus === DealStatusEnum.DRAFT) {
      return true;
    } else {
      return false;
    }
  };

  useEffect(() => {
    console.log(isValid);
  });

  // ------------------------------------------------------------ render ------------------------------------------------------------------
  return (

        <Controller
          name="example"
          control={control}
          rules={{
            required: test(),
          }}
          render={({
            field: { onChange, onBlur, value },
            fieldState: { error },
          }) => (
            <InputNumber
              id="exampleInput"
              className={error ? "invalid" : "valid"}
              value={value}
              onChange={(e) => {
                onChange(e.value);
              }}
              onBlur={() => {
                onBlur();
              }}
              mode="decimal"
              locale="en-US"
              maxFractionDigits={2}
              disabled={false}
            />
          )}
        />

  );
};

export default Example;

I have test to update the library, the should register attributes, but nothing fix the problem

Thanks and I wish you a good day


问:
Is there a way to change position of transformer anchors so that I can interact with transformer using mousemove but from outside of transformer box?
For example need to use rotate anchor from another position then default top center of transformer

I have tried to create new Konva.Rect and pass its 'mousedown' and 'mousemove' events to transformer _handleMouseMove but didn't find appropriate way for it to work correctly.


问:
Poetry action on different matrix OS
I (try to) set up poetry-action according to their tutorial. After several experimental commits, I came to this "action" and "workflow". However, it does not run on all matrix.os I support

action   : https://github.com/trouchet/appy/actions/runs/3758552585

workflow : https://github.com/trouchet/appy/actions/runs/3758552585/workflow

May some of you have experience with poetry? :-)

Title: Poetry action on different matrix OS


问:
Cannot access public methods in extended Javascript class - Firebase
I am facing this issue while accessing public methods of an extended class.

This is the code of my connect(), it seems nothing wrong in it, i don't get why i can't use it from outside.

```<code>import { getAuth, signInWithEmailAndPassword, setPersistence, browserLocalPersistence, getIdToken, updateProfile, signOut } from 'firebase/auth';

export default class AuthManager extends getAuth {
  constructor() {
    super();
  }
  async connect() {
   // do something
  }
}
</code>```

This is instead how i declare the instance outside

```<code>import AuthManager from './auth/firebase-auth';

export default class FirebaseManager {
  #config = void 0;
  constructor(config) {
    this.isValidConfig(config)
      ? (this.#_initConfig = config)
      : () => {throw new TypeError('Missing or invalid configuration for FirebaseManager')}
  }
  set #_initConfig(conf) {
    this.#config = conf;
    this.#initiate();
  }
  isValidConfig(config) { // bla bla }
  async #initiate() {
    this.authenticationManager = new AuthManager(); <----- HERE
    await this.authenticationManager.connect() <----- connect() is not a function
    // do something else
  }
}
</code>```

Do you have any idea what i am doing wrong?

I tried instead to assign the function to a member and it works that way, but i didn't mean to use this that way

I also tried to define privately the function and it works fine, if i call it directly from the class.

```<code>  async #connect() {
   // do something
  }
}
</code>```

Body:
I am facing this issue while accessing public methods of an extended class.

This is the code of my connect(), it seems nothing wrong in it, i don't get why i can't use it from outside.

import { getAuth, signInWithEmailAndPassword, setPersistence, browserLocalPersistence, getIdToken, updateProfile, signOut } from 'firebase/auth';

export default class AuthManager extends getAuth {
  constructor() {
    super();
  }
  async connect() {
   // do something
  }
}

This is instead how i declare the instance outside

import AuthManager from './auth/firebase-auth';

export default class FirebaseManager {
  #config = void 0;
  constructor(config) {
    this.isValidConfig(config)
      ? (this.#_initConfig = config)
      : () => {throw new TypeError('Missing or invalid configuration for FirebaseManager')}
  }
  set #_initConfig(conf) {
    this.#config = conf;
    this.#initiate();
  }
  isValidConfig(config) { // bla bla }
  async #initiate() {
    this.authenticationManager = new AuthManager(); <----- HERE
    await this.authenticationManager.connect() <----- connect() is not a function
    // do something else
  }
}

Do you have any idea what i am doing wrong?

I tried instead to assign the function to a member and it works that way, but i didn't mean to use this that way

I also tried to define privately the function and it works fine, if i call it directly from the class.

  async #connect() {
   // do something
  }
}


问:
Jenkins Windows worker fails first build with ClosedChannelException
I have a self-provisioned Jenkins setup using vSphere cloud, where workers are cloned from previously built templates on demand. Everything is working smooth except for Windows workers. When I start a job which uses Windows node and there is none available, Jenkins creates one to run the job (it takes a 2 or 3 mins) but then fails on the checkout scm step, which gives following output:

```<code>> git fetch --no-tags --force --progress -- <repo> +refs/heads/master:refs/remotes/origin/master # timeout=10
12:58:50  [Pipeline] cleanWs
12:58:50  jenkins-windows-2019-worker1 was marked offline: Connection was broken: java.nio.channels.ClosedChannelException
12:58:50    at jenkins.agents.WebSocketAgents$Session.closed(WebSocketAgents.java:144)
12:58:50    at jenkins.websocket.WebSocketSession.onWebSocketSomething(WebSocketSession.java:91)
12:58:50    at com.sun.proxy.$Proxy129.onWebSocketClose(Unknown Source)
12:58:50    at org.eclipse.jetty.websocket.common.events.JettyListenerEventDriver.onClose(JettyListenerEventDriver.java:149)
12:58:50    at org.eclipse.jetty.websocket.common.WebSocketSession.callApplicationOnClose(WebSocketSession.java:394)
12:58:50    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.close(AbstractWebSocketConnection.java:225)
12:58:50    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection$Flusher.onCompleteFailure(AbstractWebSocketConnection.java:100)
12:58:50    at org.eclipse.jetty.util.IteratingCallback.failed(IteratingCallback.java:402)
12:58:50    at org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:302)
12:58:50    at org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:381)
12:58:50    at org.eclipse.jetty.websocket.common.io.FrameFlusher.flush(FrameFlusher.java:264)
12:58:50    at org.eclipse.jetty.websocket.common.io.FrameFlusher.process(FrameFlusher.java:193)
12:58:50    at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:241)
12:58:50    at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:223)
12:58:50    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.outgoingFrame(AbstractWebSocketConnection.java:581)
12:58:50    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.close(AbstractWebSocketConnection.java:181)
12:58:50    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:510)
12:58:50    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:440)
12:58:50    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
12:58:50    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
12:58:50    at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
12:58:50    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
12:58:50    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
12:58:50    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
12:58:50    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
12:58:50    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
12:58:50    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
12:58:50    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
12:58:50    at java.base/java.lang.Thread.run(Thread.java:829)

12:58:50  org.jenkinsci.plugins.workflow.support.steps.AgentOfflineException: Unable to create live FilePath for jenkins-windows-2019-worker1
12:58:50    at org.jenkinsci.plugins.workflow.support.steps.FilePathDynamicContext.get(FilePathDynamicContext.java:66)
12:58:50    at org.jenkinsci.plugins.workflow.support.steps.FilePathDynamicContext.get(FilePathDynamicContext.java:48)
12:58:50    at org.jenkinsci.plugins.workflow.steps.DynamicContext$Typed.get(DynamicContext.java:95)
12:58:50    at org.jenkinsci.plugins.workflow.cps.ContextVariableSet.get(ContextVariableSet.java:139)
12:58:50    at org.jenkinsci.plugins.workflow.cps.CpsThread.getContextVariable(CpsThread.java:137)
12:58:50    at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:298)
12:58:50    at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:75)
12:58:50    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:83)
12:58:50    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71)
12:58:50    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
12:58:50    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
12:58:50    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
12:58:50    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
12:58:50    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
12:58:50    at java.base/java.lang.Thread.run(Thread.java:829)
</code>```

Interesting thing is that I can replay the job and it will succeed on the same worker - only the first job on given Windows worker instance will fail.

Jenkins worker is started as Windows service using New-Service cmdlet. The service runs following command: java -Xmx6g -jar C:\jenkins-worker\agent.jar -jnlpUrl <jnlpUrl> -secret <secret>.

Linux workers are fine while having the same env (same network, same vCenter etc.)

I've tried updating Java versions to exactly match up to minor version - no result. Adding sleep before checkout scm solves the issue but is very dirty.

Body:
I have a self-provisioned Jenkins setup using vSphere cloud, where workers are cloned from previously built templates on demand. Everything is working smooth except for Windows workers. When I start a job which uses Windows node and there is none available, Jenkins creates one to run the job (it takes a 2 or 3 mins) but then fails on the checkout scm step, which gives following output:

> git fetch --no-tags --force --progress -- <repo> +refs/heads/master:refs/remotes/origin/master # timeout=10
12:58:50  [Pipeline] cleanWs
12:58:50  jenkins-windows-2019-worker1 was marked offline: Connection was broken: java.nio.channels.ClosedChannelException
12:58:50    at jenkins.agents.WebSocketAgents$Session.closed(WebSocketAgents.java:144)
12:58:50    at jenkins.websocket.WebSocketSession.onWebSocketSomething(WebSocketSession.java:91)
12:58:50    at com.sun.proxy.$Proxy129.onWebSocketClose(Unknown Source)
12:58:50    at org.eclipse.jetty.websocket.common.events.JettyListenerEventDriver.onClose(JettyListenerEventDriver.java:149)
12:58:50    at org.eclipse.jetty.websocket.common.WebSocketSession.callApplicationOnClose(WebSocketSession.java:394)
12:58:50    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.close(AbstractWebSocketConnection.java:225)
12:58:50    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection$Flusher.onCompleteFailure(AbstractWebSocketConnection.java:100)
12:58:50    at org.eclipse.jetty.util.IteratingCallback.failed(IteratingCallback.java:402)
12:58:50    at org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:302)
12:58:50    at org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:381)
12:58:50    at org.eclipse.jetty.websocket.common.io.FrameFlusher.flush(FrameFlusher.java:264)
12:58:50    at org.eclipse.jetty.websocket.common.io.FrameFlusher.process(FrameFlusher.java:193)
12:58:50    at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:241)
12:58:50    at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:223)
12:58:50    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.outgoingFrame(AbstractWebSocketConnection.java:581)
12:58:50    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.close(AbstractWebSocketConnection.java:181)
12:58:50    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:510)
12:58:50    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onFillable(AbstractWebSocketConnection.java:440)
12:58:50    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
12:58:50    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
12:58:50    at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
12:58:50    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
12:58:50    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
12:58:50    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
12:58:50    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
12:58:50    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
12:58:50    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
12:58:50    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
12:58:50    at java.base/java.lang.Thread.run(Thread.java:829)

12:58:50  org.jenkinsci.plugins.workflow.support.steps.AgentOfflineException: Unable to create live FilePath for jenkins-windows-2019-worker1
12:58:50    at org.jenkinsci.plugins.workflow.support.steps.FilePathDynamicContext.get(FilePathDynamicContext.java:66)
12:58:50    at org.jenkinsci.plugins.workflow.support.steps.FilePathDynamicContext.get(FilePathDynamicContext.java:48)
12:58:50    at org.jenkinsci.plugins.workflow.steps.DynamicContext$Typed.get(DynamicContext.java:95)
12:58:50    at org.jenkinsci.plugins.workflow.cps.ContextVariableSet.get(ContextVariableSet.java:139)
12:58:50    at org.jenkinsci.plugins.workflow.cps.CpsThread.getContextVariable(CpsThread.java:137)
12:58:50    at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:298)
12:58:50    at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:75)
12:58:50    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:83)
12:58:50    at org.jenkinsci.plugins.workflow.steps.CoreStep$Execution.run(CoreStep.java:71)
12:58:50    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
12:58:50    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
12:58:50    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
12:58:50    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
12:58:50    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
12:58:50    at java.base/java.lang.Thread.run(Thread.java:829)

Interesting thing is that I can replay the job and it will succeed on the same worker - only the first job on given Windows worker instance will fail.

Jenkins worker is started as Windows service using New-Service cmdlet. The service runs following command: java -Xmx6g -jar C:\jenkins-worker\agent.jar -jnlpUrl <jnlpUrl> -secret <secret>.

Linux workers are fine while having the same env (same network, same vCenter etc.)

I've tried updating Java versions to exactly match up to minor version - no result. Adding sleep before checkout scm solves the issue but is very dirty.


问:
how to install python module on dataproc cluster executors
how can we import xmltodict module to all worker nodes of cluster, now it's giving me error as ' no name module ' while performing xmltodict on pyspark dataframe

xmltodict python module should be install on all executors of dataproc cluster


问:
How to checkout automatically after creating a new branch from Github Issues in GitKraken?
After creating a local branch from Github Issues, GitKraken does not automatically checkout this new branch. I receive a notification that says "Checkout Failed - Could not find ref to checkout". If I manually checkout the new branch, it's all fine. Who has the solution for me?

I'm using a Mac with M1 processor.

Youri

I can't find a solution in the docs as I was looking for if this is a setting.


问:
How to consume Business Central SOAP Web Service with OAuth2 in ASP.NET CORE
I have implemented a codeunit in Business Central AL and published it as a SOAP Web Service with OAuth 2.0 authentication protocol. Now the challange comes when I try to consume this service in ASP.NET CORE. Please help.

Greetings Team, I have implemented a codeunit in Business Central AL and published it as a SOAP Web Service with OAuth 2.0 authentication protocol. Now the challange comes when I try to consume this service in ASP.NET CORE.

My expectation is to access the functions of the Web Service in ASP.NET CORE.

Please help.


问:
How would I create a table displaying the x and y values of the Spinners?
I would like to create a table which is by the right side of the graph which shows 2 columns of what x and y values have been inputted into the xSpin and ySpin spinners. I have drawn a picture of where I would like the table to reside. I have tried using textboxes in a grid pane layout to create a table and inputting the values directly into a grid of text boxes, however I couldn't add them individually to the series.

.

```<code>package Grava;
public class ScatterAdd extends Application {

    private final XYSeries series = new XYSeries("Voltage");
    private final XYSeries trend = new XYSeries("Trend");
    private final XYSeriesCollection dataset = new XYSeriesCollection(series);

    ChoiceBox<String> domainLabels = new ChoiceBox<>();
    ChoiceBox<String> rangeLabels = new ChoiceBox<>();

    private JFreeChart createChart() {
        return ChartFactory.createScatterPlot("VI Characteristics", "Current", "Voltage", dataset);
    }

    @Override
    public void start(Stage stage) {

        Image image = new Image("Grava.logo.png");
        stage.getIcons().add(image);
        var chart = createChart();

        XYPlot plot = chart.getXYPlot();
        plot.setDomainCrosshairVisible(true);
        plot.setRangeCrosshairVisible(true);
        XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) plot.getRenderer();
        r.setSeriesLinesVisible(1, Boolean.TRUE);
        r.setSeriesShapesVisible(1, Boolean.FALSE);

        var equation = new TextField();
        series.addChangeListener((event) -> {
            if (series.getItemCount() > 1) {
                double[] coefficients = Regression.getOLSRegression(dataset, 0);
                double b = coefficients[0]; // intercept
                double m = coefficients[1]; // slope
                equation.setText("y = " + m + " x + " + b);
                double x = series.getDataItem(0).getXValue();
                trend.clear();
                trend.add(x, m * x + b);
                x = series.getDataItem(series.getItemCount() - 1).getXValue();
                trend.add(x, m * x + b);
                dataset.addSeries(trend);

            }
        });
        domainLabels.getSelectionModel().selectedItemProperty().addListener((ov, s0, s1) -> {
            chart.getXYPlot().getDomainAxis().setLabel(s1);
        });
        rangeLabels.getSelectionModel().selectedItemProperty().addListener((ov, s0, s1) -> {
            chart.getXYPlot().getRangeAxis().setLabel(s1);
        });

        domainLabels.getItems().addAll("Current", "Seconds");
        domainLabels.setValue("Current");

        rangeLabels.getItems().addAll("Voltage", "Metres");
        rangeLabels.setValue("Voltage");

        var xSpin = new Spinner<Double>(-10000000.000, 10000000.000, 0, 0.1);
        xSpin.setEditable(true);
        xSpin.setPromptText("Xvalue");

        var ySpin = new Spinner<Double>(-10000000.000, 10000000.000, 0, 0.1);
        ySpin.setEditable(true);
        ySpin.setPromptText("Yvalue");

        var button = new Button("Add");
        button.setOnAction(ae -> series.add(xSpin.getValue(), ySpin.getValue()));
        HBox xBox = new HBox();
        xBox.getChildren().addAll(domainLabels);

        HBox yBox = new HBox();
        yBox.getChildren().addAll(rangeLabels);

        var enter = new ToolBar(xBox, xSpin, yBox, ySpin, button, equation);
        BorderPane.setAlignment(enter, Pos.CENTER);

        BorderPane root = new BorderPane();
        root.setCenter(new ChartViewer(chart));
        root.setBottom(enter);

        stage.setTitle("ScatterAdd");
        stage.setScene(new Scene(root, 720, 480));
        stage.show();

    }

    public static void main(String[] args) {
        launch(args);
    }
}
</code>```

Body:
I would like to create a table which is by the right side of the graph which shows 2 columns of what x and y values have been inputted into the xSpin and ySpin spinners. I have drawn a picture of where I would like the table to reside. I have tried using textboxes in a grid pane layout to create a table and inputting the values directly into a grid of text boxes, however I couldn't add them individually to the series.

.

package Grava;
public class ScatterAdd extends Application {

    private final XYSeries series = new XYSeries("Voltage");
    private final XYSeries trend = new XYSeries("Trend");
    private final XYSeriesCollection dataset = new XYSeriesCollection(series);

    ChoiceBox<String> domainLabels = new ChoiceBox<>();
    ChoiceBox<String> rangeLabels = new ChoiceBox<>();

    private JFreeChart createChart() {
        return ChartFactory.createScatterPlot("VI Characteristics", "Current", "Voltage", dataset);
    }

    @Override
    public void start(Stage stage) {

        Image image = new Image("Grava.logo.png");
        stage.getIcons().add(image);
        var chart = createChart();

        XYPlot plot = chart.getXYPlot();
        plot.setDomainCrosshairVisible(true);
        plot.setRangeCrosshairVisible(true);
        XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) plot.getRenderer();
        r.setSeriesLinesVisible(1, Boolean.TRUE);
        r.setSeriesShapesVisible(1, Boolean.FALSE);

        var equation = new TextField();
        series.addChangeListener((event) -> {
            if (series.getItemCount() > 1) {
                double[] coefficients = Regression.getOLSRegression(dataset, 0);
                double b = coefficients[0]; // intercept
                double m = coefficients[1]; // slope
                equation.setText("y = " + m + " x + " + b);
                double x = series.getDataItem(0).getXValue();
                trend.clear();
                trend.add(x, m * x + b);
                x = series.getDataItem(series.getItemCount() - 1).getXValue();
                trend.add(x, m * x + b);
                dataset.addSeries(trend);

            }
        });
        domainLabels.getSelectionModel().selectedItemProperty().addListener((ov, s0, s1) -> {
            chart.getXYPlot().getDomainAxis().setLabel(s1);
        });
        rangeLabels.getSelectionModel().selectedItemProperty().addListener((ov, s0, s1) -> {
            chart.getXYPlot().getRangeAxis().setLabel(s1);
        });

        domainLabels.getItems().addAll("Current", "Seconds");
        domainLabels.setValue("Current");

        rangeLabels.getItems().addAll("Voltage", "Metres");
        rangeLabels.setValue("Voltage");

        var xSpin = new Spinner<Double>(-10000000.000, 10000000.000, 0, 0.1);
        xSpin.setEditable(true);
        xSpin.setPromptText("Xvalue");

        var ySpin = new Spinner<Double>(-10000000.000, 10000000.000, 0, 0.1);
        ySpin.setEditable(true);
        ySpin.setPromptText("Yvalue");

        var button = new Button("Add");
        button.setOnAction(ae -> series.add(xSpin.getValue(), ySpin.getValue()));
        HBox xBox = new HBox();
        xBox.getChildren().addAll(domainLabels);

        HBox yBox = new HBox();
        yBox.getChildren().addAll(rangeLabels);

        var enter = new ToolBar(xBox, xSpin, yBox, ySpin, button, equation);
        BorderPane.setAlignment(enter, Pos.CENTER);

        BorderPane root = new BorderPane();
        root.setCenter(new ChartViewer(chart));
        root.setBottom(enter);

        stage.setTitle("ScatterAdd");
        stage.setScene(new Scene(root, 720, 480));
        stage.show();

    }

    public static void main(String[] args) {
        launch(args);
    }
}


问:
vtkXOpenGLRenderWindow bad X Server connection
I'm attempting to run some scrimmage missions through a docker container on Ubuntu 22.04. I can walk through docker image/container setups in more detail if need be.  Ran the container off the image with the following script:

```<code>xhost +local:root
docker run -it \
    --ipc=host \
    --name $2 \
    --env="DISPLAY" \
    --env="QT_X11_NO_MITSHM=1" \
    --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
    --privileged \
    $1
xhost -local:root
</code>```

After attaching the container and attempting to run a mission I get the following error:

```<code>ERROR: In /build/vtk7-yd0MKW/vtk7-7.1.1+dfsg2/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 300
vtkXOpenGLRenderWindow (0x5590cbbf87d0): bad X server connection. DISPLAY=:1. Aborting.

Aborted
</code>```

I suspect this might have to do with the X11 forwarding setup, although I don't know how to troubleshoot that.  Already referenced the following two posts from online searches:

"Can't use X server on Ubuntu #1 ": https://github.com/lukin0110/docker-vtk-python/issues/1

"Docker Display GUI with X Server": https://www.mit.edu/~arosinol/2019/08/06/Docker_Display_GUI_with_X_server/

Any tips?

Body:
I'm attempting to run some scrimmage missions through a docker container on Ubuntu 22.04. I can walk through docker image/container setups in more detail if need be.  Ran the container off the image with the following script:

xhost +local:root
docker run -it \
    --ipc=host \
    --name $2 \
    --env="DISPLAY" \
    --env="QT_X11_NO_MITSHM=1" \
    --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
    --privileged \
    $1
xhost -local:root

After attaching the container and attempting to run a mission I get the following error:

ERROR: In /build/vtk7-yd0MKW/vtk7-7.1.1+dfsg2/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 300
vtkXOpenGLRenderWindow (0x5590cbbf87d0): bad X server connection. DISPLAY=:1. Aborting.

Aborted

I suspect this might have to do with the X11 forwarding setup, although I don't know how to troubleshoot that.  Already referenced the following two posts from online searches:

"Can't use X server on Ubuntu #1 ": https://github.com/lukin0110/docker-vtk-python/issues/1

"Docker Display GUI with X Server": https://www.mit.edu/~arosinol/2019/08/06/Docker_Display_GUI_with_X_server/

Any tips?


问:
<h1> tag render on prod automatically
below h1 tag coming automatically in nextjs. can anyone help how to remove it
I'm unable to understand why this h1 tag coming.
h1 tag coming only in prod site testing and stg site its not coming</p>
```<code><h1 role="heading" aria-level="1" data-uw-rm-heading="h1" style="clip: rect(1px, 1px, 1px, 1px)!important;height:1px!important;width:1px!important;overflow:hidden!important;position:absolute!important;top:0!important;left:0!important;z-index:-1!important;opacity:0!important" data-uw-rm-ignore="">home</h1>
</code>```

Title: <h1> tag render on prod automatically

Body:
below h1 tag coming automatically in nextjs. can anyone help how to remove it
I'm unable to understand why this h1 tag coming.
h1 tag coming only in prod site testing and stg site its not coming

home


问:
Lexicaljs editor clicking image is not triggering node selection
I have created custom ImageNode by extending the DecoratorNode.

When I click the ImageNode,

a click event is fired on the span of that node as expected,

but still selection.getNodes() doesn't have the image node.

while clicking on other elements works fine.

Here is the implementation of ImageNode

```<code>import type {
    DOMConversionMap,
    DOMConversionOutput,
    DOMExportOutput,
    EditorConfig,
    LexicalEditor,
    LexicalNode,
    NodeKey,
    SerializedEditor,
    SerializedLexicalNode,
    Spread,
} from "lexical";

import { createEditor, DecoratorNode } from "lexical";

import ImageComponent from "./ImageComponent";

export interface ImagePayload {
    altText: string;
    caption?: LexicalEditor;
    height: number;
    key?: NodeKey;
    maxWidth?: number;
    showCaption?: boolean;
    src: string;
    width: number;
    captionsEnabled?: boolean;
}

function convertImageElement(domNode: Node): null | DOMConversionOutput {
    if (domNode instanceof HTMLImageElement) {
        const { alt: altText, src } = domNode;
        const node = $createImageNode({
            altText,
            src,
            width: 200,
            height: 200,
        });
        return { node };
    }
    return null;
}

export type SerializedImageNode = Spread<
    {
        altText: string;
        caption: SerializedEditor;
        height: number;
        maxWidth: number;
        showCaption: boolean;
        src: string;
        width: number;
        type: "image";
        version: 1;
    },
    SerializedLexicalNode
>;

export class ImageNode
    extends DecoratorNode<JSX.Element>
    implements LexicalNode
{
    __src: string;
    __altText: string;
    __width: number;
    __height: number;
    __maxWidth: number;
    __showCaption: boolean;
    __caption: LexicalEditor;
    // Captions cannot yet be used within editor cells
    __captionsEnabled: boolean;

    static getType(): string {
        return "image";
    }

    static clone(node: ImageNode): ImageNode {
        return new ImageNode(
            node.__src,
            node.__altText,
            node.__maxWidth,
            node.__width,
            node.__height,
            node.__showCaption,
            node.__caption,
            node.__captionsEnabled,
            node.__key
        );
    }

    static importJSON(serializedNode: SerializedImageNode): ImageNode {
        const { altText, height, width, maxWidth, caption, src, showCaption } =
            serializedNode;
        const node = $createImageNode({
            altText,
            height,
            maxWidth,
            showCaption,
            src,
            width,
        });
        const nestedEditor = node.__caption;
        const editorState = nestedEditor.parseEditorState(caption.editorState);
        if (!editorState.isEmpty()) {
            nestedEditor.setEditorState(editorState);
        }
        return node;
    }

    exportDOM(): DOMExportOutput {
        const element = document.createElement("img");
        element.setAttribute("src", this.__src);
        element.setAttribute("alt", this.__altText);
        return { element };
    }

    static importDOM(): DOMConversionMap | null {
        return {
            img: (node: Node) => ({
                conversion: convertImageElement,
                priority: 0,
            }),
        };
    }

    constructor(
        src: string,
        altText: string,
        maxWidth: number,
        width: number,
        height: number,
        showCaption?: boolean,
        caption?: LexicalEditor,
        captionsEnabled?: boolean,
        key?: NodeKey
    ) {
        super(key);
        this.__src = src;
        this.__altText = altText;
        this.__maxWidth = maxWidth;
        this.__width = width ?? 300;
        this.__height = height ?? 300;
        this.__showCaption = showCaption || false;
        this.__caption = caption || createEditor();
        this.__captionsEnabled =
            captionsEnabled || captionsEnabled === undefined;
    }

    exportJSON(): SerializedImageNode {
        return {
            altText: this.getAltText(),
            caption: this.__caption.toJSON(),
            height: this.__height,
            maxWidth: this.__maxWidth,
            showCaption: this.__showCaption,
            src: this.getSrc(),
            type: "image",
            version: 1,
            width: this.__width,
        };
    }

    setWidthAndHeight(width: number, height: number): void {
        const writable = this.getWritable();
        writable.__width = width;
        writable.__height = height;
    }

    setShowCaption(showCaption: boolean): void {
        const writable = this.getWritable();
        writable.__showCaption = showCaption;
    }

    // View

    createDOM(config: EditorConfig): HTMLElement {
        const span = document.createElement("span");
        const theme = config.theme;
        const className = theme.image;
        if (className !== undefined) {
            span.className = className;
        }
        return span;
    }

    updateDOM(): false {
        return false;
    }

    getSrc(): string {
        return this.__src;
    }

    getAltText(): string {
        return this.__altText;
    }

    decorate(): JSX.Element {
        return (
            <ImageComponent
                src={this.__src}
                altText={this.__altText}
                width={this.__width}
                height={this.__height}
                maxWidth={this.__maxWidth}
                nodeKey={this.__key}
                showCaption={this.__showCaption}
                caption={this.__caption}
                captionsEnabled={this.__captionsEnabled}
                resizable={true}
            />
        );
    }
}

export function $createImageNode({
    altText,
    height,
    maxWidth = 500,
    captionsEnabled,
    src,
    width,
    showCaption,
    caption,
    key,
}: ImagePayload): ImageNode {
    return new ImageNode(
        src,
        altText,
        maxWidth,
        width,
        height,
        showCaption,
        caption,
        captionsEnabled,
        key
    );
}

export function $isImageNode(
    node: LexicalNode | null | undefined
): node is ImageNode {
    return node instanceof ImageNode;
}
</code>```

Body:
I have created custom ImageNode by extending the DecoratorNode.

When I click the ImageNode,

a click event is fired on the span of that node as expected,

but still selection.getNodes() doesn't have the image node.

while clicking on other elements works fine.

Here is the implementation of ImageNode

import type {
    DOMConversionMap,
    DOMConversionOutput,
    DOMExportOutput,
    EditorConfig,
    LexicalEditor,
    LexicalNode,
    NodeKey,
    SerializedEditor,
    SerializedLexicalNode,
    Spread,
} from "lexical";

import { createEditor, DecoratorNode } from "lexical";

import ImageComponent from "./ImageComponent";

export interface ImagePayload {
    altText: string;
    caption?: LexicalEditor;
    height: number;
    key?: NodeKey;
    maxWidth?: number;
    showCaption?: boolean;
    src: string;
    width: number;
    captionsEnabled?: boolean;
}

function convertImageElement(domNode: Node): null | DOMConversionOutput {
    if (domNode instanceof HTMLImageElement) {
        const { alt: altText, src } = domNode;
        const node = $createImageNode({
            altText,
            src,
            width: 200,
            height: 200,
        });
        return { node };
    }
    return null;
}

export type SerializedImageNode = Spread<
    {
        altText: string;
        caption: SerializedEditor;
        height: number;
        maxWidth: number;
        showCaption: boolean;
        src: string;
        width: number;
        type: "image";
        version: 1;
    },
    SerializedLexicalNode
>;

export class ImageNode
    extends DecoratorNode<JSX.Element>
    implements LexicalNode
{
    __src: string;
    __altText: string;
    __width: number;
    __height: number;
    __maxWidth: number;
    __showCaption: boolean;
    __caption: LexicalEditor;
    // Captions cannot yet be used within editor cells
    __captionsEnabled: boolean;

    static getType(): string {
        return "image";
    }

    static clone(node: ImageNode): ImageNode {
        return new ImageNode(
            node.__src,
            node.__altText,
            node.__maxWidth,
            node.__width,
            node.__height,
            node.__showCaption,
            node.__caption,
            node.__captionsEnabled,
            node.__key
        );
    }

    static importJSON(serializedNode: SerializedImageNode): ImageNode {
        const { altText, height, width, maxWidth, caption, src, showCaption } =
            serializedNode;
        const node = $createImageNode({
            altText,
            height,
            maxWidth,
            showCaption,
            src,
            width,
        });
        const nestedEditor = node.__caption;
        const editorState = nestedEditor.parseEditorState(caption.editorState);
        if (!editorState.isEmpty()) {
            nestedEditor.setEditorState(editorState);
        }
        return node;
    }

    exportDOM(): DOMExportOutput {
        const element = document.createElement("img");
        element.setAttribute("src", this.__src);
        element.setAttribute("alt", this.__altText);
        return { element };
    }

    static importDOM(): DOMConversionMap | null {
        return {
            img: (node: Node) => ({
                conversion: convertImageElement,
                priority: 0,
            }),
        };
    }

    constructor(
        src: string,
        altText: string,
        maxWidth: number,
        width: number,
        height: number,
        showCaption?: boolean,
        caption?: LexicalEditor,
        captionsEnabled?: boolean,
        key?: NodeKey
    ) {
        super(key);
        this.__src = src;
        this.__altText = altText;
        this.__maxWidth = maxWidth;
        this.__width = width ?? 300;
        this.__height = height ?? 300;
        this.__showCaption = showCaption || false;
        this.__caption = caption || createEditor();
        this.__captionsEnabled =
            captionsEnabled || captionsEnabled === undefined;
    }

    exportJSON(): SerializedImageNode {
        return {
            altText: this.getAltText(),
            caption: this.__caption.toJSON(),
            height: this.__height,
            maxWidth: this.__maxWidth,
            showCaption: this.__showCaption,
            src: this.getSrc(),
            type: "image",
            version: 1,
            width: this.__width,
        };
    }

    setWidthAndHeight(width: number, height: number): void {
        const writable = this.getWritable();
        writable.__width = width;
        writable.__height = height;
    }

    setShowCaption(showCaption: boolean): void {
        const writable = this.getWritable();
        writable.__showCaption = showCaption;
    }

    // View

    createDOM(config: EditorConfig): HTMLElement {
        const span = document.createElement("span");
        const theme = config.theme;
        const className = theme.image;
        if (className !== undefined) {
            span.className = className;
        }
        return span;
    }

    updateDOM(): false {
        return false;
    }

    getSrc(): string {
        return this.__src;
    }

    getAltText(): string {
        return this.__altText;
    }

    decorate(): JSX.Element {
        return (
            <ImageComponent
                src={this.__src}
                altText={this.__altText}
                width={this.__width}
                height={this.__height}
                maxWidth={this.__maxWidth}
                nodeKey={this.__key}
                showCaption={this.__showCaption}
                caption={this.__caption}
                captionsEnabled={this.__captionsEnabled}
                resizable={true}
            />
        );
    }
}

export function $createImageNode({
    altText,
    height,
    maxWidth = 500,
    captionsEnabled,
    src,
    width,
    showCaption,
    caption,
    key,
}: ImagePayload): ImageNode {
    return new ImageNode(
        src,
        altText,
        maxWidth,
        width,
        height,
        showCaption,
        caption,
        captionsEnabled,
        key
    );
}

export function $isImageNode(
    node: LexicalNode | null | undefined
): node is ImageNode {
    return node instanceof ImageNode;
}


问:
How to use empty values in list using cloudformation
```<code>Parameters:
  AccountEnv:
    Type: 'AWS::SSM::Parameter::Value<String>'
    Default: '/delta/account/environment'
</code>```

```<code>Mappings:
  DomainMap:
    development:
      Alias: ""
    systems-integration:
      Alias: "example.com"
</code>```

```<code>    CfDistributionWithAOI:
        Type: "AWS::CloudFront::Distribution"
        Metadata:
          Comment: 'A simple CloudFront distribution with an S3 origin'
        Properties:
          DistributionConfig:
            Comment: 'A simple distribution with an S3 origin'
            Logging:
              IncludeCookies: 'false'
              Bucket: !Sub ${LogBucket}.s3.amazonaws.com
            Aliases:
            - 'sample.example.com'
            - 'sample1.example.com'
            - !FindInMap [DomainMap, !Ref AccountEnv, Alias]
</code>```

In the above example, I don't have to add any extra Aliases in the Distribution resources(taking from map). So I created one map to store the alias value for multi env, but seems it is not taking "" values in Aliases list section. How can I pass the last alias value as empty for development environment?

Body:
Parameters:
  AccountEnv:
    Type: 'AWS::SSM::Parameter::Value<String>'
    Default: '/delta/account/environment'

Mappings:
  DomainMap:
    development:
      Alias: ""
    systems-integration:
      Alias: "example.com"

    CfDistributionWithAOI:
        Type: "AWS::CloudFront::Distribution"
        Metadata:
          Comment: 'A simple CloudFront distribution with an S3 origin'
        Properties:
          DistributionConfig:
            Comment: 'A simple distribution with an S3 origin'
            Logging:
              IncludeCookies: 'false'
              Bucket: !Sub ${LogBucket}.s3.amazonaws.com
            Aliases:
            - 'sample.example.com'
            - 'sample1.example.com'
            - !FindInMap [DomainMap, !Ref AccountEnv, Alias]

In the above example, I don't have to add any extra Aliases in the Distribution resources(taking from map). So I created one map to store the alias value for multi env, but seems it is not taking "" values in Aliases list section. How can I pass the last alias value as empty for development environment?


问:
How to get a List of items in Swagger (Springfox) in Spring Boot
I have a problem with the ApiResponse of my REST service. The problem is, within the Swagger UI, the following code doesn't return me an array of objects, it does return me "{}". How can I solve this problem?

```<code>//GET
    @ApiOperation(
            value  = "Display the entire ExampleList",
            notes  = "Allows viewing of the entire ExampleList in the MongoDB database",
            response = ExampleListDTO.class,
            responseContainer = "List",
            produces = "application/json"
            )
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode =  "404",
                    description = "Not found - The ValueList was not found"
                    ),
            @ApiResponse(
                    responseCode = "200",
                    content = @Content(
                            array = @ArraySchema(
                                    schema = @Schema(
                                            implementation =ExampleListDTO.class
                                            )
                                    )
                            ),
                    description = "Successfully retrieved"
                    )
            })
    @GetMapping("/exampleList")
    public ResponseEntity<?> getAllExampleList(){
        return exampleListService.getAllExampleList();
    }
</code>```

I would like it to return this result to me:

```<code>[
  {
    "type": "string",
    "exampleSet": [
      "string"
    ]
  }
]
</code>```

Body:
I have a problem with the ApiResponse of my REST service. The problem is, within the Swagger UI, the following code doesn't return me an array of objects, it does return me "{}". How can I solve this problem?

//GET
    @ApiOperation(
            value  = "Display the entire ExampleList",
            notes  = "Allows viewing of the entire ExampleList in the MongoDB database",
            response = ExampleListDTO.class,
            responseContainer = "List",
            produces = "application/json"
            )
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode =  "404",
                    description = "Not found - The ValueList was not found"
                    ),
            @ApiResponse(
                    responseCode = "200",
                    content = @Content(
                            array = @ArraySchema(
                                    schema = @Schema(
                                            implementation =ExampleListDTO.class
                                            )
                                    )
                            ),
                    description = "Successfully retrieved"
                    )
            })
    @GetMapping("/exampleList")
    public ResponseEntity<?> getAllExampleList(){
        return exampleListService.getAllExampleList();
    }

I would like it to return this result to me:

[
  {
    "type": "string",
    "exampleSet": [
      "string"
    ]
  }
]


问:
Apache2 not loading Django settings.py file properly
I am currently facing an issue where making any changes in settings.py file is not reflecting properly in my project. I have tried deleting the .conf file, adding it again, enabling it and reloading the apache2 server. But somehow it still does not work.

I have an issue with CORS in Django, I made changes to correct it by allowing certain origins to make cross-origin requests:

```<code>CORS_ALLOWED_ORIGINS = ['www.test.domain',...]
</code>```

So I tested it by running the Django server manually using python runserver 0.0.0.0:8000 and it is working fine, not getting any CORS issues

But when I reload the apache2 server or even in this case, make a completely new .conf file and run it via apache2 - it still somehow does not recognize the changes and keeps giving me CORS errors.

I am confused as to what is making this happen - to not reflect any newly made changes. The problem is, now I am not able to reflect these changes with a new configuration as well. So there is no way for me to keep this webserver running without getting CORS errors.

NOTE: Apache has all the required accesses to my Django project - it can access settings.py without any issues.

Tried: Disabling the backend.conf file, deleting it. Creating a new backend.conf file with the following config:

```<code><Directory /home/django_project/main_django_project>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

    WSGIScriptAlias / /home/django_project/main_django_project
    WSGIDaemonProcess app python-path=/home/django_project python-home=/home/venv
    WSGIProcessGroup app
</code>```

Note: venv has all the required packages to run the django project

Also tried running the same Django project manually with python runserver 0.0.0.0:8000. Didn't see any CORS errors there, but immediately stopped this server and ran the apache2 server again and started seeing the CORS errors.

I also tried one more interesting thing: I set up a logger inside settings.py. It only wrote logs whenever I started the server manually using runserver command, it never wrote logs when it was being run in apache2 webserver which makes me think this settings.py is not being used at all somehow.

Body:
I am currently facing an issue where making any changes in settings.py file is not reflecting properly in my project. I have tried deleting the .conf file, adding it again, enabling it and reloading the apache2 server. But somehow it still does not work.

I have an issue with CORS in Django, I made changes to correct it by allowing certain origins to make cross-origin requests:

CORS_ALLOWED_ORIGINS = ['www.test.domain',...]

So I tested it by running the Django server manually using python runserver 0.0.0.0:8000 and it is working fine, not getting any CORS issues

But when I reload the apache2 server or even in this case, make a completely new .conf file and run it via apache2 - it still somehow does not recognize the changes and keeps giving me CORS errors.

I am confused as to what is making this happen - to not reflect any newly made changes. The problem is, now I am not able to reflect these changes with a new configuration as well. So there is no way for me to keep this webserver running without getting CORS errors.

NOTE: Apache has all the required accesses to my Django project - it can access settings.py without any issues.

Tried: Disabling the backend.conf file, deleting it. Creating a new backend.conf file with the following config:

<Directory /home/django_project/main_django_project>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

    WSGIScriptAlias / /home/django_project/main_django_project
    WSGIDaemonProcess app python-path=/home/django_project python-home=/home/venv
    WSGIProcessGroup app

Note: venv has all the required packages to run the django project

Also tried running the same Django project manually with python runserver 0.0.0.0:8000. Didn't see any CORS errors there, but immediately stopped this server and ran the apache2 server again and started seeing the CORS errors.

I also tried one more interesting thing: I set up a logger inside settings.py. It only wrote logs whenever I started the server manually using runserver command, it never wrote logs when it was being run in apache2 webserver which makes me think this settings.py is not being used at all somehow.


问:
Checking NAN & Spaces for a given column list in Pandas Data frames
I am a beginner to Python and pandas ,I need to filter rows when a given columns/column  in the list  is spaces or Nulls or Nan

My result should be like this

Rejection rows:-

I am storing the keys in a list for this data frame in cols_list.

cols_list = ['Product_ID','Vendor_ID']

To remove Nans:

```<code>df2 = df.dropna(axis = 0, subset = cols_list, how = 'all', inplace = True)
</code>```

but I would like to remove rows if both keys have spaces or either one has spaces too.
also i would like to capture the dropped rows in to another data frame .

```<code>df2 = df[df[cols_list].isna()]
</code>```

Can any one please advise to check for spaces as well as Nan and remove those rows and capture the same . Since isna is not getting any of rows.Please advise and help.

Body:
I am a beginner to Python and pandas ,I need to filter rows when a given columns/column  in the list  is spaces or Nulls or Nan

My result should be like this

Rejection rows:-

I am storing the keys in a list for this data frame in cols_list.

cols_list = ['Product_ID','Vendor_ID']

To remove Nans:

df2 = df.dropna(axis = 0, subset = cols_list, how = 'all', inplace = True)

but I would like to remove rows if both keys have spaces or either one has spaces too.
also i would like to capture the dropped rows in to another data frame .

df2 = df[df[cols_list].isna()]

Can any one please advise to check for spaces as well as Nan and remove those rows and capture the same . Since isna is not getting any of rows.Please advise and help.


问:
How to copy from a DFS to a local windows server using Ansible
I'm trying to copy some files which are stored in a DFS folder (\\some.dfs.com\path\to\files) to a Windows machine.

I already tested running the copy and xcopy commands within the Windows VM and both of them works without any issue

And the playbook I ran are below:

  - name: Copy from DFS
    win_copy:
      src: \\some.dfs.com\path\to\files
      dest: C:\temp
      remote_src: yes
```

I already tried with the win_command and win_shell modules. I get a similar error message with both of them:

the specified path doesn't exist

or

the path is not right

So I guess I'm not typing the source correctly. I also tried using double quotes and escaping backslashes but the issue is the same.

Body:
I'm trying to copy some files which are stored in a DFS folder (\\some.dfs.com\path\to\files) to a Windows machine.

I already tested running the copy and xcopy commands within the Windows VM and both of them works without any issue

And the playbook I ran are below:

  - name: Copy from DFS
    win_copy:
      src: \\some.dfs.com\path\to\files
      dest: C:\temp
      remote_src: yes

I already tried with the win_command and win_shell modules. I get a similar error message with both of them:

the specified path doesn't exist

or

the path is not right

So I guess I'm not typing the source correctly. I also tried using double quotes and escaping backslashes but the issue is the same.


问:
To check an element in tensorflow array?
If a=tf.tensorarray 1 dim and b is tf.tensor how to check Whether b is present in a or not. An alternative of if a in list_b where a abd b are tensor so in is not working.

If b is present in a select it need to be used in tf.data.filter function


问:
Restrict AWS API Gateway to AWS Amplify Application
I've set-up an API gateway on AWS and currently plan to host a React application on AWS Amplify.

Reading through the documentation I'm left wondering what would be the best practices around restrict traffic through the gateway to only be allowed from an Amplify application.

Do I have to create a dedicated VPC for this, or do I get a dedicated IP for my Amplify Application I can whitelist?
Obviously I have authorizers on the resources but I would prefer to completely restrict access to call the gateway to a certain application.


问:
Parsing tinyMCE with PHP script
I'm trying to parsing a TinyMCE input to write blocks to the database with a PHP script.
My input is a string that containt a formatted richtext.

example string:

```<code><p>A paragraph<sup id=\"qnote_19000793911670426271172\" class=\"mce-qnote\"><a href=\"#qnotes_entry_19000793911670426271172\">1<\/a><\/sup>.<\/p>\r\n

<p>Another paragraph<sup id=\"qnote_61186641421670426275756\" class=\"mce-qnote\">
        <a href=\"#qnotes_entry_61186641421670426275756\">2<\/a><\/sup>.<\/p>\r\n

<div class=\"mce-qnotes\">
    <hr>\r\n
    <ol>\r\n
        <li id=\"qnotes_entry_19000793911670426271172\"><a class=\"mce-qnotes-backlink\" href=\"#qnote_19000793911670426271172\">^ <\/a>
            <span class=\"mce-qnotes-note\">First note<\/span><\/li>\r\n
        <li id=\"qnotes_entry_61186641421670426275756\"><a class=\"mce-qnotes-backlink\" href=\"#qnote_61186641421670426275756\">^ <\/a>
            <span class=\"mce-qnotes-note\">Second quote<\/span><\/li>\r\n
    <\/ol>\r\n
</code>```

I need to write all the
 tags into a json. I found a solution but it must be improve.

Current script:

```<code>
$html = "
<p>A paragraph<sup id=\"qnote_19000793911670426271172\" class=\"mce-qnote\"><a href=\"#qnotes_entry_19000793911670426271172\">1<\/a><\/sup>.<\/p>\r\n

<p>Another paragraph<sup id=\"qnote_61186641421670426275756\" class=\"mce-qnote\">
        <a href=\"#qnotes_entry_61186641421670426275756\">2<\/a><\/sup>.<\/p>\r\n

<div class=\"mce-qnotes\">
    <hr>\r\n
    <ol>\r\n
        <li id=\"qnotes_entry_19000793911670426271172\"><a class=\"mce-qnotes-backlink\" href=\"#qnote_19000793911670426271172\">^ <\/a>
            <span class=\"mce-qnotes-note\">First note<\/span><\/li>\r\n
        <li id=\"qnotes_entry_61186641421670426275756\"><a class=\"mce-qnotes-backlink\" href=\"#qnote_61186641421670426275756\">^ <\/a>
            <span class=\"mce-qnotes-note\">Second quote<\/span><\/li>\r\n
    <\/ol>\r\n
<\/div>

preg_match_all('/<p>(.*?)\/p>/s', $html, $a);
preg_match_all('/<sup(.*?)sup>/s', $html, $b);

foreach($a[1] as $item) {
    $str = preg_replace('/<sup(.*?)sup>.</s', '',$item)."\n";
    $str = str_replace('\\', '.', $str);
    echo $str;
    // eloquent stuff

}
</code>```

Output:

```<code>A paragraph.
Another paragraph.
</code>```

Title: Parsing tinyMCE with PHP script

Body:
I'm trying to parsing a TinyMCE input to write blocks to the database with a PHP script.
My input is a string that containt a formatted richtext.

example string:

A paragraph1<\/a><\/sup>.<\/p>\r\n

Another paragraph
        2<\/a><\/sup>.<\/p>\r\n

\r\n

\r\n

^ <\/a>
            First note<\/span><\/li>\r\n

^ <\/a>
            Second quote<\/span><\/li>\r\n
    <\/ol>\r\n

I need to write all the
 tags into a json. I found a solution but it must be improve.

Current script:

$html = "

A paragraph1<\/a><\/sup>.<\/p>\r\n

Another paragraph
        2<\/a><\/sup>.<\/p>\r\n

\r\n

\r\n

^ <\/a>
            First note<\/span><\/li>\r\n

^ <\/a>
            Second quote<\/span><\/li>\r\n
    <\/ol>\r\n
<\/div>

preg_match_all('/
(.*?)\/p>/s', $html, $a);
preg_match_all('//s', $html, $b);

foreach($a[1] as $item) {
    $str = preg_replace('/.</s', '',$item)."\n";
    $str = str_replace('\\', '.', $str);
    echo $str;
    // eloquent stuff

}

Output:

A paragraph.
Another paragraph.


问:
unity service layout text is blur
I done know how to ask this question. But Here is the Image which will explain all.

Last Night unity was working fine. I updated  ** Macbook to macOS 13. Ventura** and I got this issue.

Title: unity service layout text is blur


问:
How to get and manipulate the values of specific column in a C# win forms data grid view
I have fetched a values into C# windows forms data grid view from firebase real time database.

In the above image I displayed only the filtered rows, from that filtered rows I only want to get the values of credit_Amount Column values. And I want to sum the values.

This code to get all values.

```<code> public async Task<List<Model_Class>> GetAllCredit()
 {
     return (await Firebase.Child("Credit").OnceAsync<Model_Class>()).Select(item => new Model_Class
     {
         Credit = item.Object.Credit,
         Credit_Amount = item.Object.Credit_Amount,
         Credit_Date = item.Object.Credit_Date,
         Credit_Remark = item.Object.Credit_Remark

     }).ToList();
 }
</code>```

Here I filterd

```<code> public async Task<List<Model_Class>> GetcreditTrans(string typ,DateTime fdate,DateTime tdate)
 {
     var allPersons = await GetAllCredit();
     await Firebase
       .Child("Credit")

       .OnceAsync<Model_Class>();
     return (allPersons.Where(a => a.Credit == typ & Convert.ToDateTime(a.Credit_Date) >= fdate & Convert.ToDateTime(a.Credit_Date) <= tdate)).ToList();
 }
</code>```

Here I called the method and fetch the list into datagridview

```<code>
            string type = comboBox1.Text;
            string fromdate = dateTimePicker1.Text;
            string todate = dateTimePicker2.Text;

            var clist = await helper.GetcreditTrans(type,Convert.ToDateTime(fromdate),Convert.ToDateTime(todate));
           dataGridView1.DataSource = clist;

</code>```

After this from the result I want to add the credit amount values

How to do?

Body:
I have fetched a values into C# windows forms data grid view from firebase real time database.

In the above image I displayed only the filtered rows, from that filtered rows I only want to get the values of credit_Amount Column values. And I want to sum the values.

This code to get all values.

 public async Task<List<Model_Class>> GetAllCredit()
 {
     return (await Firebase.Child("Credit").OnceAsync<Model_Class>()).Select(item => new Model_Class
     {
         Credit = item.Object.Credit,
         Credit_Amount = item.Object.Credit_Amount,
         Credit_Date = item.Object.Credit_Date,
         Credit_Remark = item.Object.Credit_Remark

     }).ToList();
 }

Here I filterd

 public async Task<List<Model_Class>> GetcreditTrans(string typ,DateTime fdate,DateTime tdate)
 {
     var allPersons = await GetAllCredit();
     await Firebase
       .Child("Credit")

       .OnceAsync<Model_Class>();
     return (allPersons.Where(a => a.Credit == typ & Convert.ToDateTime(a.Credit_Date) >= fdate & Convert.ToDateTime(a.Credit_Date) <= tdate)).ToList();
 }

Here I called the method and fetch the list into datagridview

            string type = comboBox1.Text;
            string fromdate = dateTimePicker1.Text;
            string todate = dateTimePicker2.Text;

            var clist = await helper.GetcreditTrans(type,Convert.ToDateTime(fromdate),Convert.ToDateTime(todate));
           dataGridView1.DataSource = clist;

After this from the result I want to add the credit amount values

How to do?


问:
function that does not exist using Node.js
Hello I wanted to be able to use a c code with electron, so I used node api except that when I call the function described in my C code, I get the following error:

```<code>TypeError: server is not a function
    at Object.<anonymous> (C:\Users\cantr\Desktop\Stage ingénieur KOMILFO SPORT\Sail Vision\Test backend\index.js:3:13)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47

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

I can't figure out where this is coming from since my code was working before I got this error.

Here is my code:

index.js :

const server = require("./build/Release/server");

console.log(server(12))

server.c :

```<code>#include<node_api.h>

napi_value Server(napi_env env, napi_callback_info info){
    size_t argc=1;
    napi_value args[1];
    int64_t upper_limit;
    int64_t largest_prime;
    napi_value output;

    napi_get_cb_info(env,info,&argc,args,NULL,NULL);

    napi_get_value_int64(env,args[0],&upper_limit);
    largest_prime=upper_limit;
    napi_create_double(env,largest_prime,&output);
    return output;
}

napi_value init(napi_env env, napi_value exports)
{
    napi_value server;
    napi_create_function(env,NULL,0,Server,NULL,&server);

    napi_set_named_property(env, exports, "Server",server);

    return exports;
}

NAPI_MODULE(NODE_GYP_MODULE_NAME,init);
</code>```

binding.gyp :

```<code>{
    "variables": {
        "openssl_fips" : "0"
    },
    "targets":[
        {
            "target_name":"server",
            "sources":[
                "server.c"
            ]
        }
    ]
}
</code>```

Body:
Hello I wanted to be able to use a c code with electron, so I used node api except that when I call the function described in my C code, I get the following error:

TypeError: server is not a function
    at Object.<anonymous> (C:\Users\cantr\Desktop\Stage ingénieur KOMILFO SPORT\Sail Vision\Test backend\index.js:3:13)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47

Node.js v18.12.0

I can't figure out where this is coming from since my code was working before I got this error.

Here is my code:

index.js :

const server = require("./build/Release/server");

console.log(server(12))

server.c :

#include<node_api.h>

napi_value Server(napi_env env, napi_callback_info info){
    size_t argc=1;
    napi_value args[1];
    int64_t upper_limit;
    int64_t largest_prime;
    napi_value output;

    napi_get_cb_info(env,info,&argc,args,NULL,NULL);

    napi_get_value_int64(env,args[0],&upper_limit);
    largest_prime=upper_limit;
    napi_create_double(env,largest_prime,&output);
    return output;
}

napi_value init(napi_env env, napi_value exports)
{
    napi_value server;
    napi_create_function(env,NULL,0,Server,NULL,&server);

    napi_set_named_property(env, exports, "Server",server);

    return exports;
}

NAPI_MODULE(NODE_GYP_MODULE_NAME,init);

binding.gyp :

{
    "variables": {
        "openssl_fips" : "0"
    },
    "targets":[
        {
            "target_name":"server",
            "sources":[
                "server.c"
            ]
        }
    ]
}


问:
Not all privileges or groups referenced are assigned to the caller
I'm trying to install Microsoft Visual Studio Installer Project in my Visual Studio Enterprise 2022, using Manage Extension. I'm getting this below error.

```<code>22-12-2022 19:56:44 - Microsoft VSIX Installer
22-12-2022 19:56:44 - -------------------------------------------
22-12-2022 19:56:44 - vsixinstaller.exe version:
22-12-2022 19:56:44 - 17.4.2119
22-12-2022 19:56:44 - -------------------------------------------
22-12-2022 19:56:44 - Command line parameters:
22-12-2022 19:56:44 - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\vsixinstaller.exe,/appidinstallpath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exe,/skuName:Enterprise,/skuVersion:17.4.33122.133,/appidname:Microsoft Visual Studio Enterprise 2022,/culture:en-US,/noep,C:\Users\kkabh\AppData\Local\Temp\VSIXzfphzvnr.vsix,/callingprocessid:19328,/installas:2568
22-12-2022 19:56:44 - -------------------------------------------
22-12-2022 19:56:44 - Microsoft VSIX Installer
22-12-2022 19:56:44 - -------------------------------------------
22-12-2022 19:56:44 - System.ComponentModel.Win32Exception (0x80004005): Not all privileges or groups referenced are assigned to the caller
   at System.Diagnostics.Process.SetPrivilege(String privilegeName, Int32 attrib)
   at System.Diagnostics.Process.EnterDebugMode()
   at VSIXInstaller.UserImpersonationHelper.DuplicateSuppliedToken(IntPtr token, UInt32 callingProcessId)
   at VSIXInstaller.App.Initialize(Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
</code>```

I tried downloading the extension from Marketplace and now getting a different error, as below.

```<code>22-12-2022 19:48:47 - Microsoft VSIX Installer
22-12-2022 19:48:47 - -------------------------------------------
22-12-2022 19:48:47 - vsixinstaller.exe version:
22-12-2022 19:48:47 - 17.4.2119
22-12-2022 19:48:47 - -------------------------------------------
22-12-2022 19:48:47 - Command line parameters:
22-12-2022 19:48:47 - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe,C:\Users\kkabh\Downloads\InstallerProjects.vsix
22-12-2022 19:48:47 - -------------------------------------------
22-12-2022 19:48:47 - Microsoft VSIX Installer
22-12-2022 19:48:47 - -------------------------------------------
22-12-2022 19:48:47 - Initializing Install...
22-12-2022 19:48:48 - Extension Details...
22-12-2022 19:48:48 -   Identifier         : VSInstallerProjects
22-12-2022 19:48:48 -   Name               : Microsoft Visual Studio Installer Projects
22-12-2022 19:48:48 -   Author             : Microsoft
22-12-2022 19:48:48 -   Version            : 1.0.2
22-12-2022 19:48:48 -   Description        : This official Microsoft extension provides support for Visual Studio Installer Projects in Visual Studio.
22-12-2022 19:48:48 -   Locale             : en-US
22-12-2022 19:48:48 -   MoreInfoURL        :
22-12-2022 19:48:48 -   InstalledByMSI     : False
22-12-2022 19:48:48 -   SupportedFrameworkVersionRange : [4.6.1,)
22-12-2022 19:48:48 -
22-12-2022 19:48:48 -   SignatureState     : ValidSignature
22-12-2022 19:48:48 -   SignedBy           : Microsoft Corporation
22-12-2022 19:48:48 -   Certificate Info   :
22-12-2022 19:48:48 -       -------------------------------------------------------
22-12-2022 19:48:48 -       [Subject]       : CN=Microsoft Corporation, OU=OPC, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
22-12-2022 19:48:48 -       [Issuer]        : CN=Microsoft Code Signing PCA 2010, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
22-12-2022 19:48:48 -       [Serial Number] : 3300000463CA7009C09247FA42000000000463
22-12-2022 19:48:48 -       [Not Before]    : 02-09-2021 23:56:31
22-12-2022 19:48:48 -       [Not After]     : 01-09-2022 23:56:31
22-12-2022 19:48:48 -       [Thumbprint]    : 909438EC2298CCB370EEAF0453E440A8DCBBC166
22-12-2022 19:48:48 -
22-12-2022 19:48:48 -   Supported Products :
22-12-2022 19:48:48 -       Microsoft.VisualStudio.Community
22-12-2022 19:48:48 -           Version : [15.0,17.0)
22-12-2022 19:48:48 -           ProductArchitecture : x86
22-12-2022 19:48:48 -
22-12-2022 19:48:48 -   References         :
22-12-2022 19:48:48 -   Prerequisites      :
22-12-2022 19:48:48 -       -------------------------------------------------------
22-12-2022 19:48:48 -       Identifier   : Microsoft.VisualStudio.MinShell
22-12-2022 19:48:48 -       Name         : Visual Studio Min Shell
22-12-2022 19:48:48 -       Version      : [15.0.26205,17.0)
22-12-2022 19:48:48 -
22-12-2022 19:48:48 -       -------------------------------------------------------
22-12-2022 19:48:48 -       Identifier   : Microsoft.Component.ClickOnce
22-12-2022 19:48:48 -       Name         : ClickOnce Publishing
22-12-2022 19:48:48 -       Version      : [15.0,17.0)
22-12-2022 19:48:48 -
22-12-2022 19:48:48 - Signature Details...
22-12-2022 19:48:48 -   Extension is signed with a valid signature.
22-12-2022 19:48:48 -
22-12-2022 19:48:48 - Searching for applicable products...
22-12-2022 19:48:48 - Found installed product - Global Location
22-12-2022 19:48:48 - Found installed product - Visual Studio Enterprise 2022
22-12-2022 19:48:48 - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
   at VSIXInstaller.ExtensionService.GetInstallableDataImpl(IInstallableExtension extension, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   at VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   at VSIXInstaller.ExtensionPackService.IsExtensionPack(IStateData stateData, Boolean isRepairSupported)
   at VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize(Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
</code>```

I actually need to generate an installation package. For that I tried this. If there are any option for generating the installation package, please let me know.

But still, it may be needed to download some other extension seems.
I actually tried some other extension, downloaded using Manage Extension, but result was negative.
Please help me out of this!!!

Body:
I'm trying to install Microsoft Visual Studio Installer Project in my Visual Studio Enterprise 2022, using Manage Extension. I'm getting this below error.

22-12-2022 19:56:44 - Microsoft VSIX Installer
22-12-2022 19:56:44 - -------------------------------------------
22-12-2022 19:56:44 - vsixinstaller.exe version:
22-12-2022 19:56:44 - 17.4.2119
22-12-2022 19:56:44 - -------------------------------------------
22-12-2022 19:56:44 - Command line parameters:
22-12-2022 19:56:44 - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\vsixinstaller.exe,/appidinstallpath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exe,/skuName:Enterprise,/skuVersion:17.4.33122.133,/appidname:Microsoft Visual Studio Enterprise 2022,/culture:en-US,/noep,C:\Users\kkabh\AppData\Local\Temp\VSIXzfphzvnr.vsix,/callingprocessid:19328,/installas:2568
22-12-2022 19:56:44 - -------------------------------------------
22-12-2022 19:56:44 - Microsoft VSIX Installer
22-12-2022 19:56:44 - -------------------------------------------
22-12-2022 19:56:44 - System.ComponentModel.Win32Exception (0x80004005): Not all privileges or groups referenced are assigned to the caller
   at System.Diagnostics.Process.SetPrivilege(String privilegeName, Int32 attrib)
   at System.Diagnostics.Process.EnterDebugMode()
   at VSIXInstaller.UserImpersonationHelper.DuplicateSuppliedToken(IntPtr token, UInt32 callingProcessId)
   at VSIXInstaller.App.Initialize(Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

I tried downloading the extension from Marketplace and now getting a different error, as below.

22-12-2022 19:48:47 - Microsoft VSIX Installer
22-12-2022 19:48:47 - -------------------------------------------
22-12-2022 19:48:47 - vsixinstaller.exe version:
22-12-2022 19:48:47 - 17.4.2119
22-12-2022 19:48:47 - -------------------------------------------
22-12-2022 19:48:47 - Command line parameters:
22-12-2022 19:48:47 - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe,C:\Users\kkabh\Downloads\InstallerProjects.vsix
22-12-2022 19:48:47 - -------------------------------------------
22-12-2022 19:48:47 - Microsoft VSIX Installer
22-12-2022 19:48:47 - -------------------------------------------
22-12-2022 19:48:47 - Initializing Install...
22-12-2022 19:48:48 - Extension Details...
22-12-2022 19:48:48 -   Identifier         : VSInstallerProjects
22-12-2022 19:48:48 -   Name               : Microsoft Visual Studio Installer Projects
22-12-2022 19:48:48 -   Author             : Microsoft
22-12-2022 19:48:48 -   Version            : 1.0.2
22-12-2022 19:48:48 -   Description        : This official Microsoft extension provides support for Visual Studio Installer Projects in Visual Studio.
22-12-2022 19:48:48 -   Locale             : en-US
22-12-2022 19:48:48 -   MoreInfoURL        :
22-12-2022 19:48:48 -   InstalledByMSI     : False
22-12-2022 19:48:48 -   SupportedFrameworkVersionRange : [4.6.1,)
22-12-2022 19:48:48 -
22-12-2022 19:48:48 -   SignatureState     : ValidSignature
22-12-2022 19:48:48 -   SignedBy           : Microsoft Corporation
22-12-2022 19:48:48 -   Certificate Info   :
22-12-2022 19:48:48 -       -------------------------------------------------------
22-12-2022 19:48:48 -       [Subject]       : CN=Microsoft Corporation, OU=OPC, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
22-12-2022 19:48:48 -       [Issuer]        : CN=Microsoft Code Signing PCA 2010, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
22-12-2022 19:48:48 -       [Serial Number] : 3300000463CA7009C09247FA42000000000463
22-12-2022 19:48:48 -       [Not Before]    : 02-09-2021 23:56:31
22-12-2022 19:48:48 -       [Not After]     : 01-09-2022 23:56:31
22-12-2022 19:48:48 -       [Thumbprint]    : 909438EC2298CCB370EEAF0453E440A8DCBBC166
22-12-2022 19:48:48 -
22-12-2022 19:48:48 -   Supported Products :
22-12-2022 19:48:48 -       Microsoft.VisualStudio.Community
22-12-2022 19:48:48 -           Version : [15.0,17.0)
22-12-2022 19:48:48 -           ProductArchitecture : x86
22-12-2022 19:48:48 -
22-12-2022 19:48:48 -   References         :
22-12-2022 19:48:48 -   Prerequisites      :
22-12-2022 19:48:48 -       -------------------------------------------------------
22-12-2022 19:48:48 -       Identifier   : Microsoft.VisualStudio.MinShell
22-12-2022 19:48:48 -       Name         : Visual Studio Min Shell
22-12-2022 19:48:48 -       Version      : [15.0.26205,17.0)
22-12-2022 19:48:48 -
22-12-2022 19:48:48 -       -------------------------------------------------------
22-12-2022 19:48:48 -       Identifier   : Microsoft.Component.ClickOnce
22-12-2022 19:48:48 -       Name         : ClickOnce Publishing
22-12-2022 19:48:48 -       Version      : [15.0,17.0)
22-12-2022 19:48:48 -
22-12-2022 19:48:48 - Signature Details...
22-12-2022 19:48:48 -   Extension is signed with a valid signature.
22-12-2022 19:48:48 -
22-12-2022 19:48:48 - Searching for applicable products...
22-12-2022 19:48:48 - Found installed product - Global Location
22-12-2022 19:48:48 - Found installed product - Visual Studio Enterprise 2022
22-12-2022 19:48:48 - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
   at VSIXInstaller.ExtensionService.GetInstallableDataImpl(IInstallableExtension extension, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   at VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable`1& skuData)
   at VSIXInstaller.ExtensionPackService.IsExtensionPack(IStateData stateData, Boolean isRepairSupported)
   at VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize(Boolean isRepairSupported)
   at VSIXInstaller.App.Initialize()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()

I actually need to generate an installation package. For that I tried this. If there are any option for generating the installation package, please let me know.

But still, it may be needed to download some other extension seems.
I actually tried some other extension, downloaded using Manage Extension, but result was negative.
Please help me out of this!!!


问:
UI test using VS2019
I recently installed visual studio 2019 community edition. I see that it does not have Coded UI test feature

How can i automate a program? any ideas?

I need to open an application created with .net , fill the form and save
thanks

Title: UI test using VS2019