问:
C# OpenGL Window is Lagging
I'm having a problem: When I create a window in OpenGL, using C#, my window starts to lag, and I cannot use the window (I cannot close, minimize, resize, etc.). And when I hover my mouse inside the window, my cursor becomes that blue wheel, meaning it's lagging. How can I fix it?

It's worth saying that I'm using OpenGL and OpenTK to display and use the window however I want.

This is my code for generating the window:

First, this is the “GameLoop” class, everything related to the game itself is derived from this class, it contains some abstract classes that I can override, so it's really useful.

```<code>public abstract class GameLoop
{
    public GameWindow window;
    public Vector2Int windowSize = new Vector2Int(1280, 768);

    public void Run()
    {
        OnInitialize();

        WindowManager.CreateWindow(windowSize.x, windowSize.y, "Engine", out window);

        OnLoad();

        while (WindowManager.IsRunning)
        {
            OnUpdate();
            OnRender();
        }

        OnCloseWindow();
    }

    protected abstract void OnInitialize();
    protected abstract void OnLoad();
    protected abstract void OnUpdate();
    protected abstract void OnRender();
    protected abstract void OnCloseWindow();
}

class RunGameLoop
{
    static void Main()
    {
        GameLoop loop = new EngineWindow();
        loop.Run();
    }
}
</code>```

Secondly, I have this method in another class that is responsible for creating the window itself:

```<code>public static void CreateWindow(int width, int height, string title, out GameWindow window)
{
    window = new GameWindow(GameWindowSettings.Default, NativeWindowSettings.Default);

    Vector2Int res = new Vector2Int(width, height);
    //windowSize = res;

    IsRunning = true;

    window.CenterWindow(Vector2Int.ToVec2i(res));
    window.Title = title;
}
</code>```

And finally, I have the main class, where I can use OpenGL and make my project:

```<code>public class EngineWindow : GameLoop
{
    protected override void OnInitialize()
    {
        Debug.WriteLine("On Initialize");
    }

    protected override void OnLoad()
    {
        GL.Enable(EnableCap.DepthTest);
        GL.Enable(EnableCap.Lighting);

        GL.ClearColor(Color.ToColor4(BackColor));

        GL.Viewport(0, 0, windowSize.x, windowSize.y);

        CreateMesh(cubeMesh);
    }

    protected override void OnUpdate()
    {

    }

    protected override void OnRender()
    {
        GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

        angle += Time.deltaTime;

        SetupViewport(sceneCamera);
        RenderMesh(cubeMesh);

        ControllCamera(sceneCamera);

        GL.CullFace(CullFaceMode.Back);

        GL.Finish();

        window.SwapBuffers();
    }

    protected override void OnCloseWindow()
    {
        Debug.WriteLine("Ended");
        // Clean up
        GL.DeleteProgram(program);
        GL.DeleteBuffers(1, ref vbo);
        GL.DeleteVertexArrays(1, ref vao);
    }
}
</code>```

But, the issue is that when the window is created, it starts up fine, but becomes extremely laggy and I can't use the window.

What might be the issue, and how can I fix it?

Title: C# OpenGL Window is Lagging

Body:
I'm having a problem: When I create a window in OpenGL, using C#, my window starts to lag, and I cannot use the window (I cannot close, minimize, resize, etc.). And when I hover my mouse inside the window, my cursor becomes that blue wheel, meaning it's lagging. How can I fix it?

It's worth saying that I'm using OpenGL and OpenTK to display and use the window however I want.

This is my code for generating the window:

First, this is the “GameLoop” class, everything related to the game itself is derived from this class, it contains some abstract classes that I can override, so it's really useful.

public abstract class GameLoop
{
    public GameWindow window;
    public Vector2Int windowSize = new Vector2Int(1280, 768);

    public void Run()
    {
        OnInitialize();

        WindowManager.CreateWindow(windowSize.x, windowSize.y, "Engine", out window);

        OnLoad();

        while (WindowManager.IsRunning)
        {
            OnUpdate();
            OnRender();
        }

        OnCloseWindow();
    }

    protected abstract void OnInitialize();
    protected abstract void OnLoad();
    protected abstract void OnUpdate();
    protected abstract void OnRender();
    protected abstract void OnCloseWindow();
}

class RunGameLoop
{
    static void Main()
    {
        GameLoop loop = new EngineWindow();
        loop.Run();
    }
}

Secondly, I have this method in another class that is responsible for creating the window itself:

public static void CreateWindow(int width, int height, string title, out GameWindow window)
{
    window = new GameWindow(GameWindowSettings.Default, NativeWindowSettings.Default);

    Vector2Int res = new Vector2Int(width, height);
    //windowSize = res;

    IsRunning = true;

    window.CenterWindow(Vector2Int.ToVec2i(res));
    window.Title = title;
}

And finally, I have the main class, where I can use OpenGL and make my project:

public class EngineWindow : GameLoop
{
    protected override void OnInitialize()
    {
        Debug.WriteLine("On Initialize");
    }

    protected override void OnLoad()
    {
        GL.Enable(EnableCap.DepthTest);
        GL.Enable(EnableCap.Lighting);

        GL.ClearColor(Color.ToColor4(BackColor));

        GL.Viewport(0, 0, windowSize.x, windowSize.y);

        CreateMesh(cubeMesh);
    }

    protected override void OnUpdate()
    {

    }

    protected override void OnRender()
    {
        GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

        angle += Time.deltaTime;

        SetupViewport(sceneCamera);
        RenderMesh(cubeMesh);

        ControllCamera(sceneCamera);

        GL.CullFace(CullFaceMode.Back);

        GL.Finish();

        window.SwapBuffers();
    }

    protected override void OnCloseWindow()
    {
        Debug.WriteLine("Ended");
        // Clean up
        GL.DeleteProgram(program);
        GL.DeleteBuffers(1, ref vbo);
        GL.DeleteVertexArrays(1, ref vao);
    }
}

But, the issue is that when the window is created, it starts up fine, but becomes extremely laggy and I can't use the window.

What might be the issue, and how can I fix it?


来源: stackexchange

问:
How can I copy and apply my region settings for new users with a powershell script?
I've adjusted my Region settings and I can have my list separator selected as pipeline, but how do I apply this to new login users?

```<code>Set-ItemProperty -Path 'HKCU:\\Control Panel\\International' -Name sList -Value '|'
</code>```

this works fine and affects the logged in user but it doesn't affect new users.

Actually, my only purpose is to copy the settings in the administrative tab in the region section and tick the new users option.

ContentLicense: CC BY-SA 4.0

Body:
I've adjusted my Region settings and I can have my list separator selected as pipeline, but how do I apply this to new login users?

Set-ItemProperty -Path 'HKCU:\\Control Panel\\International' -Name sList -Value '|'

this works fine and affects the logged in user but it doesn't affect new users.

Actually, my only purpose is to copy the settings in the administrative tab in the region section and tick the new users option.


问:
How to implement @PATCH method (REST) in Quarkus
I want to implement a REST-Method (@PATCH) to update some fields of an entity and took this documentation as reference: https://docs.jboss.org/resteasy/docs/4.6.0.Final/userguide/html_single/index.html#d4e1781

But I always get the response 400 (bad request)

My steps to create a sample application:

loaded a starter project from quarkus.io (quarkus version 2.15.3.Final) with dependency to 'quarkus-resteasy-reactive-jackson'

added a class 'User'

```<code>package org.acme;

import java.util.Objects;

public class User {

  Integer id;
  String firstName;
  String lastName;

  public Integer getId() {return id;}
  public void setId(Integer id) {this.id = id;}
  public String getFirstName() {return firstName;}
  public void setFirstName(String firstName) {this.firstName = firstName;}
  public String getLastName() {return lastName;}
  public void setLastName(String lastName) {this.lastName = lastName;}

  @Override
  public String toString() {
    return String.format("User [ id: %d ]", Objects.requireNonNullElse(id, -1));
  }
}
</code>```

changed 'GreetingsResource.java' to this:

```<code>package org.acme;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PATCH;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jboss.resteasy.reactive.RestPath;

@Path("/user")
public class GreetingResource {

    @GET
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/{id}")
    public User getUser(Integer id) {
      User user = new User();
      user.id = 1;
      user.firstName = "John";
      user.lastName = "Doe";

      // return Response.noContent();
      return user;
    }

    @PATCH
    @Path("/{id}")
    @Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public User patchUser(@RestPath("id") Integer id, User user) {
      return user;
    }
}
</code>```

fetched User data from the get endpoint using SoapUI, everything works as expected

```<code>GET http://localhost:8080/user/1 HTTP/1.1
Accept-Encoding: gzip,deflate
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.5 (Java/16.0.1)
</code>```

Try to patch the user (using SoapUI), got response code of 400 (Bad Request)

```<code>PATCH http://localhost:8080/user/1 HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/json-patch+json
Content-Length: 53
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.5 (Java/16.0.1)

[{"op":"replace","path":"/lastName","value":"Smith"}]
</code>```
```<code>HTTP/1.1 400 Bad Request
Content-Type: application/json
content-length: 0
</code>```

After changing the log level to 'debug' I see the following error:

```<code>2023-01-13 12:45:57,049 DEBUG [org.jbo.res.rea.ser.han.RequestDeserializeHandler] (executor-thread-0) Error occurred during deserialization of input: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `org.acme.User` from Array value (token `JsonToken.START_ARRAY`)
 at [Source: (org.jboss.resteasy.reactive.server.vertx.VertxInputStream); line: 1, column: 1]
</code>```

So for me it looks like the application awaits a document describing a User and no patch request like I sent. But as far I understand the documentation, mentioned at the beginning of this post, the framework should automatically patch the existing user with the patch from the request. The input parameter of the @PATCH method should then hold the User instance that is already patched.

Any ideas or hints what I'm doing wrong? Do I expect things that will not work this way?

In case this is important: I'm running the application on a Windows host using this Java version:

```<code>$ java --version
openjdk 17.0.2 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
</code>```

Many thanks!

Body:
I want to implement a REST-Method (@PATCH) to update some fields of an entity and took this documentation as reference: https://docs.jboss.org/resteasy/docs/4.6.0.Final/userguide/html_single/index.html#d4e1781

But I always get the response 400 (bad request)

My steps to create a sample application:

