问:
IModel.GetRelationalModel is not copying annotations
When converting from an IModel to a RelationalModel either by:

Using the .GetRelationalModel() extension for IModel.

Using RelationalModel constructor which takes an IModel

Annotations from the orignal IModel are not preserved. Meaning functions like IMigrationsModelDiffer.GetDifferences() don't work as intended. Manually copying the annotations after the fact also doesn't help as GetDifferences() won't use runtime annotations.

Is there an alternative way to create the RelationalModel which preserves these annotations? Or an alternative to GetDifferences which will use runtime annotations?

```<code>var oldRelationalModel = oldModel.GetRelationalModel();
            Log.Information("Old IModel Annotations: {0}", oldModel.GetAnnotations().Count());
            Log.Information("Old RelationalModel Annotations: {0}", oldRelationalModel.GetAnnotations().Count());

var newRelationalModel = newModel.GetRelationalModel();
            Log.Information("Old IModel Annotations: {0}", newModel.GetAnnotations().Count());
            Log.Information("Old RelationalModel Annotations: {0}", newRelationalModel.GetAnnotations().Count());
</code>```
```<code>[15:57:46 INF] Old IModel Annotations: 5
[15:57:46 INF] Old RelationalModel Annotations: 0
[15:57:46 INF] Old IModel Annotations: 5
[15:57:46 INF] Old RelationalModel Annotations: 0
</code>```

Body:
When converting from an IModel to a RelationalModel either by:

Using the .GetRelationalModel() extension for IModel.

Using RelationalModel constructor which takes an IModel

Annotations from the orignal IModel are not preserved. Meaning functions like IMigrationsModelDiffer.GetDifferences() don't work as intended. Manually copying the annotations after the fact also doesn't help as GetDifferences() won't use runtime annotations.

Is there an alternative way to create the RelationalModel which preserves these annotations? Or an alternative to GetDifferences which will use runtime annotations?

var oldRelationalModel = oldModel.GetRelationalModel();
            Log.Information("Old IModel Annotations: {0}", oldModel.GetAnnotations().Count());
            Log.Information("Old RelationalModel Annotations: {0}", oldRelationalModel.GetAnnotations().Count());

var newRelationalModel = newModel.GetRelationalModel();
            Log.Information("Old IModel Annotations: {0}", newModel.GetAnnotations().Count());
            Log.Information("Old RelationalModel Annotations: {0}", newRelationalModel.GetAnnotations().Count());

[15:57:46 INF] Old IModel Annotations: 5
[15:57:46 INF] Old RelationalModel Annotations: 0
[15:57:46 INF] Old IModel Annotations: 5
[15:57:46 INF] Old RelationalModel Annotations: 0


来源: stackexchange

问:
Getting java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLContants/property/accessExternalStylesheet
I am using Apache POI for creating excel file. excel file is getting generated. but seeing an exception java.lang.IllegalArgumentException: Not supported: http://javax.xml.XMLContants/property/accessExternalStylesheet while persisting workbook on memory.

Java Version: Open JDK 1.8

Please give me some pointer

ContentLicense: CC BY-SA 4.0


问:
How to store the row values in Session() from Devexpress Report?
I want to store the value of "Booking No" from the report added below, in the Session() in VB. Could you please help me out with this?

enter image description here


问:
JSON error when using Wordpress POST request to external API
I am trying to connect to the Listmonk API through wp_remote_post() on WordPress. I created a custom plugin for this.

Some parts work, but when I need to submit data that is an array or integer, I get errors. Also when I try to use wp_json_encode(), as recommended online, the API gives me a 400 error.

I hope someone can help!

I tried a lot of things. My POST code is:

```<code>$response = wp_remote_post($listmonk_url, array(
                'headers' => array(
                    'Authorization' => 'Basic ' . base64_encode($listmonk_username . ':' . $listmonk_password),
                    'Content-Type: application/json',
                ),
                'body' => $body,
            ));
</code>```

And my body content is:

```<code>    $body = array(
        'name'  => $name,
        'email' => $email,
        'status'=> 'enabled',
        'lists' => 2,
        'preconfirm_subscriptions' => true,
     ) ;
</code>```

Whenever I try to use wp_json_encode() on $body, the API gives me:

```<code> [http_response] => WP_HTTP_Requests_Response Object ( [response:protected] => Requests_Response Object ( [body] => {"message":"Invalid email."} [raw] => HTTP/1.1 400 Bad Request Server
</code>```

The encoded JSON was:

```<code>{"name":"john","email":"jan@jan.com","status":"enabled"}
</code>```

And when I don't use json encoding, my 'lists' never passes through correctly, as you can see below, where the returned JSON shows lists is empty:

```<code>"lists":[]}
</code>```

Is there something I am not seeing?

Body:
I am trying to connect to the Listmonk API through wp_remote_post() on WordPress. I created a custom plugin for this.

Some parts work, but when I need to submit data that is an array or integer, I get errors. Also when I try to use wp_json_encode(), as recommended online, the API gives me a 400 error.

I hope someone can help!

I tried a lot of things. My POST code is:

$response = wp_remote_post($listmonk_url, array(
                'headers' => array(
                    'Authorization' => 'Basic ' . base64_encode($listmonk_username . ':' . $listmonk_password),
                    'Content-Type: application/json',
                ),
                'body' => $body,
            ));

And my body content is:

    $body = array(
        'name'  => $name,
        'email' => $email,
        'status'=> 'enabled',
        'lists' => 2,
        'preconfirm_subscriptions' => true,
     ) ;