loaded a starter project from quarkus.io (quarkus version 2.15.3.Final) with dependency to 'quarkus-resteasy-reactive-jackson'

added a class 'User'

package org.acme;

import java.util.Objects;

public class User {

  Integer id;
  String firstName;
  String lastName;

  public Integer getId() {return id;}
  public void setId(Integer id) {this.id = id;}
  public String getFirstName() {return firstName;}
  public void setFirstName(String firstName) {this.firstName = firstName;}
  public String getLastName() {return lastName;}
  public void setLastName(String lastName) {this.lastName = lastName;}

  @Override
  public String toString() {
    return String.format("User [ id: %d ]", Objects.requireNonNullElse(id, -1));
  }
}

changed 'GreetingsResource.java' to this:

package org.acme;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PATCH;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.jboss.resteasy.reactive.RestPath;

@Path("/user")
public class GreetingResource {

    @GET
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/{id}")
    public User getUser(Integer id) {
      User user = new User();
      user.id = 1;
      user.firstName = "John";
      user.lastName = "Doe";

      // return Response.noContent();
      return user;
    }

    @PATCH
    @Path("/{id}")
    @Consumes(MediaType.APPLICATION_JSON_PATCH_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public User patchUser(@RestPath("id") Integer id, User user) {
      return user;
    }
}

fetched User data from the get endpoint using SoapUI, everything works as expected

GET http://localhost:8080/user/1 HTTP/1.1
Accept-Encoding: gzip,deflate
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.5 (Java/16.0.1)

Try to patch the user (using SoapUI), got response code of 400 (Bad Request)

PATCH http://localhost:8080/user/1 HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: application/json-patch+json
Content-Length: 53
Host: localhost:8080
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.5 (Java/16.0.1)

[{"op":"replace","path":"/lastName","value":"Smith"}]

HTTP/1.1 400 Bad Request
Content-Type: application/json
content-length: 0

After changing the log level to 'debug' I see the following error:

2023-01-13 12:45:57,049 DEBUG [org.jbo.res.rea.ser.han.RequestDeserializeHandler] (executor-thread-0) Error occurred during deserialization of input: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `org.acme.User` from Array value (token `JsonToken.START_ARRAY`)
 at [Source: (org.jboss.resteasy.reactive.server.vertx.VertxInputStream); line: 1, column: 1]

So for me it looks like the application awaits a document describing a User and no patch request like I sent. But as far I understand the documentation, mentioned at the beginning of this post, the framework should automatically patch the existing user with the patch from the request. The input parameter of the @PATCH method should then hold the User instance that is already patched.

Any ideas or hints what I'm doing wrong? Do I expect things that will not work this way?

In case this is important: I'm running the application on a Windows host using this Java version:

$ java --version
openjdk 17.0.2 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)

Many thanks!


问:
ReactNative HTMLButtonElement gives error at emulator
I have the following code:

```<code>import React from 'react';
import {StyleSheet, View} from 'react-native';

interface MyButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
  dataCode: string;
}
class MyButton extends React.Component<
  MyButtonProps & React.HTMLProps<HTMLButtonElement>,
  {}
> {
  render() {
    return <button {...this.props} />;
  }
}

const App = () => {
  const _onPressButton = (event: any) => {
    let params: string = (event.currentTarget as MyButton).props.dataCode;
    fetch(`http://10.18.1.19/switch?${params}`);
  };

  return (
    <View style={styles.container}>
      <View style={styles.buttonContainer}>
        <MyButton
          dataCode="binary=111111111111111111111111&protocol=1&pulselength=3"
          onClick={_onPressButton}
          title="Test"
        />
      </View>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
  },
  buttonContainer: {
    margin: 20,
  },
});

export default App;
</code>```

and I have error message when I use button ws. Button.

ReactNativeJS: Invariant Violation: View config getter callback for
component button must be a function (received undefined). Make
sure to start component names with a capital letter.

How can I extend a HTML button element?

Body:
I have the following code:

import React from 'react';
import {StyleSheet, View} from 'react-native';

interface MyButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
  dataCode: string;
}
class MyButton extends React.Component<
  MyButtonProps & React.HTMLProps<HTMLButtonElement>,
  {}
> {
  render() {
    return <button {...this.props} />;
  }
}

const App = () => {
  const _onPressButton = (event: any) => {
    let params: string = (event.currentTarget as MyButton).props.dataCode;
    fetch(`http://10.18.1.19/switch?${params}`);
  };

  return (
    <View style={styles.container}>
      <View style={styles.buttonContainer}>
        <MyButton
          dataCode="binary=111111111111111111111111&protocol=1&pulselength=3"
          onClick={_onPressButton}
          title="Test"
        />
      </View>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
  },
  buttonContainer: {
    margin: 20,
  },
});

export default App;

and I have error message when I use button ws. Button.

ReactNativeJS: Invariant Violation: View config getter callback for
component button must be a function (received undefined). Make
sure to start component names with a capital letter.

How can I extend a HTML button element?


问:
Was a connection established on No such host is known - System.Net.Sockets.SocketException?
We are experiencing the following error on our hosted app services in Azure when we create outbound connections.

No such host is known - System.Net.Sockets.SocketException?

The connection issues does not happen all the time but only occationally.
In addition it is not related to a specific url but can happen on any urls, meaning that the issue happens when making an outbound connection to any systems.

For this we are considering implementing a retry mechanism when the error occurs, but we want to know:

Has a request been made when the error is thrown or has nothing been sent yet?.

We want to avoid sending the same requests multiple times such that it triggers the same operation more than once.

If no connection is established when the error occurs, then we assume it is safe to retry?

We have tried to reproduce the error but since it happens randomly, we were unable to get any helpful results. This is why we were thinking of a retry mechanism to mitigate the issue, but it would be great to know why the error even occurs!

Please let us know what you think!


问:
Hunspell installing through pip showing error
I get this error when I try to install hunspell. I have tried all the suggestions on stackoverflow including:

pip install cyhunspell

Installing Viusal Studio Build tools withh MSVC v143 and Windows 11 sdk.

downloaded hunspell from ezwinports and added bin to path.
and many other suggestion online but nothing seems to work.
I have windows 10 and I am using Python 3.10.9, pip 22.3.1

```<code>C:\Users\abhim>pip install hunspell
Collecting hunspell
  Using cached hunspell-0.5.5.tar.gz (34 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: hunspell
  Building wheel for hunspell (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'hunspell' extension
      creating build
      creating build\temp.win-amd64-cpython-310
      creating build\temp.win-amd64-cpython-310\Release
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DHUNSPELL_STATIC -IV:/hunspell-1.3.3/src/hunspell -IC:\Users\abhim\AppData\Local\Programs\Python\Python310\include -IC:\Users\abhim\AppData\Local\Programs\Python\Python310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tphunspell.cpp /Fobuild\temp.win-amd64-cpython-310\Release\hunspell.obj /MT
      cl : Command line warning D9025 : overriding '/MD' with '/MT'
      hunspell.cpp
      hunspell.cpp(20): fatal error C1083: Cannot open include file: 'hunspell.hxx': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for hunspell
  Running setup.py clean for hunspell
Failed to build hunspell
Installing collected packages: hunspell
  Running setup.py install for hunspell ... error
  error: subprocess-exited-with-error

  × Running setup.py install for hunspell did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running install
      C:\Users\abhim\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'hunspell' extension
      creating build
      creating build\temp.win-amd64-cpython-310
      creating build\temp.win-amd64-cpython-310\Release
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DHUNSPELL_STATIC -IV:/hunspell-1.3.3/src/hunspell -IC:\Users\abhim\AppData\Local\Programs\Python\Python310\include -IC:\Users\abhim\AppData\Local\Programs\Python\Python310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tphunspell.cpp /Fobuild\temp.win-amd64-cpython-310\Release\hunspell.obj /MT
      cl : Command line warning D9025 : overriding '/MD' with '/MT'
      hunspell.cpp
      hunspell.cpp(20): fatal error C1083: Cannot open include file: 'hunspell.hxx': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> hunspell

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
</code>```

Body:
I get this error when I try to install hunspell. I have tried all the suggestions on stackoverflow including:

pip install cyhunspell

Installing Viusal Studio Build tools withh MSVC v143 and Windows 11 sdk.

downloaded hunspell from ezwinports and added bin to path.
and many other suggestion online but nothing seems to work.
I have windows 10 and I am using Python 3.10.9, pip 22.3.1

C:\Users\abhim>pip install hunspell
Collecting hunspell
  Using cached hunspell-0.5.5.tar.gz (34 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: hunspell
  Building wheel for hunspell (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'hunspell' extension
      creating build
      creating build\temp.win-amd64-cpython-310
      creating build\temp.win-amd64-cpython-310\Release
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DHUNSPELL_STATIC -IV:/hunspell-1.3.3/src/hunspell -IC:\Users\abhim\AppData\Local\Programs\Python\Python310\include -IC:\Users\abhim\AppData\Local\Programs\Python\Python310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tphunspell.cpp /Fobuild\temp.win-amd64-cpython-310\Release\hunspell.obj /MT
      cl : Command line warning D9025 : overriding '/MD' with '/MT'
      hunspell.cpp
      hunspell.cpp(20): fatal error C1083: Cannot open include file: 'hunspell.hxx': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for hunspell
  Running setup.py clean for hunspell
Failed to build hunspell
Installing collected packages: hunspell
  Running setup.py install for hunspell ... error
  error: subprocess-exited-with-error

  × Running setup.py install for hunspell did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running install
      C:\Users\abhim\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'hunspell' extension
      creating build
      creating build\temp.win-amd64-cpython-310
      creating build\temp.win-amd64-cpython-310\Release
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DHUNSPELL_STATIC -IV:/hunspell-1.3.3/src/hunspell -IC:\Users\abhim\AppData\Local\Programs\Python\Python310\include -IC:\Users\abhim\AppData\Local\Programs\Python\Python310\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tphunspell.cpp /Fobuild\temp.win-amd64-cpython-310\Release\hunspell.obj /MT
      cl : Command line warning D9025 : overriding '/MD' with '/MT'
      hunspell.cpp
      hunspell.cpp(20): fatal error C1083: Cannot open include file: 'hunspell.hxx': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> hunspell

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.


问:
Webpack sourcemap not working in google chrome elements sass
I have tried more than time for sass source-map but it's showing chrome elements only the main bundled file line number but where was the scss location of style is not showing. Below given the screenshot also my package.json and webpack.config.js.

If the below 2 screenshots not working this is the link: https://postimg.cc/gallery/dYc7GZX or click here

Image source map css in app.css, line number 242

Image from another source: click here

Image But actual style was _body.scss, line number 1

Image from another source: Click here

How to implement source map for showing the style coming from _body.scss line number 1?

webpack.config.js

```<code>const path = require('path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const FixStyleOnlyEntriesPlugin = require('webpack-fix-style-only-entries'); // fix js come output with css

module.exports = {
    watch: true,
    mode: 'development',
    // mode: 'production',

    entry: {
        // js
        'js/app': './js/app.js', // for entire site
        'js/woo': './js/woo.js', // for woo commerce

        // sass
        'css/app': './sass/app.scss', // for entire site
        'css/woo': './sass/woo.scss' // for woo commerce
    },

    output: {
        filename: '[name].js',
        path: path.resolve(__dirname, './../assets/')
    },

    module: {
        rules: [{
                test: /\.js$/,
                exclude: /(node_modules|bower_components)/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['@babel/preset-env'],
                        plugins: ['@babel/plugin-proposal-object-rest-spread']
                    }
                }
            },
            {
                test: /\.scss$/,
                use: [
                    {
                        loader: MiniCssExtractPlugin.loader
                    },
                    {
                        loader: 'css-loader',
                        options: {
                            sourceMap: false,
                        }
                    },
                    {
                        loader: 'sass-loader',
                        options: {
                            sourceMap: true,
                        }
                    },
                ]
            },
        ],
    },

    plugins: [
        new FixStyleOnlyEntriesPlugin(),
        new MiniCssExtractPlugin({
            filename: '[name].css',
            chunkFilename: '[id].css'
        }),

    ]
}
</code>```

package.json

```<code>{
  "name": "tws-master-pro",
  "version": "1.0.0",
  "description": "This is wordpress theme, It is for Tawakkulshop.com but, anyone can use it with the owner's permission with purchase or owner gift. It was built in 2022.",
  "main": "./webpack-entry.js",
  "scripts": {
    "build": "webpack"
  },
  "keywords": [
    "tawakkulshop wp theme",
    "tws master pro WordPress theme"
  ],
  "author": "Al Mamun",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.20.2",
    "@babel/preset-env": "^7.20.2",
    "babel-loader": "^9.1.0",
    "css-loader": "^6.7.2",
    "mini-css-extract-plugin": "^2.7.0",
    "sass": "^1.56.1",
    "sass-loader": "^13.2.0",
    "webpack": "^5.75.0",
    "webpack-cli": "^5.0.0",
    "webpack-fix-style-only-entries": "^0.6.1"
  },
  "dependencies": {}
}
</code>```

I just want to when debug/inspect with chrome how to show styles are coming from _body.scss file.

Body:
I have tried more than time for sass source-map but it's showing chrome elements only the main bundled file line number but where was the scss location of style is not showing. Below given the screenshot also my package.json and webpack.config.js.

If the below 2 screenshots not working this is the link: https://postimg.cc/gallery/dYc7GZX or click here

Image source map css in app.css, line number 242

Image from another source: click here

Image But actual style was _body.scss, line number 1

Image from another source: Click here

How to implement source map for showing the style coming from _body.scss line number 1?

webpack.config.js

const path = require('path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const FixStyleOnlyEntriesPlugin = require('webpack-fix-style-only-entries'); // fix js come output with css

module.exports = {
    watch: true,
    mode: 'development',
    // mode: 'production',

    entry: {
        // js
        'js/app': './js/app.js', // for entire site
        'js/woo': './js/woo.js', // for woo commerce

        // sass
        'css/app': './sass/app.scss', // for entire site
        'css/woo': './sass/woo.scss' // for woo commerce
    },

    output: {
        filename: '[name].js',
        path: path.resolve(__dirname, './../assets/')
    },

    module: {
        rules: [{
                test: /\.js$/,
                exclude: /(node_modules|bower_components)/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['@babel/preset-env'],
                        plugins: ['@babel/plugin-proposal-object-rest-spread']
                    }
                }
            },
            {
                test: /\.scss$/,
                use: [
                    {
                        loader: MiniCssExtractPlugin.loader
                    },
                    {
                        loader: 'css-loader',
                        options: {
                            sourceMap: false,
                        }
                    },
                    {
                        loader: 'sass-loader',
                        options: {
                            sourceMap: true,
                        }
                    },
                ]
            },
        ],
    },

    plugins: [
        new FixStyleOnlyEntriesPlugin(),
        new MiniCssExtractPlugin({
            filename: '[name].css',
            chunkFilename: '[id].css'
        }),

    ]
}

package.json

{
  "name": "tws-master-pro",
  "version": "1.0.0",
  "description": "This is wordpress theme, It is for Tawakkulshop.com but, anyone can use it with the owner's permission with purchase or owner gift. It was built in 2022.",
  "main": "./webpack-entry.js",
  "scripts": {
    "build": "webpack"
  },
  "keywords": [
    "tawakkulshop wp theme",
    "tws master pro WordPress theme"
  ],
  "author": "Al Mamun",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.20.2",
    "@babel/preset-env": "^7.20.2",
    "babel-loader": "^9.1.0",
    "css-loader": "^6.7.2",
    "mini-css-extract-plugin": "^2.7.0",
    "sass": "^1.56.1",
    "sass-loader": "^13.2.0",
    "webpack": "^5.75.0",
    "webpack-cli": "^5.0.0",
    "webpack-fix-style-only-entries": "^0.6.1"
  },
  "dependencies": {}
}

I just want to when debug/inspect with chrome how to show styles are coming from _body.scss file.


问:
input type file doesn't act independently for different children in a map in react js
I am iterating a list of file inputs in react through a map function

```<code>render() {
    const {
      form,
      loading,
      filledIndex,
    } = this.state;
    return (
</code>```

map function

```<code>{form.a &&
        form.a.map((prop, index) => (
</code>```

upload component

```<code><label
    htmlFor="proofDocUrl"
    className="save-form-btn-personal"
  >
    Upload
  </label>
  <input
    type="file"
    accept=".png,.jpg"
    id="proofDocUrl"
    name="proofDocUrl"
    onChange={(e) => this.handleChangeUpload(e, index)}
    onClick={(event) => {
      event.target.value = null;
    }}
/>
</code>```

handleChangeUpload function. send file to server and fetch url

```<code>  handleChangeUpload = async (e, index) => {
    if (e.target.files) {
      let formData = new FormData();
      formData.append("b", e.target.files[0]);
      this.setState({ loading: true });
      const form = { ...this.state.form };
      let documentUpload =
        await A_service.A_api(formData);
      if (documentUpload) {
        if (documentUpload.data && documentUpload.data.data) {
          documentUpload = documentUpload.data.data;
        }
        form.x[index][e.target.name] =
          documentUpload.parameter;

      }

      this.setState({ loading: false, form });
    }
  };
</code>```

states that are used. form state has x component which is iterated through a map.
proofDocUrl stores image url

```<code>  form: {
    x: [],
  },
  formLocal: {
    proofDocUrl: "",
  },
</code>```

when a new object is added to form.x state and when it creates a new child in render the file input acts as if its the same for all childeren.
when a image is uploaded in one file component in one child, same will be uploaded for all childern.

How to make each file component in each child acts independently.

Body:
I am iterating a list of file inputs in react through a map function