Whenever I try to use wp_json_encode() on $body, the API gives me:

 [http_response] => WP_HTTP_Requests_Response Object ( [response:protected] => Requests_Response Object ( [body] => {"message":"Invalid email."} [raw] => HTTP/1.1 400 Bad Request Server

The encoded JSON was:

{"name":"john","email":"jan@jan.com","status":"enabled"}

And when I don't use json encoding, my 'lists' never passes through correctly, as you can see below, where the returned JSON shows lists is empty:

"lists":[]}

Is there something I am not seeing?


问:
how to create a blender script to create a 26 sided rhombicuboctahedron out of letters
The shape that appears

import bpy
import math

# Create a new empty mesh
mesh = bpy.data.meshes.new("Rhombicuboctahedron")

# Create a new object with the mesh
obj = bpy.data.objects.new("Rhombicuboctahedron", mesh)

# Add the object to the scene
bpy.context.collection.objects.link(obj)

# Create vertices for the rhombicuboctahedron
vertices = []
phi = (1 + math.sqrt(2)) / 2
for i in range(3):
    for j in range(2):
        x = (-1)**j * phi if i == 0 else 0
        y = (-1)**j * phi if i == 1 else 0
        z = (-1)**j * 1 if i == 2 else 0
        vertices.append((x, y, z))

# Create faces for the rhombicuboctahedron
faces = [(0, 1, 2), (0, 2, 3), (0, 3, 4), (0, 4, 1), (1, 5, 2),
         (2, 5, 3), (3, 5, 4), (4, 5, 1), (6, 1, 4), (6, 2, 1),
         (6, 3, 2), (6, 4, 3), (5, 6, 7), (7, 1, 5), (7, 2, 1),
         (7, 3, 2), (7, 4, 3), (7, 5, 4)]

# Add vertices and faces to the mesh
mesh.from_pydata(vertices, [], faces)

# Recalculate normals and update the mesh
mesh.update()

# Add materials to each face
mat = bpy.data.materials.new(name="Material")
mat.diffuse_color = (1, 1, 1)
for i, face in enumerate(mesh.polygons):
    face.material_index = i
    mesh.materials.append(mat)

# Create a text object for each face
for i, face in enumerate(mesh.polygons):
    # Get the center point of the face
    center = face.center
    # Create a text object
    text = bpy.data.curves.new(name="Text", type='FONT')
    # Set the text to be the letter corresponding to the face
    text.body = chr(ord('A') + i)
    # Create an object with the text
    text_obj = bpy.data.objects.new(name="Text", object_data=text)
    # Set the location of the object to the center of the face
    text_obj.location = center
    # Rotate the object so it faces the camera
    text_obj.rotation_euler = (math.pi / 2, 0, 0)
    # Scale the object
    text_obj.scale = (0.1, 0.1, 0.1)
    # Add the object to the scene
    bpy.context.collection.objects.link(text_obj)
```

I wanted a rhombicuboctahedron, which is a polyhedron with 26 faces. It has 8 triangular faces and 18 square faces.

The rhombicuboctahedron is an Archimedean solid, which means that it is a convex polyhedron that is made up of two or more types of regular polygons that meet in equal angles. The rhombicuboctahedron is one of the 13 Archimedean solids. It is a highly symmetrical solid, with 3-fold rotational symmetry around all four of its vertices.

This script doesnt appear even close, yet I cannot fault it. Is it the code or blender?

Body:
The shape that appears

import bpy
import math

# Create a new empty mesh
mesh = bpy.data.meshes.new("Rhombicuboctahedron")

# Create a new object with the mesh
obj = bpy.data.objects.new("Rhombicuboctahedron", mesh)

# Add the object to the scene
bpy.context.collection.objects.link(obj)

# Create vertices for the rhombicuboctahedron
vertices = []
phi = (1 + math.sqrt(2)) / 2
for i in range(3):
    for j in range(2):
        x = (-1)**j * phi if i == 0 else 0
        y = (-1)**j * phi if i == 1 else 0
        z = (-1)**j * 1 if i == 2 else 0
        vertices.append((x, y, z))

# Create faces for the rhombicuboctahedron
faces = [(0, 1, 2), (0, 2, 3), (0, 3, 4), (0, 4, 1), (1, 5, 2),
         (2, 5, 3), (3, 5, 4), (4, 5, 1), (6, 1, 4), (6, 2, 1),
         (6, 3, 2), (6, 4, 3), (5, 6, 7), (7, 1, 5), (7, 2, 1),
         (7, 3, 2), (7, 4, 3), (7, 5, 4)]

# Add vertices and faces to the mesh
mesh.from_pydata(vertices, [], faces)

# Recalculate normals and update the mesh
mesh.update()

# Add materials to each face
mat = bpy.data.materials.new(name="Material")
mat.diffuse_color = (1, 1, 1)
for i, face in enumerate(mesh.polygons):
    face.material_index = i
    mesh.materials.append(mat)

# Create a text object for each face
for i, face in enumerate(mesh.polygons):
    # Get the center point of the face
    center = face.center
    # Create a text object
    text = bpy.data.curves.new(name="Text", type='FONT')
    # Set the text to be the letter corresponding to the face
    text.body = chr(ord('A') + i)
    # Create an object with the text
    text_obj = bpy.data.objects.new(name="Text", object_data=text)
    # Set the location of the object to the center of the face
    text_obj.location = center
    # Rotate the object so it faces the camera
    text_obj.rotation_euler = (math.pi / 2, 0, 0)
    # Scale the object
    text_obj.scale = (0.1, 0.1, 0.1)
    # Add the object to the scene
    bpy.context.collection.objects.link(text_obj)

I wanted a rhombicuboctahedron, which is a polyhedron with 26 faces. It has 8 triangular faces and 18 square faces.

The rhombicuboctahedron is an Archimedean solid, which means that it is a convex polyhedron that is made up of two or more types of regular polygons that meet in equal angles. The rhombicuboctahedron is one of the 13 Archimedean solids. It is a highly symmetrical solid, with 3-fold rotational symmetry around all four of its vertices.

This script doesnt appear even close, yet I cannot fault it. Is it the code or blender?


问:
How to integrate Windows AD in on-premise with Ranger in EMR Alibaba Cloud hadoop cluster
I have a hybrid approach where the AD is still on-premises and we would like to centralize all AD to ranger in the alibaba EMR cloud.
I've been exercising by creating 3 VMs (1 windows server, 1 windows enterprise, hadoop ecosystem (for ranger)) locally, but I can't connect AD to ranger directly. I believe I need to maintain other services to connect this hybrid environment.
Is it possible to integrate AD on-premises to be centralized in EMR ranger? because I have asked for support from alibaba and there is not enough documentation regarding this case. Any suggestions?</p>


问:
Chakra UI tooltips causing serious lag
I've been using Chakra UI in my React app and have noticed that the tooltips are causing some serious lag after being hovered over. I have a color palette with about 55 buttons, each with a tooltip, and after hovering over a button, the lag persists even when I hover off of it. This was really unexpected and took me about 4 hours to troubleshoot.

I'm using useMemo() in my code, and the buttons and tooltips never update after the first render. I'm guessing that this is a bug in Chakra UI, but I'm not sure what to do. Has anyone else experienced this issue or know what could be causing it? Any suggestions for how to work around it in the meantime? I'm considering just removing the tooltips, but I'd really like to find a solution if possible.

Here is my code for the ColorPreset component that contains the tooltips:

import React from "react";
import { Button, ButtonGroup, Tooltip } from "@chakra-ui/react";
import "./ColorPreset.css";

function ColorPreset({ color, onClick }) {
  return (
    <Tooltip label={color} placement="top">
      <Button
        padding="20px"
        style={{
          backgroundColor: color,
        }}
        onClick={onClick}
      />
    </Tooltip>
  );
}

export default ColorPreset;
```

I'd really appreciate any help or guidance on this!

Title: Chakra UI tooltips causing serious lag

Body:
I've been using Chakra UI in my React app and have noticed that the tooltips are causing some serious lag after being hovered over. I have a color palette with about 55 buttons, each with a tooltip, and after hovering over a button, the lag persists even when I hover off of it. This was really unexpected and took me about 4 hours to troubleshoot.

I'm using useMemo() in my code, and the buttons and tooltips never update after the first render. I'm guessing that this is a bug in Chakra UI, but I'm not sure what to do. Has anyone else experienced this issue or know what could be causing it? Any suggestions for how to work around it in the meantime? I'm considering just removing the tooltips, but I'd really like to find a solution if possible.

Here is my code for the ColorPreset component that contains the tooltips:

import React from "react";
import { Button, ButtonGroup, Tooltip } from "@chakra-ui/react";
import "./ColorPreset.css";

function ColorPreset({ color, onClick }) {
  return (
    <Tooltip label={color} placement="top">
      <Button
        padding="20px"
        style={{
          backgroundColor: color,
        }}
        onClick={onClick}
      />
    </Tooltip>
  );
}

export default ColorPreset;

I'd really appreciate any help or guidance on this!


问:
URL Shortener redirect not working for iOS 16
We have a URL Shortener code that redirects to a designated site.
The build is based on Java SpringBoot framework which is working fine for all devices whether mobiles or laptops .
But recently we received complaints that it is not working for Apple iOS 16 devices

When we check the logs, there were no calls being made to the web server thats recieving the requests is nginx version: nginx/1.20.1

The devices that cannot connect to the extended URL are later directed to a default webpage after taking too long to load

Not sure how to navigate this issue to investigate this problem as we are not getting any calls made from the device
Any kind of help or direction is appreciated

Have attached the POM.xml of the shortener code for reference

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.solus</groupId>
    <artifactId>solus_url_shotener_service</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>solus_url_shotener_service</name>
    <description>URL shotener Service</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.2.3.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>5.2.3.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api</artifactId>
            <version>1.0.1.Final</version>
        </dependency>
        <dependency>
            <groupId>org.javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>3.20.0-GA</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

</code>```

Body:
We have a URL Shortener code that redirects to a designated site.
The build is based on Java SpringBoot framework which is working fine for all devices whether mobiles or laptops .
But recently we received complaints that it is not working for Apple iOS 16 devices

When we check the logs, there were no calls being made to the web server thats recieving the requests is nginx version: nginx/1.20.1

The devices that cannot connect to the extended URL are later directed to a default webpage after taking too long to load

Not sure how to navigate this issue to investigate this problem as we are not getting any calls made from the device
Any kind of help or direction is appreciated

Have attached the POM.xml of the shortener code for reference

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.5</version>
        <relativePath/>
    </parent>
    <groupId>com.solus</groupId>
    <artifactId>solus_url_shotener_service</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>solus_url_shotener_service</name>
    <description>URL shotener Service</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.2.3.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>5.2.3.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api</artifactId>
            <version>1.0.1.Final</version>
        </dependency>
        <dependency>
            <groupId>org.javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>3.20.0-GA</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>


问:
How to build the below horizontal scroll UI in Flutter where the bottom line with levels should be scrollable along the line
Design represents a journey like UX where the levels(stars and profile pic) should be scrollable left and right along the line but the image above the line is not scrollable.


问:
in drupal -->structure--->content types-->the layout field are locked .How to resolve it

The views are not working on a localhost.but,i using same backup file on the QA.but QA was worked fine localhost was not worked.


问:
Recursive approcah to solve Towers of Hanoi Problem
I just learn about Recursion and tried to solve Towers of Hanoi problem. I know the description about the Towers of Hanoi by book description (I use book Data Structures and Algorithmic Thinking with Python by Narasimha Karumanchi) and the book gives me solution to solve the problem:

```<code>def Tower_of_Hanoi(Number_of_disc, start_rods = 1, end_rods = 3):
    if Number_of_disc:
        Tower_of_Hanoi(Number_of_disc-1, start_rods, 6-start_rods-end_rods)
        print(f"Move disc {Number_of_disc}, from start {start_rods} to {end_rods}")
        Tower_of_Hanoi(Number_of_disc-1, 6-start_rods-end_rods, end_rods)
</code>```

What I don't understand is the line 6-start_rods-end_rods. How this line works? Is this operator just like append, sort, etc. or this is a syntax that have meaning behind it. This is my first question.

Then, I tried to run it, I give Number_of_disc by 5, and here's the result:

Move disc 1, from start 1 to 3
Move disc 2, from start 1 to 2
Move disc 1, from start 3 to 2
Move disc 3, from start 1 to 3
Move disc 1, from start 2 to 1
Move disc 2, from start 2 to 3
Move disc 1, from start 1 to 3
Move disc 4, from start 1 to 2
Move disc 1, from start 3 to 2
Move disc 2, from start 3 to 1
Move disc 1, from start 2 to 1
Move disc 3, from start 3 to 2
Move disc 1, from start 1 to 3
Move disc 2, from start 1 to 2
Move disc 1, from start 3 to 2
Move disc 5, from start 1 to 3
Move disc 1, from start 2 to 1
Move disc 2, from start 2 to 3
Move disc 1, from start 1 to 3
Move disc 3, from start 2 to 1
Move disc 1, from start 3 to 2
Move disc 2, from start 3 to 1
Move disc 1, from start 2 to 1
Move disc 4, from start 2 to 3
Move disc 1, from start 1 to 3
Move disc 2, from start 1 to 2
Move disc 1, from start 3 to 2
Move disc 3, from start 1 to 3
Move disc 1, from start 2 to 1
Move disc 2, from start 2 to 3
Move disc 1, from start 1 to 3
```

I know some disc will be move from one rod (or ped) to the other, but my question is how the function know when to move specific disc from source to the ped and then move again to the other ped? For example, take disc 1, from the result above line 1 said that disc moved from 1 to 3, then on line 3 said that disc move from 3 to 2. I think this move have connection with line 6-star_rods-end_rods, but I don't know how it's works behind the line.

Please, help me.

Body:
I just learn about Recursion and tried to solve Towers of Hanoi problem. I know the description about the Towers of Hanoi by book description (I use book Data Structures and Algorithmic Thinking with Python by Narasimha Karumanchi) and the book gives me solution to solve the problem:

def Tower_of_Hanoi(Number_of_disc, start_rods = 1, end_rods = 3):
    if Number_of_disc:
        Tower_of_Hanoi(Number_of_disc-1, start_rods, 6-start_rods-end_rods)
        print(f"Move disc {Number_of_disc}, from start {start_rods} to {end_rods}")
        Tower_of_Hanoi(Number_of_disc-1, 6-start_rods-end_rods, end_rods)

What I don't understand is the line 6-start_rods-end_rods. How this line works? Is this operator just like append, sort, etc. or this is a syntax that have meaning behind it. This is my first question.

Then, I tried to run it, I give Number_of_disc by 5, and here's the result:

Move disc 1, from start 1 to 3
Move disc 2, from start 1 to 2
Move disc 1, from start 3 to 2
Move disc 3, from start 1 to 3
Move disc 1, from start 2 to 1
Move disc 2, from start 2 to 3
Move disc 1, from start 1 to 3
Move disc 4, from start 1 to 2
Move disc 1, from start 3 to 2
Move disc 2, from start 3 to 1
Move disc 1, from start 2 to 1
Move disc 3, from start 3 to 2
Move disc 1, from start 1 to 3
Move disc 2, from start 1 to 2
Move disc 1, from start 3 to 2
Move disc 5, from start 1 to 3
Move disc 1, from start 2 to 1
Move disc 2, from start 2 to 3
Move disc 1, from start 1 to 3
Move disc 3, from start 2 to 1
Move disc 1, from start 3 to 2
Move disc 2, from start 3 to 1
Move disc 1, from start 2 to 1
Move disc 4, from start 2 to 3
Move disc 1, from start 1 to 3
Move disc 2, from start 1 to 2
Move disc 1, from start 3 to 2
Move disc 3, from start 1 to 3
Move disc 1, from start 2 to 1
Move disc 2, from start 2 to 3
Move disc 1, from start 1 to 3

I know some disc will be move from one rod (or ped) to the other, but my question is how the function know when to move specific disc from source to the ped and then move again to the other ped? For example, take disc 1, from the result above line 1 said that disc moved from 1 to 3, then on line 3 said that disc move from 3 to 2. I think this move have connection with line 6-star_rods-end_rods, but I don't know how it's works behind the line.

Please, help me.


问:
Java or Python sums two double numbers incorrectly
I was trying to solve math expression, but java or python sums to double numbers incorrectly

Ex: 1.2 - 0.3 = 0.9 but the code solves it as 1.2 - 0.3 = 0.8999999999999999
Why does it happening and how can i solve it (wasn't able to find out in google)

JAVA version :

java 11.0.5 2019-10-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.5+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.5+10-LTS, mixed mode)

The code in JAVA

```<code>public class Main {
    public static void main(String[] args) {

        System.out.println(
                1.2 - 0.3
        );

    }
}
</code>```

The result is

```<code>
0.8999999999999999

</code>```

on Python

```<code>
print(1.2 - 0.3)

</code>```

the result is

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

Body:
I was trying to solve math expression, but java or python sums to double numbers incorrectly

Ex: 1.2 - 0.3 = 0.9 but the code solves it as 1.2 - 0.3 = 0.8999999999999999
Why does it happening and how can i solve it (wasn't able to find out in google)

JAVA version :

java 11.0.5 2019-10-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.5+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.5+10-LTS, mixed mode)

The code in JAVA

public class Main {
    public static void main(String[] args) {

        System.out.println(
                1.2 - 0.3
        );

    }
}

The result is

0.8999999999999999

on Python

print(1.2 - 0.3)

the result is

0.8999999999999999


问:
Using NextJs and React, using speechSynthesis returns no voice on page load
I'm building an app using NextJS and so of course using React.

I'm trying to get the voices from speechSynthesis in a hook with useEffect but returns an empty array, if I hot reload though, it gives me a list of voices. Here is a snippet of my code:

const useTextToSpeech = () => {
  const speechRef = useRef<SpeechSynthesisUtterance | null>();
  const [voices, setVoices] = useState<SpeechSynthesisVoice[]>([]);

  useEffect(() => {
    if (!speechRef.current) return;
    console.log("Initializing SpeechSynthesisVoice");
    try {
      const vs = window.speechSynthesis.getVoices();
      if (!vs.length) return;
      setVoices(vs);
    } catch (e) {
      console.error(e);
    }
  }, []);

  return {
    voices
  };
};
```

And my codesandbox to play around.

Thank you for your help.

Body:
I'm building an app using NextJS and so of course using React.

I'm trying to get the voices from speechSynthesis in a hook with useEffect but returns an empty array, if I hot reload though, it gives me a list of voices. Here is a snippet of my code:

const useTextToSpeech = () => {
  const speechRef = useRef<SpeechSynthesisUtterance | null>();
  const [voices, setVoices] = useState<SpeechSynthesisVoice[]>([]);

  useEffect(() => {
    if (!speechRef.current) return;
    console.log("Initializing SpeechSynthesisVoice");
    try {
      const vs = window.speechSynthesis.getVoices();
      if (!vs.length) return;
      setVoices(vs);
    } catch (e) {
      console.error(e);
    }
  }, []);

  return {
    voices
  };
};

And my codesandbox to play around.

Thank you for your help.


问:
Data Validation using python
I want to find data in my dataframe is in the range or not , different range values will be applied for different columns , and in the final I need to add a new column to my data frame and indicate that column which column has out of range data. it is need to apply for each row

This is my Data frame

and the ranges I need to apply are

UL Traffic - [ 0 - 0.1 ] out of this range value is not valid
DL User Thrp - [3000-11000]  out of this range value is not valid

I used this code .

range_check_columns={ 'UL Traffic':(0,0.1),'DL User Thrp':(3000,11000),}

dataframe = pd.read_csv('F:\Dialog\inputs\Book1.csv')

def Transform ( data_integrity_column = 'Data'):
    for column,ranges in range_check_columns.items():
        dataframe.loc[dataframe[column].between(ranges[0],ranges[1])==False,data_integrity_column]=((' ,data in'+ column +'column is out of range'))
    return dataframe

Transform()
```

But output is not like expected, if both columns are out of range, but only showing one column as out of range. how can I fix this

Title: Data Validation using python

Body:
I want to find data in my dataframe is in the range or not , different range values will be applied for different columns , and in the final I need to add a new column to my data frame and indicate that column which column has out of range data. it is need to apply for each row

This is my Data frame

and the ranges I need to apply are

UL Traffic - [ 0 - 0.1 ] out of this range value is not valid
DL User Thrp - [3000-11000]  out of this range value is not valid

I used this code .

range_check_columns={ 'UL Traffic':(0,0.1),'DL User Thrp':(3000,11000),}

dataframe = pd.read_csv('F:\Dialog\inputs\Book1.csv')

def Transform ( data_integrity_column = 'Data'):
    for column,ranges in range_check_columns.items():
        dataframe.loc[dataframe[column].between(ranges[0],ranges[1])==False,data_integrity_column]=((' ,data in'+ column +'column is out of range'))
    return dataframe

Transform()

But output is not like expected, if both columns are out of range, but only showing one column as out of range. how can I fix this


问:
Image Segmentation in Flutter using deeplabv3 or another method but google ml kit
I developed app to remove image background using google MLKit Image. Image Segmentation does not give prices results., i studied Deeplabv3 has precise results.
link is below
http://bggit.ihub.org.cn/p30597648/tensorflow/raw/43c7b99a10f083b8ab3e2327b7068a5b5b9a7e96/tensorflow/lite/g3doc/models/segmentation/images/segmentation.gif

i used this project example deeplab. there is not right result there are random result.
https://github.com/shaqian/flutter_tflite

please help me to remove image background with precise result in flutter.

i will be thankful to you


问:
Kubernetes MongoDB backups and restoration using velero
I have used velero to take backups of kubernetes deployed mongodb replicaset type service. Backups are working fine. But when tried to restore, it is acting weird, sometimes it will be using restoring same data with 2 different PV’s. Sometimes it is using same PV.

Anyone facing same issue. And an solution.


问:
Getting image size from Imgur link in discord.js
I'm using discord.js, and I'm making a command where a user will provide an Imgur link, and it will send information about it. I'm wondering how I can get the size of the Imgur image and send it in an embed.

For example, a user gives this link https://imgur.com/x7CkR8a.png How can I get the size of this image? Ex. 2048x1024


问:
Error while importing: 'codemirror/lib/codemirror.css'
Code:

```<code>import React from 'react'

import 'codemirror/lib/codemirror.css';

export default function Editor() {

  return (

    <div>Editor</div>

  )

}
</code>```

Error:

```<code>Module not found: Error: Can't resolve 'codemirror/lib/codemirror.css'
</code>```

Please provide a solution for this error..

Body:
Code:

import React from 'react'

import 'codemirror/lib/codemirror.css';

export default function Editor() {

  return (

Editor

  )

}

Error:

Module not found: Error: Can't resolve 'codemirror/lib/codemirror.css'

Please provide a solution for this error..


问:
How can I check an array of links to see if they work and write them to a file?
I have an array consisting of 40,000 company names.

That is, there is such a link on the site https://numfin.com/uk/AAPL/overview

in my case AAPL, this is the name of the company.

I decided to accomplish this task by simply writing these 40k company names into an array, and in a loop just change the company name in the link

I wrote a small script on node js in which I made a loop and changed the names of the companies

```<code>import request from "request";
import fs from "fs";
import { tickets } from "./tickets.js"; // array of company names

var data = [];

var out = fs.createWriteStream("tickets.txt", { flags: "a" });

for (let i = 0; i < tickets.length; i++) {
  request(
    `https://numfin.com/uk/${tickets[i]}/overview`,
    function (error, response, body) {
      if (error) {
        console.log("Err: " + error);
        return false;
      }

      if (
        response.statusCode == 200 ||
        response.statusCode == 201 ||
        response.statusCode == 202
      ) {
        console.log(
          `https://numfin.com/uk/${tickets[i]}/overview` + " is alive!!"
        );

        return false;
      }

      if (response.statusCode == 301 || response.statusCode == 302) {
        console.log(
          `https://numfin.com/uk/${tickets[i]}/overview` +
            " is redirecting us!!"
        );
        return false;
      }

      if (response.statusCode == 401) {
        console.log(
          "you are unauthorized to " +
            `https://numfin.com/uk/${tickets[i]}/overview`
        );
        return false;
      } else {
        // IF TICKET === 500 status code, I will write this ticket to file
        console.log(
          `https://numfin.com/uk/${tickets[i]}/overview` + " is dead!!"
        );
        data.push(tickets[i]);
        console.log("data length", data.length);
        out.write(tickets[i].toString());
      }
    }
  );
}

out.end();
</code>```

I wrote a small script on node js in which I made a loop and changed the names of the companies.

But the problem is that this code does not work and does not write to the file.

And for some reason, when I stuff such a large volume of data, I get the following error:

Error: read ECONNRESET

I'm already tired of trying to solve it, tell me maybe some other options

Body:
I have an array consisting of 40,000 company names.

That is, there is such a link on the site https://numfin.com/uk/AAPL/overview

in my case AAPL, this is the name of the company.

I decided to accomplish this task by simply writing these 40k company names into an array, and in a loop just change the company name in the link

I wrote a small script on node js in which I made a loop and changed the names of the companies

import request from "request";
import fs from "fs";
import { tickets } from "./tickets.js"; // array of company names

var data = [];

var out = fs.createWriteStream("tickets.txt", { flags: "a" });

for (let i = 0; i < tickets.length; i++) {
  request(
    `https://numfin.com/uk/${tickets[i]}/overview`,
    function (error, response, body) {
      if (error) {
        console.log("Err: " + error);
        return false;
      }

      if (
        response.statusCode == 200 ||
        response.statusCode == 201 ||
        response.statusCode == 202
      ) {
        console.log(
          `https://numfin.com/uk/${tickets[i]}/overview` + " is alive!!"
        );

        return false;
      }

      if (response.statusCode == 301 || response.statusCode == 302) {
        console.log(
          `https://numfin.com/uk/${tickets[i]}/overview` +
            " is redirecting us!!"
        );
        return false;
      }

      if (response.statusCode == 401) {
        console.log(
          "you are unauthorized to " +
            `https://numfin.com/uk/${tickets[i]}/overview`
        );
        return false;
      } else {
        // IF TICKET === 500 status code, I will write this ticket to file
        console.log(
          `https://numfin.com/uk/${tickets[i]}/overview` + " is dead!!"
        );
        data.push(tickets[i]);
        console.log("data length", data.length);
        out.write(tickets[i].toString());
      }
    }
  );
}