render() {
    const {
      form,
      loading,
      filledIndex,
    } = this.state;
    return (

map function

{form.a &&
        form.a.map((prop, index) => (

upload component

    Upload

  <input
    type="file"
    accept=".png,.jpg"
    id="proofDocUrl"
    name="proofDocUrl"
    onChange={(e) => this.handleChangeUpload(e, index)}
    onClick={(event) => {
      event.target.value = null;
    }}
/>

handleChangeUpload function. send file to server and fetch url

  handleChangeUpload = async (e, index) => {
    if (e.target.files) {
      let formData = new FormData();
      formData.append("b", e.target.files[0]);
      this.setState({ loading: true });
      const form = { ...this.state.form };
      let documentUpload =
        await A_service.A_api(formData);
      if (documentUpload) {
        if (documentUpload.data && documentUpload.data.data) {
          documentUpload = documentUpload.data.data;
        }
        form.x[index][e.target.name] =
          documentUpload.parameter;

      }

      this.setState({ loading: false, form });
    }
  };

states that are used. form state has x component which is iterated through a map.
proofDocUrl stores image url

  form: {
    x: [],
  },
  formLocal: {
    proofDocUrl: "",
  },

when a new object is added to form.x state and when it creates a new child in render the file input acts as if its the same for all childeren.
when a image is uploaded in one file component in one child, same will be uploaded for all childern.

How to make each file component in each child acts independently.


问:
Salesforce Rest API- Works on postman but using java expected statuscode - 200 but was 400
I am trying to insert an account in salesforce using rest api. So I have

Establish Connection class (to establish connection between my code and Salesforce using connected app)

CreateAccount class (actual POST request)

Test Case to invoke above classes.

```<code>//Create account class
public String InsertAccount(String relationtype, String FName, String LName, String recordtype, String branchname, String OFAC)
    {

        EstablishSFConnection EC = new EstablishSFConnection();
        String token=EC.establishConnection();

        Map<String,Object> mapper = new HashMap<String,Object>();
        mapper.put("SkienceFinSln__Record_Type__c", relationtype);
        mapper.put("FirstName", FName);
        mapper.put("LastName", LName);
        mapper.put("Type",recordtype);
        mapper.put("Branch_Name__c", branchname);
        mapper.put("OFAC_Address_Indicator__c", OFAC);

        JSONObject requester = new JSONObject(mapper);
        System.out.println("Relationship account to be created is :" +requester.toString());

        return
                given().
                contentType(ContentType.JSON).
                accept(ContentType.JSON).
                header("Authorization","Bearer "+token).
                header("Content-Type","application/json").
                body(requester.toString()).
                when().post("https://cwmfsc--cportal.sandbox.my.salesforce.com/services/data/v56.0/sobjects/Account/").
                then().statusCode(201).log().body().extract().path("id");

    }
</code>```

Body:
I am trying to insert an account in salesforce using rest api. So I have

Establish Connection class (to establish connection between my code and Salesforce using connected app)

CreateAccount class (actual POST request)

Test Case to invoke above classes.

//Create account class
public String InsertAccount(String relationtype, String FName, String LName, String recordtype, String branchname, String OFAC)
    {

        EstablishSFConnection EC = new EstablishSFConnection();
        String token=EC.establishConnection();

        Map<String,Object> mapper = new HashMap<String,Object>();
        mapper.put("SkienceFinSln__Record_Type__c", relationtype);
        mapper.put("FirstName", FName);
        mapper.put("LastName", LName);
        mapper.put("Type",recordtype);
        mapper.put("Branch_Name__c", branchname);
        mapper.put("OFAC_Address_Indicator__c", OFAC);

        JSONObject requester = new JSONObject(mapper);
        System.out.println("Relationship account to be created is :" +requester.toString());

        return
                given().
                contentType(ContentType.JSON).
                accept(ContentType.JSON).
                header("Authorization","Bearer "+token).
                header("Content-Type","application/json").
                body(requester.toString()).
                when().post("https://cwmfsc--cportal.sandbox.my.salesforce.com/services/data/v56.0/sobjects/Account/").
                then().statusCode(201).log().body().extract().path("id");

    }


问:
i am trying to get a bokeh server to run, but when i type in the command in my terminal i get an error message
I am trying to run the code below in a bokeh server to visualize the plots. the final_imdb_dataframe is in the same directory as the python code. these are the steps i take to get the server to run:

open my terminal

type in "cd" then a space and then my directory in for the map containing my python script and the final_imdb_dataframe

press enter

type: bokeh serve --show "filename.py"

press enter

in my terminal i am getting this error message however:

bokeh : The term 'bokeh' is not recognized as the name of a cmdlet, function, script file, or operable program. (the complete error message is attached as a picture)

when i type in "pip show bokeh" in the command promt in python it gives me this:

pip show bokeh
Name: bokeh
Version: 2.4.3
Summary: Interactive plots and applications in the browser from Python
Home-page: https://github.com/bokeh/bokeh
Author: Bokeh Team
Author-email: info@bokeh.org
License: BSD-3-Clause
Location: c:\users\fazan\anaconda\lib\site-packages
Requires: Jinja2, numpy, packaging, pillow, PyYAML, tornado, typing-extensions
Required-by: hvplot, panel
Note: you may need to restart the kernel to use updated packages.

so it should work right?
i don't know what to do anymore...

code:

```<code>import pandas as pd
from bokeh.plotting import figure, show
import numpy as np
from bokeh.models import ColumnDataSource, HoverTool, Slider, RangeSlider, Div, Select
from bokeh.io import output_file, curdoc
from bokeh.layouts import column, row, layout

#EERSTE PLOT:
#line diagram of amount of movies released each year en avg rating displayed over the years
df = pd.read_csv("final_imdb_dataframe")
#"unnamed column weghalen
df.drop(df.columns[df.columns.str.contains('unnamed',case = False)],axis = 1, inplace = True)
#creating plot 2
plot2 = figure(plot_width = 1000,
                plot_height = 400,
                x_axis_label= "year",
                title = "watchtime and movie rating over the years")
#creating a dropdown menu
source2 = ColumnDataSource(data={'x': df["release_date"], 'y': df["watchtime"]})
plot2.circle(x="x", y="y", size = 3, source = source2, alpha = 0.2)

def update_plot(attr, old, new):
    if new == 'watchtime':
        source2.data = {'x' : df["release_date"], 'y' : df["watchtime"]}

    else:
        source2.data = {'x' : df["release_date"], 'y' : df["movie_rating"]}

select = Select(title = "keuze menu", options=["watchtime", "movie_rating"], value = 'watchtime')
#code for updating the plot when the value is changed
select.on_change('value', update_plot)

#TWEEDE PLOT:
#creating a list of all the years a movie came out
dfrelease = df.release_date.drop_duplicates().tolist()
#sorting the list with release dates to get them in chronological order
dfrelease1 = sorted(dfrelease)
#creating an empty list
total_releases_per_year = []
#adding the amount of movies that came out every year to the list
for i in range(len(dfrelease1)):
    total_releases_per_year.append(len(df[df["release_date"] == dfrelease1[i]]))
#creating a columndatasource of the two lists created above to make it possible for the hovertool to be used
source1 = ColumnDataSource(data=dict(year = dfrelease1, amount_of_movies_made = total_releases_per_year))
#making a hovertool
hover2 = HoverTool(tooltips=[("year", "@year"), ("amount of movies made", "@amount_of_movies_made")])
#creating plot 3
plot3 = figure(plot_width = 1000,
                plot_height = 400,
                x_axis_label= "year",
                y_axis_label = "amount of movies",
                title = "amount of movies per year")

plot3.line("year", "amount_of_movies_made", source = source1)
plot3.add_tools(hover2)

#DERDE PLOT:
#creating the ColumnDataSource
df_sel = df[df["release_date"] == 2020]
source1 = ColumnDataSource(df_sel)
#scatter plot
p1 = figure(title = "relation 'watchtime' and 'movie rating' over the years",
           x_axis_label= "watchtime",
           y_axis_label= "rating (0-10)",
           plot_width = 1000,
           plot_height = 400)

p1.circle(x="watchtime", y="movie_rating", alpha = 0.2, source=source1)
#making the rangeslider
slider = RangeSlider(title="release date", value= (1919, 2021), start=1919, end=2020, step=1)
#making the hover tool
hover1 = HoverTool(tooltips=[("title", "@movie_name"),("gross", "@gross_collection"),("votes", "@votes"),("genre", "@genre"), ("watchtime", "@watchtime"),("rating", "@movie_rating"),("release date", "@release_date")])
#making a def callback for the rangeslider to work when moved
def callback(attr, old, new):
    year = slider.value
    source1.data = df[(df["release_date"] >= year[0]) & (df["release_date"] <= year[1])]

slider.on_change("value", callback)
layout = column(slider, p1) #create a layout with slider on top of plot
p1.add_tools(hover1) #adding hover tool
layout3 = column(select, plot2, plot3, slider, p1) #making the layout for the dashboard
curdoc().add_root(layout3)*
</code>```

i tried what i wrote above and expected acces to the bokeh server that would show me my plots. i have done this before on my previous computer (mac) and it worked then. now on my lenovo it is not working.`

Body:
I am trying to run the code below in a bokeh server to visualize the plots. the final_imdb_dataframe is in the same directory as the python code. these are the steps i take to get the server to run:

open my terminal

type in "cd" then a space and then my directory in for the map containing my python script and the final_imdb_dataframe

press enter

type: bokeh serve --show "filename.py"

press enter

in my terminal i am getting this error message however:

bokeh : The term 'bokeh' is not recognized as the name of a cmdlet, function, script file, or operable program. (the complete error message is attached as a picture)

when i type in "pip show bokeh" in the command promt in python it gives me this:

pip show bokeh
Name: bokeh
Version: 2.4.3
Summary: Interactive plots and applications in the browser from Python
Home-page: https://github.com/bokeh/bokeh
Author: Bokeh Team
Author-email: info@bokeh.org
License: BSD-3-Clause
Location: c:\users\fazan\anaconda\lib\site-packages
Requires: Jinja2, numpy, packaging, pillow, PyYAML, tornado, typing-extensions
Required-by: hvplot, panel
Note: you may need to restart the kernel to use updated packages.

so it should work right?
i don't know what to do anymore...

code:

import pandas as pd
from bokeh.plotting import figure, show
import numpy as np
from bokeh.models import ColumnDataSource, HoverTool, Slider, RangeSlider, Div, Select
from bokeh.io import output_file, curdoc
from bokeh.layouts import column, row, layout

#EERSTE PLOT:
#line diagram of amount of movies released each year en avg rating displayed over the years
df = pd.read_csv("final_imdb_dataframe")
#"unnamed column weghalen
df.drop(df.columns[df.columns.str.contains('unnamed',case = False)],axis = 1, inplace = True)
#creating plot 2
plot2 = figure(plot_width = 1000,
                plot_height = 400,
                x_axis_label= "year",
                title = "watchtime and movie rating over the years")
#creating a dropdown menu
source2 = ColumnDataSource(data={'x': df["release_date"], 'y': df["watchtime"]})
plot2.circle(x="x", y="y", size = 3, source = source2, alpha = 0.2)

def update_plot(attr, old, new):
    if new == 'watchtime':
        source2.data = {'x' : df["release_date"], 'y' : df["watchtime"]}

    else:
        source2.data = {'x' : df["release_date"], 'y' : df["movie_rating"]}

select = Select(title = "keuze menu", options=["watchtime", "movie_rating"], value = 'watchtime')
#code for updating the plot when the value is changed
select.on_change('value', update_plot)

#TWEEDE PLOT:
#creating a list of all the years a movie came out
dfrelease = df.release_date.drop_duplicates().tolist()
#sorting the list with release dates to get them in chronological order
dfrelease1 = sorted(dfrelease)
#creating an empty list
total_releases_per_year = []
#adding the amount of movies that came out every year to the list
for i in range(len(dfrelease1)):
    total_releases_per_year.append(len(df[df["release_date"] == dfrelease1[i]]))
#creating a columndatasource of the two lists created above to make it possible for the hovertool to be used
source1 = ColumnDataSource(data=dict(year = dfrelease1, amount_of_movies_made = total_releases_per_year))
#making a hovertool
hover2 = HoverTool(tooltips=[("year", "@year"), ("amount of movies made", "@amount_of_movies_made")])
#creating plot 3
plot3 = figure(plot_width = 1000,
                plot_height = 400,
                x_axis_label= "year",
                y_axis_label = "amount of movies",
                title = "amount of movies per year")

plot3.line("year", "amount_of_movies_made", source = source1)
plot3.add_tools(hover2)

#DERDE PLOT:
#creating the ColumnDataSource
df_sel = df[df["release_date"] == 2020]
source1 = ColumnDataSource(df_sel)
#scatter plot
p1 = figure(title = "relation 'watchtime' and 'movie rating' over the years",
           x_axis_label= "watchtime",
           y_axis_label= "rating (0-10)",
           plot_width = 1000,
           plot_height = 400)

p1.circle(x="watchtime", y="movie_rating", alpha = 0.2, source=source1)
#making the rangeslider
slider = RangeSlider(title="release date", value= (1919, 2021), start=1919, end=2020, step=1)
#making the hover tool
hover1 = HoverTool(tooltips=[("title", "@movie_name"),("gross", "@gross_collection"),("votes", "@votes"),("genre", "@genre"), ("watchtime", "@watchtime"),("rating", "@movie_rating"),("release date", "@release_date")])
#making a def callback for the rangeslider to work when moved
def callback(attr, old, new):
    year = slider.value
    source1.data = df[(df["release_date"] >= year[0]) & (df["release_date"] <= year[1])]

slider.on_change("value", callback)
layout = column(slider, p1) #create a layout with slider on top of plot
p1.add_tools(hover1) #adding hover tool
layout3 = column(select, plot2, plot3, slider, p1) #making the layout for the dashboard
curdoc().add_root(layout3)*

i tried what i wrote above and expected acces to the bokeh server that would show me my plots. i have done this before on my previous computer (mac) and it worked then. now on my lenovo it is not working.`


问:
CSS CH Unit Inconsistency Between Browsers (FF and Chrome) - How to Handle
I use as font-family stack like this:

```<code>body{
  font-family: icon, 'Merriweather Sans', ui-sans-serif, sans-serif;
}
</code>```

with icon being an icon-font that has some symbols in it for example arrows, which can occur in copy text or headlines.
The icon font is loaded like this (simplified example):

```<code>@font-face {
  font-family: 'icon';
  src: url(icon.woff2);
  unicode-range: U+1F872, ..., ...;
}
</code>```

That way whenever the 'arrow bold to right' is used in a text it will be rendered in the icon font. It works well and is foolproof.

I also use (simplified example again)

```<code>p.text{
  max-width: 70ch;
}
</code>```

which ensures that text paragraphs don't have too many characters in one line for readability.

Firefox makes those text paragraphs a lot smaller than chrome. And after some experimenting, I found that FF uses the icon-font to determine the width of the zero while Chrome uses Merriweather Sans.

The icon font has no zero-glyph in it and would be hindered by its Unicode range to display one.
So at first glace it seems correct that Chrome calculates ch based on the first font-family in the stack that contains a zero and is allowed to render a zero.

On the other hand I'd think that for calculating the abstract ch unit one can argue that the actual presence ot the zero character isn't necessary. Also it should be perfectly ok if one would use one font only for displaying number (through Unicode-Range) while the next font displays letters. What font should be used for calculating the ch value then?

Can anyone tell me if one or the other browsers does it wrong and the other does it right?

And has anyone an idea for a good workaround?

Body:
I use as font-family stack like this:

body{
  font-family: icon, 'Merriweather Sans', ui-sans-serif, sans-serif;
}

with icon being an icon-font that has some symbols in it for example arrows, which can occur in copy text or headlines.
The icon font is loaded like this (simplified example):

@font-face {
  font-family: 'icon';
  src: url(icon.woff2);
  unicode-range: U+1F872, ..., ...;
}

That way whenever the 'arrow bold to right' is used in a text it will be rendered in the icon font. It works well and is foolproof.

I also use (simplified example again)

p.text{
  max-width: 70ch;
}

which ensures that text paragraphs don't have too many characters in one line for readability.

Firefox makes those text paragraphs a lot smaller than chrome. And after some experimenting, I found that FF uses the icon-font to determine the width of the zero while Chrome uses Merriweather Sans.

The icon font has no zero-glyph in it and would be hindered by its Unicode range to display one.
So at first glace it seems correct that Chrome calculates ch based on the first font-family in the stack that contains a zero and is allowed to render a zero.

On the other hand I'd think that for calculating the abstract ch unit one can argue that the actual presence ot the zero character isn't necessary. Also it should be perfectly ok if one would use one font only for displaying number (through Unicode-Range) while the next font displays letters. What font should be used for calculating the ch value then?

Can anyone tell me if one or the other browsers does it wrong and the other does it right?

And has anyone an idea for a good workaround?


问:
Error: wkhtmltopdf process exited with code 139
getting the Error: wkhtmltopdf process exited with code 139 . I am using wkhtmltopdf in node 18 codebase.</p>


问:
Circular referencing and typing in Python
Using Python 3.11.

I am trying to figure out what is the best practice when dealing with circular referencing and how to implement this (if at all is possible) with typed variables. My intention is to create two instances that may refer to each other (there is no hierarchy here). Related to this, I am trying to figure out whether this is case where I should use weakref and how.

Here is the structure of my code:

```<code>project
  |
  ------ classroom
              |
              ------__init__.py
                    teacher.py
                    student.py
</code>```

Most of the action in my code happens at the project level. Most of the files there would have something like,

```<code>import classroom
</code>```

Classroom is just a directory that contains different classes that I need to use. Each of these appear in a separate file.

init.py:

```<code>from .teacher import Teacher
from .student import Student
</code>```

teacher.py:

```<code>from typing import Optional
from .student import Student

class Teacher:
    def __init__(self, name: str, experience: int, student: Optional[Student]= None):
        self.name = name
        self.experience = experience
        self.student =  if isinstance(student, Student) else None
</code>```

student.py

```<code>from typing import Optional
from .teacher import Teacher

class Student:
    def __init__(self, name: str, year: int, teacher: Optional[Teacher]= None):
        self.name = name
        self.year = year
        self.teacher=  if isinstance(teacher, Teacher) else None
</code>```

When I try to instantiate either Teacher or Student I get an error. What is the proper way to deal with this?

I understand this is not correct at the moment

Body:
Using Python 3.11.

I am trying to figure out what is the best practice when dealing with circular referencing and how to implement this (if at all is possible) with typed variables. My intention is to create two instances that may refer to each other (there is no hierarchy here). Related to this, I am trying to figure out whether this is case where I should use weakref and how.

Here is the structure of my code:

project
  |
  ------ classroom
              |
              ------__init__.py
                    teacher.py
                    student.py

Most of the action in my code happens at the project level. Most of the files there would have something like,

import classroom

Classroom is just a directory that contains different classes that I need to use. Each of these appear in a separate file.

init.py:

from .teacher import Teacher
from .student import Student

teacher.py:

from typing import Optional
from .student import Student

class Teacher:
    def __init__(self, name: str, experience: int, student: Optional[Student]= None):
        self.name = name
        self.experience = experience
        self.student =  if isinstance(student, Student) else None

student.py

from typing import Optional
from .teacher import Teacher

class Student:
    def __init__(self, name: str, year: int, teacher: Optional[Teacher]= None):
        self.name = name
        self.year = year
        self.teacher=  if isinstance(teacher, Teacher) else None

When I try to instantiate either Teacher or Student I get an error. What is the proper way to deal with this?

I understand this is not correct at the moment


问:
Alias column value use with limit clause mysql
I have one table of clockin , in this table i have 600 records. I want to keep the first 250 records and delete the rest of the records.

I want to keep offset value dynamic from mysql query.

DELETE FROM clockin order by id asc limit 250,1000;

DELETE FROM clockin order by id asc limit 263,(SELECT (SELECT COUNT(*) as total FROM clockin)-250);

Does anyone help me.


问:
I am facing a problem while installing my heart on wordpress
I am facing a problem while installing my template on WordPress, so when I finish downloading the template on WordPress and choose the appropriate template for my work, the problem occurs, which is not downloading the templates so that I can choose from thementer image description here
Bridge - Creative Multipurpose WordPress Theme
This is the name of the template I am using

I made many modifications, but to no avail
enter image description here


问:
Snowflake Unsupported subquery type cannot be evaluated with UDF
Having an issue in snowflake using a UDF to select data.

My UDF:

create or replace function find_nearest_postcode(plat float, plong float)
returns varchar
language SQL
as
$$
select any_value(a.postcode) from
(select sqrt(square(c.latitude - plat)+square(c.longitude - plong)) as distance, c.postcode from postcodes c order by distance asc limit 1) as a
$$
;

This works if I call the following:

select find_nearest_postcode(51.2345::float,-0.876::float);

However, when I try to get to work on the whole table:

select *, find_nearest_postcode(latitude::float, longitude::float) from table1;

I get the dreaded "Unsupported subquery type cannot be evaluated"

Postcode table contains fields postcode, lat, long.
table1 contains just lat and long

Any ideas?


问:
Power Vitual Agent - We can't determine if this bot has enabled or disabled Omnichannel
can anyone help me to resolve below error. how can I enable Omnichannel hands-off.

We can't determine if this bot has enabled or disabled Omnichannel


问:
How can I detect clicks on dynamically loaded content in Javascript?
I need to track clicks on content that is dynamically loaded. The content is ads by Google adsense. You include their script in the header of a webpage:

```<code><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-0000000000000"
 crossorigin="anonymous"></script>
</code>```

and then the ads are dynamically placed on different locations of the website.

Because we are facing the problem of fraudulent clicks, we'd like to track who is clicking on them. Is it possible to achieve this through Javascript?

Is it a good idea to intercept all clicks on the web page and then check if the clicked content is an ad?

Are there certain characteristics of the dynamically loaded ads that make them identifieable?

Body:
I need to track clicks on content that is dynamically loaded. The content is ads by Google adsense. You include their script in the header of a webpage:

and then the ads are dynamically placed on different locations of the website.

Because we are facing the problem of fraudulent clicks, we'd like to track who is clicking on them. Is it possible to achieve this through Javascript?

Is it a good idea to intercept all clicks on the web page and then check if the clicked content is an ad?

Are there certain characteristics of the dynamically loaded ads that make them identifieable?


问:
i am developing a software for a betting machine which would take the cash for bet like an atm deposit
Also which protocol should I research about for the data transmission between the software and hardware?
How will the software receives the signals from the hardware to read cash deposits?

I am reading about the rs-232 protocol but am unable to move forward with it? can anyone give me some suggestions or the flow to move forward?


问:
How to unit test/mock GET query with filter param on the Microsoft Graph API
I have graph API method that take in a query and returns filtered User objects. My aim is to setup a mock and send a mocked request with a parameter. My question is simply, what is the appropriate way to mock and unit test this request in a repository pattern where the request gets called from the repository?

I have a repository method like this that calls graph api request method.

```<code>public List<TMUser> GetUsersByName(string param)
{
    return this.graphApi.GetUserByNameAsync(param).Result;
}
</code>```

The method takes in a parameter and returns a matching list of users.

```<code>public async Task<IGraphServiceUsersCollectionPage> GetUserByNameAsync(string param)
{
    return await this.appClient.Users
        .Request(this.queryOptions)
        .Header("ConsistencyLevel", "eventual")
        .Filter($"startswith(DisplayName,'{param}') or startswith(GivenName,'{param}') or
        startswith(Surname,'{param}') or startswith(Mail,'{param}')").Select(@$"
        Id,
        DisplayName,
        GivenName,
        Surname,
        Mail,
        OtherMails,
        CompanyName)
}
</code>```

This is how I mock the graph api method and assign it this.Users. All the users get returned without being filtered!

```<code>private readonly Mock<IGraphAPI> repositoryMockGraphAPI;

this.repositoryMockGraphAPI.Setup(api =>
api.GetUserByNameAsync(It.IsAny<string>())).ReturnsAsync(this.Users);
</code>```

This is my test method and don't really know how to go about mocking/unit it is, having tried different methods.

```<code>[TestMethod]
public void GetUsersByName()
{
    var displayName = "TestUser-" + 1;

    var users = this.b2CRepository.GetUsersByName(displayName);
}
</code>```

Body:
I have graph API method that take in a query and returns filtered User objects. My aim is to setup a mock and send a mocked request with a parameter. My question is simply, what is the appropriate way to mock and unit test this request in a repository pattern where the request gets called from the repository?

I have a repository method like this that calls graph api request method.

public List<TMUser> GetUsersByName(string param)
{
    return this.graphApi.GetUserByNameAsync(param).Result;
}

The method takes in a parameter and returns a matching list of users.

public async Task<IGraphServiceUsersCollectionPage> GetUserByNameAsync(string param)
{
    return await this.appClient.Users
        .Request(this.queryOptions)
        .Header("ConsistencyLevel", "eventual")
        .Filter($"startswith(DisplayName,'{param}') or startswith(GivenName,'{param}') or
        startswith(Surname,'{param}') or startswith(Mail,'{param}')").Select(@$"
        Id,
        DisplayName,
        GivenName,
        Surname,
        Mail,
        OtherMails,
        CompanyName)
}

This is how I mock the graph api method and assign it this.Users. All the users get returned without being filtered!

private readonly Mock<IGraphAPI> repositoryMockGraphAPI;

this.repositoryMockGraphAPI.Setup(api =>
api.GetUserByNameAsync(It.IsAny<string>())).ReturnsAsync(this.Users);

This is my test method and don't really know how to go about mocking/unit it is, having tried different methods.

[TestMethod]
public void GetUsersByName()
{
    var displayName = "TestUser-" + 1;

    var users = this.b2CRepository.GetUsersByName(displayName);
}


问:
Jetty 6.1.26 QueuedThreadPool increase with high frequency and low concurrency
I have use jetty 6.1.26 to build a app service, and I set thread number 1000 like this.

```<code>    QueuedThreadPool httpThreadPool = new QueuedThreadPool(1000);
    server.setThreadPool(httpThreadPool);
</code>```

And I also have another service, it use 4 threads send http request to the above services, but frequency is very high, about 4000 times a minute. echo request cost less then 10ms.

but my QueuedThreadPool thread number increase very fast, The upper limit will be reached soon. so is there some bug with jetty 6.1.26 ?

Body:
I have use jetty 6.1.26 to build a app service, and I set thread number 1000 like this.

    QueuedThreadPool httpThreadPool = new QueuedThreadPool(1000);
    server.setThreadPool(httpThreadPool);

And I also have another service, it use 4 threads send http request to the above services, but frequency is very high, about 4000 times a minute. echo request cost less then 10ms.

but my QueuedThreadPool thread number increase very fast, The upper limit will be reached soon. so is there some bug with jetty 6.1.26 ?


问:
Python dictionary creation: Dictionary comprehension vs Counter
I have been comparing the speed of dictionary creation methods in Python.

In the following example, collections.Counter() and the iterative approaches take the same speed (0.002 secs), whereas the dictionary comprehension method is notably slower (1.115 secs).

I have 2 questions:

1.) Why is the dictionary comprehension slower?

2.) Is there a dictionary comprehension that could match the speed of the other 2 approaches?

```<code>
s1 = 'string'*10000

# dict comp
d1 = {x:s1.count(x) for x in s1}

# iteration
d1={}
for x in s1:
    d1[x] = d1.get(x,0)+1

# Counter
d1 = collections.Counter(s1)
</code>```

Body:
I have been comparing the speed of dictionary creation methods in Python.

In the following example, collections.Counter() and the iterative approaches take the same speed (0.002 secs), whereas the dictionary comprehension method is notably slower (1.115 secs).

I have 2 questions:

1.) Why is the dictionary comprehension slower?

2.) Is there a dictionary comprehension that could match the speed of the other 2 approaches?

s1 = 'string'*10000

# dict comp
d1 = {x:s1.count(x) for x in s1}

# iteration
d1={}
for x in s1:
    d1[x] = d1.get(x,0)+1

# Counter
d1 = collections.Counter(s1)


问:
V1Node not working with Kubectl kubernetes-client
I am getting Unexpected unknown resource type: class io.kubernetes.client.openapi.models.V1Node when Kubectl.get(V1Node.class).execute() is calle

I need the list of nodes using kubectl commands via API


问:
Broken/missing handler while adding a custom field to the content section
Currently i am trying to add a custom field in the content listing section when my custom module is installed. I tried to achieve the same by using hook_views_data_alter and got my field in the add fields section. But when i am adding the same to the list. It shows broken/missing handler.

```<code>function new_views_data_alter(array &$data) {
    $data['node']['sortd_action'] = [
      'title' => t('Action'),
      'help' => t('Displays the value of the action field.'),
      'field' => [
        'id' => 'custom_column',
      ],
      'sort' => [
        'id' => 'standard',
      ],
      'filter' => [
        'id' => 'string',
      ],
      'argument' => [
        'id' => 'string',
      ],
    ];
}
</code>```

I am getting the field in the list but unable to add it in the list

Body:
Currently i am trying to add a custom field in the content listing section when my custom module is installed. I tried to achieve the same by using hook_views_data_alter and got my field in the add fields section. But when i am adding the same to the list. It shows broken/missing handler.

function new_views_data_alter(array &$data) {
    $data['node']['sortd_action'] = [
      'title' => t('Action'),
      'help' => t('Displays the value of the action field.'),
      'field' => [
        'id' => 'custom_column',
      ],
      'sort' => [
        'id' => 'standard',
      ],
      'filter' => [
        'id' => 'string',
      ],
      'argument' => [
        'id' => 'string',
      ],
    ];
}

I am getting the field in the list but unable to add it in the list


问:
Unable to start a ipython wrapper kernel in background through python
We have a requirement of starting the ipython kernel in the background through our backend server code. The kernel launches successfully but blocks the execution of the main thread.

Our Kernel code looks somewhat like this

```<code>from ipykernel.kernelbase import Kernel

class EchoKernel(Kernel):
    implementation = 'Echo'
    implementation_version = '1.0'
    language = 'no-op'
    language_version = '0.1'
    language_info = {'mimetype': 'text/plain'}
    banner = "Echo kernel - as useful as a parrot"

    def do_execute(self, code, silent, store_history=True, user_expressions=None,
                   allow_stdin=False):
        if not silent:
            stream_content = {'name': 'stdout', 'text': code}
            self.send_response(self.iopub_socket, 'stream', stream_content)

        return {'status': 'ok',
                # The base class increments the execution count
                'execution_count': self.execution_count,
                'payload': [],
                'user_expressions': {},
               }

if __name__ == '__main__':
    from ipykernel.kernelapp import IPKernelApp
    IPKernelApp.launch_instance(kernel_class=EchoKernel)
</code>```

The above code can be found in https://ipython.readthedocs.io/en/stable/development/wrapperkernels.html

We are tried to call the above program using  following api's

os.system() , os.popen() and subprocess.call()

The command would be "nohup python LaunchKernel.py >> output.txt &"

As this is a kernel program, would it be possible to launch in background? Any help in solving this would be of great help.

Body:
We have a requirement of starting the ipython kernel in the background through our backend server code. The kernel launches successfully but blocks the execution of the main thread.

Our Kernel code looks somewhat like this

from ipykernel.kernelbase import Kernel

class EchoKernel(Kernel):
    implementation = 'Echo'
    implementation_version = '1.0'
    language = 'no-op'
    language_version = '0.1'
    language_info = {'mimetype': 'text/plain'}
    banner = "Echo kernel - as useful as a parrot"

    def do_execute(self, code, silent, store_history=True, user_expressions=None,
                   allow_stdin=False):
        if not silent:
            stream_content = {'name': 'stdout', 'text': code}
            self.send_response(self.iopub_socket, 'stream', stream_content)

        return {'status': 'ok',
                # The base class increments the execution count
                'execution_count': self.execution_count,
                'payload': [],
                'user_expressions': {},
               }

if __name__ == '__main__':
    from ipykernel.kernelapp import IPKernelApp
    IPKernelApp.launch_instance(kernel_class=EchoKernel)

The above code can be found in https://ipython.readthedocs.io/en/stable/development/wrapperkernels.html

We are tried to call the above program using  following api's

os.system() , os.popen() and subprocess.call()

The command would be "nohup python LaunchKernel.py >> output.txt &"

As this is a kernel program, would it be possible to launch in background? Any help in solving this would be of great help.


问:
PyCharm Weird Environment Variable
I am setting up a PyCharm project using Docker on Windows 10. When I try to run tests, I get the following error:

```<code>Error response from daemon1: invalid environment variable: =::=::\
</code>```

When I inspect the variables for the tests' configuration template within PyCharm, I see that there is a variable there which has key="=::" and value="://".

What is that variable? Should I be trying to delete it? If so, how do I delete it? I cannot seem to find it among the Windows environment variables.

Title: PyCharm Weird Environment Variable

Body:
I am setting up a PyCharm project using Docker on Windows 10. When I try to run tests, I get the following error:

Error response from daemon1: invalid environment variable: =::=::\

When I inspect the variables for the tests' configuration template within PyCharm, I see that there is a variable there which has key="=::" and value="://".

What is that variable? Should I be trying to delete it? If so, how do I delete it? I cannot seem to find it among the Windows environment variables.


问:
ERROR [Error: undefined Unable to resolve module util from node_modules/uuidv4/build/lib/uuidv4.js
```<code> ERROR  [Error: undefined Unable to resolve module util from /Users/mac2015/Desktop/Projects/mobile/Ejob/node_modules/uuidv4/build/lib/uuidv4.js: util could not be found within the project or in these directories:
  node_modules
  2 | Object.defineProperty(exports, "__esModule", { value: true });
  3 | exports.jsonSchema = exports.fromString = exports.empty = exports.isUuid = exports.regex = exports.uuid = void 0;
> 4 | const util_1 = require("util");
    |                         ^
  5 | const uuid_1 = require("uuid");
  6 | const regex = {
  7 |     v4: /(?:^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u,]
</code>```

I've installed uuidv4 in my react native application, after import it from uuidv4, i'm trying to use as id for my items but i'm getting this error.

Body:
 ERROR  [Error: undefined Unable to resolve module util from /Users/mac2015/Desktop/Projects/mobile/Ejob/node_modules/uuidv4/build/lib/uuidv4.js: util could not be found within the project or in these directories:
  node_modules
  2 | Object.defineProperty(exports, "__esModule", { value: true });
  3 | exports.jsonSchema = exports.fromString = exports.empty = exports.isUuid = exports.regex = exports.uuid = void 0;
> 4 | const util_1 = require("util");
    |                         ^
  5 | const uuid_1 = require("uuid");
  6 | const regex = {
  7 |     v4: /(?:^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}$)|(?:^0{8}-0{4}-0{4}-0{4}-0{12}$)/u,]

I've installed uuidv4 in my react native application, after import it from uuidv4, i'm trying to use as id for my items but i'm getting this error.


问:
ImportError: libLerc.so.4: cannot open shared object file: No such file or directory

Using this structure i try to import GRIBDownloader using from modules.GRIBDownloader import GRIBDownloader (in the GRIBDownloader file is a class called GRIBDownloader) with weathertryouts.py as my main file in which i try to import this.

I researched some other pages on how to structure modules and there are some people that do it the same way, but it just doesn't work for me, I always get the error ImportError: libLerc.so.4: cannot open shared object file: No such file or directory

What am i doing wrong here?


问:
Log4j2 ExtendedLoggerGenerator CLI is missing class Strings
I am trying to generate my own logger. In the documentation here of Log4j2 you can generate a Java class with this CLI.

```<code>java -cp log4j-core-2.19.0.jar org.apache.logging.log4j.core.tools.ExtendedLoggerGenerator \
    com.mycomp.ExtLogger DIAG=350 NOTICE=450 VERBOSE=550 > com/mycomp/ExtLogger.java
</code>```

Unfortunately I always get this error message. I have already tried to include log4j-api-2.19.0.jar in the classpath.

```<code>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/util/Strings
    at org.apache.logging.log4j.core.util.Integers.parseInt(Integers.java:43)
    at org.apache.logging.log4j.core.util.Integers.parseInt(Integers.java:54)
    at org.apache.logging.log4j.core.tools.Generate$LevelInfo.<init>(Generate.java:1044)
    at org.apache.logging.log4j.core.tools.Generate$LevelInfo.parse(Generate.java:1051)
    at org.apache.logging.log4j.core.tools.Generate.generate(Generate.java:1097)
    at org.apache.logging.log4j.core.tools.Generate.generate(Generate.java:1063)
    at org.apache.logging.log4j.core.tools.Generate.access$100(Generate.java:48)
    at org.apache.logging.log4j.core.tools.Generate$ExtendedLogger.main(Generate.java:1030)
    at org.apache.logging.log4j.core.tools.ExtendedLoggerGenerator.main(ExtendedLoggerGenerator.java:28)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.util.Strings
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
</code>```

Edit:
Ok, you have to give these 2 JAR's at the same time then it works

```<code>java -cp log4j-api-2.19.0.jar;log4j-core-2.19.0.jar org.apache.logging.log4j.core.tools.ExtendedLoggerGenerator ExtLogger DIAG=350 NOTICE=450 VERBOSE=550 > ExtLogger.java
</code>```

Body:
I am trying to generate my own logger. In the documentation here of Log4j2 you can generate a Java class with this CLI.

java -cp log4j-core-2.19.0.jar org.apache.logging.log4j.core.tools.ExtendedLoggerGenerator \
    com.mycomp.ExtLogger DIAG=350 NOTICE=450 VERBOSE=550 > com/mycomp/ExtLogger.java

Unfortunately I always get this error message. I have already tried to include log4j-api-2.19.0.jar in the classpath.

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/util/Strings
    at org.apache.logging.log4j.core.util.Integers.parseInt(Integers.java:43)
    at org.apache.logging.log4j.core.util.Integers.parseInt(Integers.java:54)
    at org.apache.logging.log4j.core.tools.Generate$LevelInfo.<init>(Generate.java:1044)
    at org.apache.logging.log4j.core.tools.Generate$LevelInfo.parse(Generate.java:1051)
    at org.apache.logging.log4j.core.tools.Generate.generate(Generate.java:1097)
    at org.apache.logging.log4j.core.tools.Generate.generate(Generate.java:1063)
    at org.apache.logging.log4j.core.tools.Generate.access$100(Generate.java:48)
    at org.apache.logging.log4j.core.tools.Generate$ExtendedLogger.main(Generate.java:1030)
    at org.apache.logging.log4j.core.tools.ExtendedLoggerGenerator.main(ExtendedLoggerGenerator.java:28)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.util.Strings
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)

Edit:
Ok, you have to give these 2 JAR's at the same time then it works

java -cp log4j-api-2.19.0.jar;log4j-core-2.19.0.jar org.apache.logging.log4j.core.tools.ExtendedLoggerGenerator ExtLogger DIAG=350 NOTICE=450 VERBOSE=550 > ExtLogger.java


问:
How to create SVG file using SVGKit from part of content of NSView?
I tried with this code but it doesn't work.

`

```<code>#import <SVGKit/SVGKit.h>

//...

//create rect

NSRect r = NSMakeRect(100, 200, 500, 300);

SVGKImage* svgImage = [[SVGKImage alloc] init];

[svgImage setSize:r.size];

NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc]