out.end();

I wrote a small script on node js in which I made a loop and changed the names of the companies.

But the problem is that this code does not work and does not write to the file.

And for some reason, when I stuff such a large volume of data, I get the following error:

Error: read ECONNRESET

I'm already tired of trying to solve it, tell me maybe some other options


问:
React and Gsap or Framer motion, exit animation when the route is unmounted
for over 2 days i was trying to make a simple text animation, slide up on entry and slide down on exit. I used Framer Motion first but i wasn't able to achieve the exit animation and then i was trying with Gsap but same problem.

Folder structure

```<code>src/
├─ pages/
│  ├─ projects/
│  │  ├─ Brainwash.jsx
│  ├─ Home.jsx
│  ├─ RenderProj.jsx
├─ components/
│  ├─ projects/
│  │  ├─ Hero.jsx
│  │  ├─ ...
├─ App.jsx

</code>```

App.jsx

```<code>import React, { useState, useEffect } from "react";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import Home from "./pages/Home";
import RenderProj from "./pages/RenderProj";
import { CSSTransition } from "react-transition-group";
import { gsap } from "gsap";

const routes = [
  { path: "/", Component: <Home /> },
  { path: "/projects/:projects", Component: <RenderProj /> },
  { path: "*", Component: <Home /> },
];

function App() {
  return (
    <div className={darkMode === "dark" && "dark"}>
      <div class="z-10 bg-white dark:bg-black">
        <Router>
          <Routes>
            {routes.map(({ path, Component }) => (
              <Route exact path={path} element={Component}></Route>
            ))}
          </Routes>
        </Router>
      </div>
    </div>
  );
}

export default App;

</code>```

RenderProj.jsx

```<code>import React from "react";
import { useParams } from "react-router-dom";
import Brainwash from "./projects/Brainwash";
import { motion } from "framer-motion";
import Splash from "./projects/Splash";
import Notfound from "./Notfound";
import Projects from "./Projects";

const transition = { duration: 0.8, ease: [0.6, -0.05, 0.01, 0.9] };

const RenderProj = () => {
  let { projects } = useParams();
  const components = {
    brainwash: Brainwash,
    splash: Splash,
  };

  function Project(props) {
    // Correct! JSX type can be a capitalized variable.
    const ProjectComp = components[props];
    return <ProjectComp />;
  }
  return (
    <>
      <div
        {Project(projects.toLowerCase())}
      </div>
    </>
  );
};

export default RenderProj;
</code>```

Brainwash.jsx

```<code>import React from "react";
import Hero from "../../components/projects/Hero";
import Category from "../../components/projects/Category";
import Images from "../../components/projects/Images";
import TwoSqImg from "../../components/projects/TwoSqImg";
import OneImg from "../../components/projects/OneImg";
import SubCategory from "../../components/projects/SubCategory";
import SubWithImg from "../../components/projects/SubWithImg";
import SubWithPar from "../../components/projects/SubWithPar";
import Paragraph from "../../components/projects/Paragraph";

const Brainwash = () => {
  return (
    <>
      <Hero
        title="Brainwash Design"
        descriptionen="My taks was to create a modern visual identity that could be modified for different events, but still fit the platform's design. The logo, fully represents the platform's name and the creativity of a designer's mind."
        descriptionro="sdsaddsadsasda"
        image="http://eneadrian.com/wp-content/uploads/2021/05/thumbnail.png"
        tags={["Branding", "App Director", "Testing"]}
      />
    </>
  );
};

export default Brainwash;
</code>```

Hero.jsx

```<code>import React, { useEffect, useRef } from "react";
import { AnimatePresence, motion, useAnimation } from "framer-motion";
import { useInView } from "react-intersection-observer";
import { gsap } from "gsap";
import random from "random-key-generator";

import { CSSTransition } from "react-transition-group";

const Hero = (props) => {
  let line1 = useRef(null);
  useEffect(() => {
    console.log("seEffect animation");
    let ctx = gsap.context(() => {
      gsap.from([".hero-titlu"], {
        duration: 1.4,
        delay: 0.6,
        ease: "power3.out",
        yPercent: 110,
        stagger: {
          amount: 0.3,
        },
      });
    });
    return () => ctx.revert();
  }, [line1]);

  return (
    <>
      <div class="w-screen pt-44 font-poppins flex flex-col lg:justify-start ">
        <div className="custom-padding flex justify-between">
          <div class="flex-col flex text-6xl xl:text-8xl text-black dark:text-white">
            {props.title.split(" ").map((word, idx) => (
              <span
                ref={(el) => (line1 = el)}
                key={idx}
                className=" overflow-hidden flex flex-col pb-4 "
              >
                <span className="hero-titlu">{word}</span>
              </span>
            ))}
          </div>
      </div>
    </>
  );
};

export default Hero;
</code>```

That's all my code, i have no idea how can i make the exit transition for that title before the page is unmounted so the timeline should be

Page mounted -> Title animation entry -> Title animation exit -> Page unmounted -> Next page mounted ...

Thanks for your time!

I've tried to achieve it with Framer motion and Animated Presence, i didn't really understand the Animated Presence but anyway, all I could get was to make a page fade-in-out transition, but I could not get the exit animation from each component. Then i tried with Gsap, same problem.

Body:
for over 2 days i was trying to make a simple text animation, slide up on entry and slide down on exit. I used Framer Motion first but i wasn't able to achieve the exit animation and then i was trying with Gsap but same problem.

Folder structure

src/
├─ pages/
│  ├─ projects/
│  │  ├─ Brainwash.jsx
│  ├─ Home.jsx
│  ├─ RenderProj.jsx
├─ components/
│  ├─ projects/
│  │  ├─ Hero.jsx
│  │  ├─ ...
├─ App.jsx

App.jsx

import React, { useState, useEffect } from "react";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import Home from "./pages/Home";
import RenderProj from "./pages/RenderProj";
import { CSSTransition } from "react-transition-group";
import { gsap } from "gsap";

const routes = [
  { path: "/", Component: <Home /> },
  { path: "/projects/:projects", Component: <RenderProj /> },
  { path: "*", Component: <Home /> },
];

function App() {
  return (

        <Router>
          <Routes>
            {routes.map(({ path, Component }) => (
              <Route exact path={path} element={Component}></Route>
            ))}
          </Routes>
        </Router>

  );
}

export default App;

RenderProj.jsx

import React from "react";
import { useParams } from "react-router-dom";
import Brainwash from "./projects/Brainwash";
import { motion } from "framer-motion";
import Splash from "./projects/Splash";
import Notfound from "./Notfound";
import Projects from "./Projects";

const transition = { duration: 0.8, ease: [0.6, -0.05, 0.01, 0.9] };

const RenderProj = () => {
  let { projects } = useParams();
  const components = {
    brainwash: Brainwash,
    splash: Splash,
  };

  function Project(props) {
    // Correct! JSX type can be a capitalized variable.
    const ProjectComp = components[props];
    return <ProjectComp />;
  }
  return (
    <>
      <div
        {Project(projects.toLowerCase())}

    </>
  );
};

export default RenderProj;

Brainwash.jsx

import React from "react";
import Hero from "../../components/projects/Hero";
import Category from "../../components/projects/Category";
import Images from "../../components/projects/Images";
import TwoSqImg from "../../components/projects/TwoSqImg";
import OneImg from "../../components/projects/OneImg";
import SubCategory from "../../components/projects/SubCategory";
import SubWithImg from "../../components/projects/SubWithImg";
import SubWithPar from "../../components/projects/SubWithPar";
import Paragraph from "../../components/projects/Paragraph";