initWithBitmapDataPlanes:NULL
                                                                       pixelsWide:r.size.width
                                                                   pixelsHigh:r.size.height
                                                                bitsPerSample:8
                                                              samplesPerPixel:4
                                                                     hasAlpha:YES
                                                                     isPlanar:NO
                                                               colorSpaceName:NSCalibratedRGBColorSpace
                                                                  bytesPerRow:0
                                                                 bitsPerPixel:0];

NSGraphicsContext *context = [NSGraphicsContext graphicsContextWithBitmapImageRep:imageRep];

[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:context];

[svgImage.CALayerTree renderInContext:context.CGContext];

//draw content

NSData* svgData = [SVGKExporterNSData exportAsNSData:svgImage];

NSString* strFN = @"fileName.svg";

if ([svgData writeToFile:strFN atomically:YES])
    return true;

return false
</code>```

`

Problem with this code is that svgImage.CALayerTree is null.
Does anyone know how to use SVGKit to export NSView content in svg file?

Body:
I tried with this code but it doesn't work.

`

#import <SVGKit/SVGKit.h>

//...

//create rect

NSRect r = NSMakeRect(100, 200, 500, 300);

SVGKImage* svgImage = [[SVGKImage alloc] init];

[svgImage setSize:r.size];

NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc]

initWithBitmapDataPlanes:NULL
                                                                       pixelsWide:r.size.width
                                                                   pixelsHigh:r.size.height
                                                                bitsPerSample:8
                                                              samplesPerPixel:4
                                                                     hasAlpha:YES
                                                                     isPlanar:NO
                                                               colorSpaceName:NSCalibratedRGBColorSpace
                                                                  bytesPerRow:0
                                                                 bitsPerPixel:0];

NSGraphicsContext *context = [NSGraphicsContext graphicsContextWithBitmapImageRep:imageRep];

[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:context];

[svgImage.CALayerTree renderInContext:context.CGContext];

//draw content

NSData* svgData = [SVGKExporterNSData exportAsNSData:svgImage];

NSString* strFN = @"fileName.svg";

if ([svgData writeToFile:strFN atomically:YES])
    return true;

return false

`