const Brainwash = () => {
  return (
    <>
      <Hero
        title="Brainwash Design"
        descriptionen="My taks was to create a modern visual identity that could be modified for different events, but still fit the platform's design. The logo, fully represents the platform's name and the creativity of a designer's mind."
        descriptionro="sdsaddsadsasda"
        image="http://eneadrian.com/wp-content/uploads/2021/05/thumbnail.png"
        tags={["Branding", "App Director", "Testing"]}
      />
    </>
  );
};

export default Brainwash;

Hero.jsx

import React, { useEffect, useRef } from "react";
import { AnimatePresence, motion, useAnimation } from "framer-motion";
import { useInView } from "react-intersection-observer";
import { gsap } from "gsap";
import random from "random-key-generator";

import { CSSTransition } from "react-transition-group";

const Hero = (props) => {
  let line1 = useRef(null);
  useEffect(() => {
    console.log("seEffect animation");
    let ctx = gsap.context(() => {
      gsap.from([".hero-titlu"], {
        duration: 1.4,
        delay: 0.6,
        ease: "power3.out",
        yPercent: 110,
        stagger: {
          amount: 0.3,
        },
      });
    });
    return () => ctx.revert();
  }, [line1]);

  return (
    <>

            {props.title.split(" ").map((word, idx) => (
               (line1 = el)}
                key={idx}
                className=" overflow-hidden flex flex-col pb-4 "
              >
                {word}

            ))}

    </>
  );
};

export default Hero;

That's all my code, i have no idea how can i make the exit transition for that title before the page is unmounted so the timeline should be

Page mounted -> Title animation entry -> Title animation exit -> Page unmounted -> Next page mounted ...

Thanks for your time!

I've tried to achieve it with Framer motion and Animated Presence, i didn't really understand the Animated Presence but anyway, all I could get was to make a page fade-in-out transition, but I could not get the exit animation from each component. Then i tried with Gsap, same problem.


问:
I published new version of npm package, Npm shows new version, but installing older version
I have updated my npm library by publishing a new version. it has been 3 hours. The readme got updated in the npm page. But when i install, i am getting an older version.

```<code>https://www.npmjs.com/package/notiboy-js-sdk
</code>```

1.0.0 is updated in the npm page. But when i install, i am getting older version.

Body:
I have updated my npm library by publishing a new version. it has been 3 hours. The readme got updated in the npm page. But when i install, i am getting an older version.

https://www.npmjs.com/package/notiboy-js-sdk

1.0.0 is updated in the npm page. But when i install, i am getting older version.


问:
Access control is not enabled for mongosqld,listen tcp 127.0.0.1:3307: bind: Only one usage of each socket address is normally permitted
I was trying to connect MongoDB Atlas free cluster M0 with Power BI .The error message is as shown below:                                              I CONTROL    [initandlisten] ** WARNING: Access control is not enabled for mongosqld.
2023-01-04T10:26:46.712+0530 I CONTROL    [initandlisten]
error populating listeners: listen tcp 127.0.0.1:3307: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.

I was trying to connect MongoDB Atlas free cluster M0 with Power BI using the link https://medium.com/qimi-techblog/connecting-mongodb-hosted-in-mongo-atlas-with-powerbi-including-m0-clusters-ae02fbef0c7d .  But was not giving the databases or the collections which I have in my MongoDB Atlas. The error message is as shown below:                                                . I tried checking the task manager for availability of port. .The executed the following command in cmd  .Still throwing the error as Kindly Help me to rectify this.


问:
improving my model using undersampling still has poor results in python
I have 1 million raw data points, and I dropped 2 independent variable because the have over 80% missing value.

All my variables are categorical except for "age" which I scaled between -1 and 1. Remaining were turned into dummy variables.

i want both of the F1 scores to be high [0.94093409 0.56259895] specially in the 0.5625

here is my features

sex: 1 for female and 2 for male.
age: of the patient.

classification: covid test findings. Values 1-3 mean that the patient was diagnosed with covid in different
degrees. 4 or higher means that the patient is not a carrier of covid or that the test is inconclusive.

patient type: type of care the patient received in the unit. 1 for returned home and 2 for hospitalization.

pneumonia: whether the patient already have air sacs inflammation or not.
pregnancy: whether the patient is pregnant or not.

diabetes: whether the patient has diabetes or not.

copd: Indicates whether the patient has Chronic obstructive pulmonary disease or not.

asthma: whether the patient has asthma or not.

inmsupr: whether the patient is immunosuppressed or not.

hypertension: whether the patient has hypertension or not.

cardiovascular: whether the patient has heart or blood vessels related disease.
renal chronic: whether the patient has chronic renal disease or not.

other disease: whether the patient has other disease or not.

obesity: whether the patient is obese or not.

tobacco: whether the patient is a tobacco user.

usmr: Indicates whether the patient treated medical units of the first, second or third level.

medical unit: type of institution of the National Health System that provided the care.

intubed: whether the patient was connected to the ventilator.

icu: Indicates whether the patient had been admitted to an Intensive Care Unit.

date died: If the patient died indicate the date of death, and 9999-99-99 otherwise.

```<code>  #Creating the dependent variable “DEATH”
covid['DEATH']= np.where(covid['DATE_DIED']=="9999-99-99",0,1)
covid['DEATH'].value_counts()
print('Data Shape :', covid.shape)
covid.info()

#Number of Unique Values by column

for col in covid.columns :
    print('{:<20} => {:>10}'.format(col, len(covid[col].unique())))

#Percentage of missing values
print('Percentage of missing values')
for col in covid.columns :
    print('{:<20} => {:>10.2f}%'.format(col, len(covid[(covid[col]==98) | (covid[col]==99) | (covid[col]==97)])/len(covid)*100))

covid['INTUBED'].value_counts()
covid['ICU'].value_counts()
covid['PREGNANT'].value_counts()

#Getting rid of the missing values of features except "INTUBED", "PREGNANT", "ICU"¶

cols = ['PNEUMONIA','DIABETES', 'COPD', 'ASTHMA', 'INMSUPR','HIPERTENSION',

           'OTHER_DISEASE', 'CARDIOVASCULAR', 'OBESITY','RENAL_CHRONIC', 'TOBACCO']
    for col in cols :
        covid = covid[(covid[col] == 1)|(covid[col] == 2)]
    # Converting process according to inference above
    covid.PREGNANT = covid.PREGNANT.replace(97,2)

    # Getting rid of the missing values
    covid = covid[(covid.PREGNANT == 1) | (covid.PREGNANT == 2)]

    covid.drop(columns=["INTUBED","ICU","DATE_DIED"], inplace=True)

 from pandas.core.indexing import convert_from_missing_indexer_tuple

from sklearn.preprocessing import RobustScaler
scaler = RobustScaler()
covid.AGE = scaler.fit_transform(covid.AGE.values.reshape(-1,1))

#dummy

corr=covid.corr()

#Creation of the first line in spearman correlation matrix:

corr["first line"]=["USMER","MEDICAL_UNIT","PATIENT_TYPE",
"PNEUMONIA","AGE","PREGNANT","DIABETES","COPD","ASTHMA","INMSUPR","HIPERTENSION","OTHER_DISEASE","CARDIOVASCULAR","OBESITY","RENAL_CHRONIC","TOBACCO","CLASIFFICATION_FINAL","GENDER","DEATH"]

corr1=0
var=[]
while (corr1< len(corr['DEATH'])):
     if (corr["DEATH"][corr1]>0.1 or corr["DEATH"][corr1]<-0.1 ):
          var.append(corr["first line"][corr1])
     corr1=corr1+1

print(" The variables that have a significant correlation with the dependant variable are: ",var)

# Replace values in data by "Value"_variable
df9=covid
other_variables=['AGE','DATE_DIED','DEATH']
col5=df9['USMER']
i=0
for col5 in df9:

  if (col5 not in other_variables and col5 in var):
    for i in range(1,98):
      head1=df9[col5].head(0)
      head_concate=str(i)+"_"+ str(head1)
      df9[col5]=df9[col5].replace(i,head_concate)

df12=covid["AGE"]
col6=df9['USMER']
for col6 in df9:
  if col6 not in other_variables and col6 in var :
       Dummy=pd.get_dummies(df9[col6], drop_first = True)
       df12=pd.concat([df12,Dummy],axis = 1)

y= covid['DEATH']
x= df12

logreg = LogisticRegression()
logreg.fit(train_x,train_y)
y1_pred=logreg.predict(test_x)

print('Logistic regression model accuracy:{:.2f}'.format(logreg.score(test_x,test_y)))
print("Logistic Regression F1 Score :",f1_score(test_y,logreg.predict(test_x),average=None))
print("Logistic Regression F1 Score :",f1_score(test_y,logreg.predict(test_x),average='weighted'))
print('precision before undersampling  : %.2f' % precision_score(test_y, logreg.predict(test_x),average='weighted' ))
print('recall before undersampling : %.2f' % recall_score(test_y, logreg.predict(test_x),average='weighted'))

from sklearn.metrics import confusion_matrix

#undersampling only for the training data
from imblearn.under_sampling import RandomUnderSampler

rus = RandomUnderSampler(random_state=0)
x_train_rus,y_train_rus = rus.fit_resample(train_x,train_y)

logreg_under = LogisticRegression()
logreg_under.fit(x_train_rus,y_train_rus)
print("Logistic Regression Accuracy after undersampling :",logreg_under.score(test_x, test_y))
print("Logistic Regression F1 Score after undersampling :",f1_score(test_y,logreg_under.predict(test_x),average=None))
print('F1_score: %.2f' % f1_score(test_y, logreg_under.predict(test_x),average='weighted'))
print('precision after undersampling  : %.2f' % precision_score(test_y, logreg_under.predict(test_x),average='weighted' ))
print('recall after undersampling : %.2f' % recall_score(test_y, logreg_under.predict(test_x),average='weighted'))

sns.heatmap(confusion_matrix(test_y, logreg_under.predict(test_x)), annot=True, fmt=".0f")
plt.title("Logistic Regression Confusion Matrix",fontsize=18, color="red");
</code>```

the results are

```<code>     Percentage of missing values
USMER                =>       0.00%
MEDICAL_UNIT         =>       0.00%
PATIENT_TYPE         =>       0.00%
DATE_DIED            =>       0.00%
INTUBED              =>      81.62%
PNEUMONIA            =>       1.53%
AGE                  =>       0.03%
PREGNANT             =>      50.28%
DIABETES             =>       0.32%
COPD                 =>       0.29%
ASTHMA               =>       0.28%
INMSUPR              =>       0.32%
HIPERTENSION         =>       0.30%
OTHER_DISEASE        =>       0.48%
CARDIOVASCULAR       =>       0.29%
OBESITY              =>       0.29%
RENAL_CHRONIC        =>       0.29%
TOBACCO              =>       0.31%
CLASIFFICATION_FINAL =>       0.00%
ICU                  =>      81.64%
GENDER               =>       0.00%
DEATH                =>       0.00%
Logistic regression model accuracy:0.94
Logistic Regression F1 Score : [0.96769158 0.51907982]

precision before undersampling  : 0.93
recall before undersampling : 0.94

Logistic Regression Accuracy after undersampling : 0.8959226207949275
Logistic Regression F1 Score after undersampling : [0.94093409 0.56259895]

precision after undersampling  : 0.95
recall after undersampling : 0.90
</code>```

and I did a Random Forest model that also had poor results.

I only did under sampling on training set because I do not want my model to be biased. Help me if you have another method or another machine learning model that will improve the results i will be grateful.

Body:
I have 1 million raw data points, and I dropped 2 independent variable because the have over 80% missing value.

All my variables are categorical except for "age" which I scaled between -1 and 1. Remaining were turned into dummy variables.

i want both of the F1 scores to be high [0.94093409 0.56259895] specially in the 0.5625

here is my features

sex: 1 for female and 2 for male.
age: of the patient.

classification: covid test findings. Values 1-3 mean that the patient was diagnosed with covid in different
degrees. 4 or higher means that the patient is not a carrier of covid or that the test is inconclusive.

patient type: type of care the patient received in the unit. 1 for returned home and 2 for hospitalization.

pneumonia: whether the patient already have air sacs inflammation or not.
pregnancy: whether the patient is pregnant or not.

diabetes: whether the patient has diabetes or not.

copd: Indicates whether the patient has Chronic obstructive pulmonary disease or not.

asthma: whether the patient has asthma or not.

inmsupr: whether the patient is immunosuppressed or not.

hypertension: whether the patient has hypertension or not.

cardiovascular: whether the patient has heart or blood vessels related disease.
renal chronic: whether the patient has chronic renal disease or not.

other disease: whether the patient has other disease or not.

obesity: whether the patient is obese or not.

tobacco: whether the patient is a tobacco user.

usmr: Indicates whether the patient treated medical units of the first, second or third level.

medical unit: type of institution of the National Health System that provided the care.

intubed: whether the patient was connected to the ventilator.

icu: Indicates whether the patient had been admitted to an Intensive Care Unit.

date died: If the patient died indicate the date of death, and 9999-99-99 otherwise.

  #Creating the dependent variable “DEATH”
covid['DEATH']= np.where(covid['DATE_DIED']=="9999-99-99",0,1)
covid['DEATH'].value_counts()
print('Data Shape :', covid.shape)
covid.info()

#Number of Unique Values by column

for col in covid.columns :
    print('{:<20} => {:>10}'.format(col, len(covid[col].unique())))

#Percentage of missing values
print('Percentage of missing values')
for col in covid.columns :
    print('{:<20} => {:>10.2f}%'.format(col, len(covid[(covid[col]==98) | (covid[col]==99) | (covid[col]==97)])/len(covid)*100))

covid['INTUBED'].value_counts()
covid['ICU'].value_counts()
covid['PREGNANT'].value_counts()

#Getting rid of the missing values of features except "INTUBED", "PREGNANT", "ICU"¶

cols = ['PNEUMONIA','DIABETES', 'COPD', 'ASTHMA', 'INMSUPR','HIPERTENSION',

           'OTHER_DISEASE', 'CARDIOVASCULAR', 'OBESITY','RENAL_CHRONIC', 'TOBACCO']
    for col in cols :
        covid = covid[(covid[col] == 1)|(covid[col] == 2)]
    # Converting process according to inference above
    covid.PREGNANT = covid.PREGNANT.replace(97,2)

    # Getting rid of the missing values
    covid = covid[(covid.PREGNANT == 1) | (covid.PREGNANT == 2)]

    covid.drop(columns=["INTUBED","ICU","DATE_DIED"], inplace=True)

 from pandas.core.indexing import convert_from_missing_indexer_tuple

from sklearn.preprocessing import RobustScaler
scaler = RobustScaler()
covid.AGE = scaler.fit_transform(covid.AGE.values.reshape(-1,1))

#dummy

corr=covid.corr()

#Creation of the first line in spearman correlation matrix:

corr["first line"]=["USMER","MEDICAL_UNIT","PATIENT_TYPE",
"PNEUMONIA","AGE","PREGNANT","DIABETES","COPD","ASTHMA","INMSUPR","HIPERTENSION","OTHER_DISEASE","CARDIOVASCULAR","OBESITY","RENAL_CHRONIC","TOBACCO","CLASIFFICATION_FINAL","GENDER","DEATH"]

corr1=0
var=[]
while (corr1< len(corr['DEATH'])):
     if (corr["DEATH"][corr1]>0.1 or corr["DEATH"][corr1]<-0.1 ):
          var.append(corr["first line"][corr1])
     corr1=corr1+1

print(" The variables that have a significant correlation with the dependant variable are: ",var)

# Replace values in data by "Value"_variable
df9=covid
other_variables=['AGE','DATE_DIED','DEATH']
col5=df9['USMER']
i=0
for col5 in df9:

  if (col5 not in other_variables and col5 in var):
    for i in range(1,98):
      head1=df9[col5].head(0)
      head_concate=str(i)+"_"+ str(head1)
      df9[col5]=df9[col5].replace(i,head_concate)