Problem with this code is that svgImage.CALayerTree is null.
Does anyone know how to use SVGKit to export NSView content in svg file?


问:
Print content of file which is inside a running pod
I have a Kubernetes pod named pod-0 running. Inside, there is .json file in path /var/lib/test. I want to print the content of this file or get a specific key value of the file and store it in a golang variable.

I can't use kubectl command anywhere.

Using golang K8sClient, can you please give me the solution for this problem?

I tried this:

logs, err := clientset.CoreV1().Pods(namespace).GetLogs(podName,&v1.PodLogOptions{}).Context(ctx).Do()
```

But it didn't work.

I want a simple and easily understandable solution.

Body:
I have a Kubernetes pod named pod-0 running. Inside, there is .json file in path /var/lib/test. I want to print the content of this file or get a specific key value of the file and store it in a golang variable.

I can't use kubectl command anywhere.

Using golang K8sClient, can you please give me the solution for this problem?

I tried this:

logs, err := clientset.CoreV1().Pods(namespace).GetLogs(podName,&v1.PodLogOptions{}).Context(ctx).Do()

But it didn't work.

I want a simple and easily understandable solution.


问:
Why was CHS addressing stopped?
I am new to Operating Systems. While going through a video, it was shown that LBA replaced CHS addressing due to geometric and some other issues. I wanted to know what were the issues. The only one I could found was zone addressing, the fact that there are more sectors at the end would increase complexity in CHS addressing. Other than that, there was this 7.8 GB limit.

I want to understand what is the 7.8GB limit? Is it still relevant today?

Are there any other reasons (except zone addressing) that led to decrement of CHS addressing.

I am beginner and don't know if this has an obvious answer. Please help anyways.

Title: Why was CHS addressing stopped?


问:
Filtering table results with drop down menu in Laravel
Created a drop down menu that is supposed to work as a filter. I am filtering with enum values so not sure how to make it work. The view + route are working fine. When the button is pressed the URL changes and adds the selected enum value /dropdown?filter_status=inactive. But the results are not filtered.

View:

```<code><div class="container d-flex justify-content-start">
    <div class="row">
        <div class="col-md-12">
            <form action="{{ route('dropdownView') }}" method="GET">
                <div class="form-group">
                <div>
                <span>
                <select class="mb-2" name="filter_status" >
                <option value="Status" disabled selected>Status</option>
                @foreach ($enumoption as $status)
                   <option value="{{ $status }}">{{$status}}</option>
                @endforeach
                </select>
                <button type="submit" class="btn btn-primary btn-sm ms-1 mb-1">Filter</button>
                </span>
                </div>
                </div>
            </form>
        </div>
    </div>