df12=covid["AGE"]
col6=df9['USMER']
for col6 in df9:
  if col6 not in other_variables and col6 in var :
       Dummy=pd.get_dummies(df9[col6], drop_first = True)
       df12=pd.concat([df12,Dummy],axis = 1)

y= covid['DEATH']
x= df12

logreg = LogisticRegression()
logreg.fit(train_x,train_y)
y1_pred=logreg.predict(test_x)

print('Logistic regression model accuracy:{:.2f}'.format(logreg.score(test_x,test_y)))
print("Logistic Regression F1 Score :",f1_score(test_y,logreg.predict(test_x),average=None))
print("Logistic Regression F1 Score :",f1_score(test_y,logreg.predict(test_x),average='weighted'))
print('precision before undersampling  : %.2f' % precision_score(test_y, logreg.predict(test_x),average='weighted' ))
print('recall before undersampling : %.2f' % recall_score(test_y, logreg.predict(test_x),average='weighted'))

from sklearn.metrics import confusion_matrix

#undersampling only for the training data
from imblearn.under_sampling import RandomUnderSampler

rus = RandomUnderSampler(random_state=0)
x_train_rus,y_train_rus = rus.fit_resample(train_x,train_y)

logreg_under = LogisticRegression()
logreg_under.fit(x_train_rus,y_train_rus)
print("Logistic Regression Accuracy after undersampling :",logreg_under.score(test_x, test_y))
print("Logistic Regression F1 Score after undersampling :",f1_score(test_y,logreg_under.predict(test_x),average=None))
print('F1_score: %.2f' % f1_score(test_y, logreg_under.predict(test_x),average='weighted'))
print('precision after undersampling  : %.2f' % precision_score(test_y, logreg_under.predict(test_x),average='weighted' ))
print('recall after undersampling : %.2f' % recall_score(test_y, logreg_under.predict(test_x),average='weighted'))

sns.heatmap(confusion_matrix(test_y, logreg_under.predict(test_x)), annot=True, fmt=".0f")
plt.title("Logistic Regression Confusion Matrix",fontsize=18, color="red");

the results are

     Percentage of missing values
USMER                =>       0.00%
MEDICAL_UNIT         =>       0.00%
PATIENT_TYPE         =>       0.00%
DATE_DIED            =>       0.00%
INTUBED              =>      81.62%
PNEUMONIA            =>       1.53%
AGE                  =>       0.03%
PREGNANT             =>      50.28%
DIABETES             =>       0.32%
COPD                 =>       0.29%
ASTHMA               =>       0.28%
INMSUPR              =>       0.32%
HIPERTENSION         =>       0.30%
OTHER_DISEASE        =>       0.48%
CARDIOVASCULAR       =>       0.29%
OBESITY              =>       0.29%
RENAL_CHRONIC        =>       0.29%
TOBACCO              =>       0.31%
CLASIFFICATION_FINAL =>       0.00%
ICU                  =>      81.64%
GENDER               =>       0.00%
DEATH                =>       0.00%
Logistic regression model accuracy:0.94
Logistic Regression F1 Score : [0.96769158 0.51907982]

precision before undersampling  : 0.93
recall before undersampling : 0.94

Logistic Regression Accuracy after undersampling : 0.8959226207949275
Logistic Regression F1 Score after undersampling : [0.94093409 0.56259895]

precision after undersampling  : 0.95
recall after undersampling : 0.90

and I did a Random Forest model that also had poor results.

I only did under sampling on training set because I do not want my model to be biased. Help me if you have another method or another machine learning model that will improve the results i will be grateful.


问:
React url with two slash
When i use this url in localhost it can work properly

```<code><Route path="/updateProduct/:id"  element={<UpdateProduct/>} />
</code>```

But why if I host the website on a server it cannot work properly? I only can use the link that only has one "/", For exmaple

```<code><Route path="/updateProduct"  element={<UpdateProduct/>} />
<Route path="/addProduct"  element={<UpdateProduct/>} />
</code>```

How do I solve it?

Title: React url with two slash

Body:
When i use this url in localhost it can work properly

<Route path="/updateProduct/:id"  element={<UpdateProduct/>} />

But why if I host the website on a server it cannot work properly? I only can use the link that only has one "/", For exmaple

<Route path="/updateProduct"  element={<UpdateProduct/>} />
<Route path="/addProduct"  element={<UpdateProduct/>} />

How do I solve it?


问:
Rollup: Create a generic main.js that imports built JS file
I want to access a consistent script from HTML that always returns the latest built assets of rollup via vite. I see that one can gain awareness of the file name via manifest.json and but I want to generate a JS file like

```<code>import "_main-03d3g4.js"
</code>```

that I can point a script at and that dynamically updates every build. This is similar to how an index file gets an updated script src in rollup-plugin-generate-html-template

Body:
I want to access a consistent script from HTML that always returns the latest built assets of rollup via vite. I see that one can gain awareness of the file name via manifest.json and but I want to generate a JS file like

import "_main-03d3g4.js"

that I can point a script at and that dynamically updates every build. This is similar to how an index file gets an updated script src in rollup-plugin-generate-html-template


问:
SQL Create view with a row whose column value depends on if another row exist in a separate table
How can I create a view where the view is simply

name
exist_check

foo
false

The exist_check column is dependent on if a select query in another table returns anything or not.

For example

```<code>SELECT *
FROM foo_table
WHERE name = 'foo'
</code>```

If that returns anything, exist_check in the view should be true. If it returns nothing, exist_check should be false.

Body:
How can I create a view where the view is simply

name
exist_check

foo
false

The exist_check column is dependent on if a select query in another table returns anything or not.

For example

SELECT *
FROM foo_table
WHERE name = 'foo'

If that returns anything, exist_check in the view should be true. If it returns nothing, exist_check should be false.


问:
How can I print the variable name itself in dart?
I used to do this CPP, to debug my code quickly.

code.cpp:

#define bug(x) cout << #x << ": " << x << '\n'

int main() {
    int a = 5;
    bug(a);

    int b = 3;
    bug(b);

    return 0;
}
```
<p><strong>output:</strong></p>
```a: 5
b: 3
```
<p>what this does is, it print the variable name along with it's value dynamically.</p>
<p>now I am trying to make something like this in dart, but couldn't find anything.</p>
<p>can such thing be even done in dart ?? btw, if you a better debug practice, please let me know :)</p>
<p>I searched on StackOverflow, but couldn't find anything:</p>
<ul>
<li>Get Variables name by it's value in Dart Lang:
<ul>
<li>the answer mentioned only prints the value from a map, but what I am asking is to print the variable name itself (<code>a</code>, <code>b</code>) along their value (<code>5</code>, <code>3</code>)</li>
<li>and using <code>reflectable</code> prints the variable name by passing value, but I simply want to print variable name by passing variable itself.</li>
</ul>
</li>
</ul>
<p>I even asked ChatGPT, but this is what it came up with:</p>
<pre class="lang-dart prettyprint-override"><code>void bug(var x) {
  print('$x: ${x.toString()}');
}

void main() {
  int x = 5;
  bug(x);
}
</code>```

not useful at all :facepalm:, as this will print 5: 5.

Body:
I used to do this CPP, to debug my code quickly.

code.cpp:

#define bug(x) cout << #x << ": " << x << '\n'

int main() {
    int a = 5;
    bug(a);

    int b = 3;
    bug(b);

    return 0;
}

output:

a: 5
b: 3

what this does is, it print the variable name along with it's value dynamically.

now I am trying to make something like this in dart, but couldn't find anything.

can such thing be even done in dart ?? btw, if you a better debug practice, please let me know :)

I searched on StackOverflow, but couldn't find anything:

Get Variables name by it's value in Dart Lang:

the answer mentioned only prints the value from a map, but what I am asking is to print the variable name itself (a, b) along their value (5, 3)

and using reflectable prints the variable name by passing value, but I simply want to print variable name by passing variable itself.

I even asked ChatGPT, but this is what it came up with:

void bug(var x) {
  print('$x: ${x.toString()}');
}

void main() {
  int x = 5;
  bug(x);
}

not useful at all :facepalm:, as this will print 5: 5.