</div>
</code>```

Route:

```<code>Route::get("/dropdown", [CompetitionController::class, 'index'])->name('dropdownView');
</code>```

Controller(getPossibleEnumValues is the function I am using in my model to get the enum values)

```<code>$enumoption = Competition::getPossibleEnumValues('competitions','status');
</code>```

EDIT:

```<code>public static function getPossibleEnumValues($table, $column) {
      $type = DB::select(DB::raw("SHOW COLUMNS FROM $table WHERE Field = '{$column}'"))[0]->Type ;
      preg_match('/^enum\((.*)\)$/', $type, $matches);
      $enum = array();
      foreach( explode(',', $matches[1]) as $value )
      {
        $v = trim( $value, "'" );
        $enum = Arr::add($enum, $v, $v);
      }
      return $enum;
    }
</code>```

Body:
Created a drop down menu that is supposed to work as a filter. I am filtering with enum values so not sure how to make it work. The view + route are working fine. When the button is pressed the URL changes and adds the selected enum value /dropdown?filter_status=inactive. But the results are not filtered.

View:

            <form action="{{ route('dropdownView') }}" method="GET">

                <select class="mb-2" name="filter_status" >
                <option value="Status" disabled selected>Status</option>
                @foreach ($enumoption as $status)
                   <option value="{{ $status }}">{{$status}}</option>
                @endforeach
                </select>
                <button type="submit" class="btn btn-primary btn-sm ms-1 mb-1">Filter</button>

            </form>

Route:

Route::get("/dropdown", [CompetitionController::class, 'index'])->name('dropdownView');

Controller(getPossibleEnumValues is the function I am using in my model to get the enum values)

$enumoption = Competition::getPossibleEnumValues('competitions','status');

EDIT:

public static function getPossibleEnumValues($table, $column) {
      $type = DB::select(DB::raw("SHOW COLUMNS FROM $table WHERE Field = '{$column}'"))[0]->Type ;
      preg_match('/^enum\((.*)\)$/', $type, $matches);
      $enum = array();
      foreach( explode(',', $matches[1]) as $value )
      {
        $v = trim( $value, "'" );
        $enum = Arr::add($enum, $v, $v);
      }
      return $enum;
    }


问:
How do I find the number of last row and paste right below it?
I need to paste data from one sheet to another but the last row of data varies everytime. The line I use to paste the data is "Application.Goto ActiveWorkbook.Sheets("CICLICO").Cells(LastRow+1, 2)"

If my LastRow is 10 I paste the data at the row 11, but it can be 9, 50, 89... I would like a code to find that last row and identify it as LastRow. Any ideas?

I  haven't tried anything because I don't know how to do it.


问:
How to manage rollbacks on spring cloud config
I have a spring cloud config repository, a server and a client. Originally the functionality expected is to be able to reload properties without stopping the running service. Now if there is a rollback on the client's end, how do i ensure that it picks up an older version of the property file?

I've tried specifying the spring.cloud.config.label value but if i put in a specific tag or version, wouldn't i lose the intended functionality of the client tracking changes on the repo?


问:
Visual Studio C# add reference using library to linux
I added one SDK(.dll) to one project, through click righ -> add -> reference -> Browser -> look for the SDK in my local file explorer, then click Add and finnally Ok.

so, The question is that now I must add it but for a code directed for linux, I have the SDK for linux, its extension is .a

which is the way to add as a reference???, since the usual way only allows adding dll, tlb, olt, ocx, exe or manifest files


问:
scipy runtime warning: overflow encountered
I used scipy's solve_ivp to integrate large differential equations.
Sometimes a message comes up: runtime warning overflow encountered....

But solve_ivp keeps on running.

Is there any way to stop solve_ivp as soon as this error comes up?

Thanks for any help!


问:
Can I use 2 different row index- (i, ii) in one command?
I have dataset with dependencies between individual features and feature group. The individual features (f) can be further distinguished into main and side features (f.type). The expression of the main feature (f.type_exp) of a group determines if all other features of the group (except the main feature) are valid or not.

The task is to check for each id and f.group if the individual features of a given group are valid (valid based on the main feature expression) or not. Instead of looping over each id and ech group i am looking for a data.table solution. Following this, i use one row index (i) to check if the argument is true or not, and then a second row index (ii) to update the values of a feature.

The data looks like this:

```<code>library(data.table)
d <- data.table(id= c(rep("id1",3), rep("id2",1)) ,
                f=c("a1","a2","b1", "b1"),
                f.group= c(rep("a",3), "b"),
                f.type= c("main", "side", "side", "main"),
                f.type_exp = c(TRUE, NA, NA, FALSE))

d
#   id  f f.group f.type f.type_exp
#  id1 a1       a   main       TRUE
#  id1 a2       a   side         NA
#  id1 b1       a   side         NA
#  id2 b1       b   main      FALSE
</code>```

#the solution for one id + group combination could be soemthing like this:

define steps

```<code>group_1 <- d[id=="id1" & f.group=="a",]
#(i)
step1 <- group_1[f.type=="main", f.type_exp]==T
#(ii)
step2 <- group_1[f.type=="side", f:= NA]

print(step2)
</code>```

Preferred solutions in one line (does Not work)

```<code>#i = f.type=="main"& f.type_exp==T
  #used to determine truth (if (f.type=="main"& f.type_exp==T) == T )

#ii = f[f.type=="side"]
  #used to update values in f according to index of f.type
</code>```
```<code>test1 <- d[f.type=="main"& f.type_exp==T,  f[f.type=="side"]:= NA,  by=.(id, f.group)]

</code>```

#ALternative Solution So far my solution is to use the following function:

```<code>
my_fun <- function(x){
  if( x[f.type=="main", f.type_exp]==T ){
    x$f[x$f.type=="side"] <- NA
  }
  return(x)
}

test  <- d[, my_fun(.SD), by = .(id, f.group)]

test

#   id f.group    f f.type f.type_exp
#  id1       a   a1   main       TRUE
#  id1       a <NA>   side         NA
#  id1       a <NA>   side         NA
#  id2       b   b1   main      FALSE

</code>```

Expected outcome: the function my_fun produces the expected output. all features of type side of group id1 are set to NA because the main feature expression is true. group id2 remains unchanged since the main feature expression is false, thus in this example it does not cotnain any side features that could be updated.

however, i am sure there is a better data table based solution to this task

Question:

Is there a solution where i use 2 different index (i and ii) as described in Preferred solutions ?

is my general reasoning correct that data.table grouping operator by =.(id, f.group) should be used to avoid looping over both arguments

should another library be considered? ( i want to point out that the original dataset contains millions of rows)

Thanks for any hints in advance!

Body:
I have dataset with dependencies between individual features and feature group. The individual features (f) can be further distinguished into main and side features (f.type). The expression of the main feature (f.type_exp) of a group determines if all other features of the group (except the main feature) are valid or not.

The task is to check for each id and f.group if the individual features of a given group are valid (valid based on the main feature expression) or not. Instead of looping over each id and ech group i am looking for a data.table solution. Following this, i use one row index (i) to check if the argument is true or not, and then a second row index (ii) to update the values of a feature.

The data looks like this:

library(data.table)
d <- data.table(id= c(rep("id1",3), rep("id2",1)) ,
                f=c("a1","a2","b1", "b1"),
                f.group= c(rep("a",3), "b"),
                f.type= c("main", "side", "side", "main"),
                f.type_exp = c(TRUE, NA, NA, FALSE))

d
#   id  f f.group f.type f.type_exp
#  id1 a1       a   main       TRUE
#  id1 a2       a   side         NA
#  id1 b1       a   side         NA
#  id2 b1       b   main      FALSE

#the solution for one id + group combination could be soemthing like this:

define steps

group_1 <- d[id=="id1" & f.group=="a",]
#(i)
step1 <- group_1[f.type=="main", f.type_exp]==T
#(ii)
step2 <- group_1[f.type=="side", f:= NA]

print(step2)

Preferred solutions in one line (does Not work)

#i = f.type=="main"& f.type_exp==T
  #used to determine truth (if (f.type=="main"& f.type_exp==T) == T )

#ii = f[f.type=="side"]
  #used to update values in f according to index of f.type

test1 <- d[f.type=="main"& f.type_exp==T,  f[f.type=="side"]:= NA,  by=.(id, f.group)]

#ALternative Solution So far my solution is to use the following function:

my_fun <- function(x){
  if( x[f.type=="main", f.type_exp]==T ){
    x$f[x$f.type=="side"] <- NA
  }
  return(x)
}

test  <- d[, my_fun(.SD), by = .(id, f.group)]

test

#   id f.group    f f.type f.type_exp
#  id1       a   a1   main       TRUE
#  id1       a <NA>   side         NA
#  id1       a <NA>   side         NA
#  id2       b   b1   main      FALSE

Expected outcome: the function my_fun produces the expected output. all features of type side of group id1 are set to NA because the main feature expression is true. group id2 remains unchanged since the main feature expression is false, thus in this example it does not cotnain any side features that could be updated.

however, i am sure there is a better data table based solution to this task

Question:

Is there a solution where i use 2 different index (i and ii) as described in Preferred solutions ?

is my general reasoning correct that data.table grouping operator by =.(id, f.group) should be used to avoid looping over both arguments

should another library be considered? ( i want to point out that the original dataset contains millions of rows)

Thanks for any hints in advance!