Title: Add a moving arrow to the svg line with mask on scroll

Body:
I have a dashed svg line that is being drawn on scroll. How can I attach an arrow to it, so it moves together with the line?

Here is my code:

import '../css/theArrow.css'
import React, { useEffect } from 'react';

export default function TheArrow() {

  useEffect(() => {
    var l = thePath.getTotalLength();
    var dasharray = l;
    mask.style.strokeDasharray = dasharray;
    var dashoffset = l;
    mask.style.strokeDashoffset = dashoffset;
    window.addEventListener("scroll", function() {
      dashoffset = l - window.scrollY * l / (wrap.scrollHeight - wrap.clientHeight) - 300;
      mask.style.strokeDashoffset = dashoffset;
    });
  }, [window.onscroll])

  return (

      <svg
        id="svg"
        viewBox="0 0 370 1856"
        fill="none"
        preserveAspectRatio="xMidYMax meet"
      >
        <defs>
        <marker id="arrow" viewBox="-10 -5 10 10" refX="5" refY="0" markerWidth="4" markerHeight="4" orient="auto">
          <path className="cool arrowHead" d="M0,-5L10,0L0,5" ></path>
        </marker>
        </defs>
        <defs>
          <path
          id="thePath"
          d="M164.876 1C171.043 44.1667 143.139 77.3269 70.6388 108C-33.3612 152 9.13878 264 18.6388 353.5C24.4115 407.886 47.2145 492.854 132.814 534.054C239.814 585.554 319.217 442.842 244.639 343C200.901 284.446 45.9382 328.5 59.4382 474.5C70.2382 591.3 163.472 640.833 204.639 655C220.139 662 249.676 668.1 252.876 716.5C256.876 777 266.713 891.554 192.876
          932.5C172.139 944 38.8763 992 38.8763 1141.5C38.8763 1261.1 38.8763 1455 38.8763 1537C38.8763 1540 43.4388 1544 50.6388 1544C57.8388 1544 178.876 1544 238.876 1544C254.376 1543.5 285.376 1547.5 285.376 1559.5C285.376 1574.5 290.876 1596 336.876 1596C382.876 1596 338.133 1641.82 353.876 1709C383.639 1836 371.639 1853.26 230.139 1853.26"
          stroke="#FFCC00"
          strokeWidth="6"
          markerEnd="url(#arrow)"
          />

      <mask id="mask1">
        <use id="mask" xlinkHref="#thePath" />
      </mask>

        </defs>
      <use xlinkHref="#thePath" strokeDasharray="8 6" stroke="black" mask="url(#mask1)"/>

      </svg>

  )
}

I tried calculating the current coordinates of the end of the line that is being drawn, but couldn't get my head around it.


来源: stackexchange

问:
How to provide data from custom Magnolia app in Magnolia component?
I've created a custom Magnolia app where you can create locations with some properties. So far so good, but I don't want to make a separate API call to fetch the data from the app. Instead I want to provide the data in a component.

At the moment I've to make an API call to fetch the data from the app, but I want to have the data within my component, when I make a call for the whole page where the component is used.

ContentLicense: CC BY-SA 4.0


问:
How to load a FBX file to a RenderControl of AnyCad in .NET application?
I need to display a 3D model from FBX file by loading it to the RenderControl of AnyCad library

Loading a 3D model from a file

```<code> public partial class Form1 : Form
    {
        RenderControl mRenderView;
        //Control
        public Form1()
        {
            InitializeComponent();
            mRenderView = new RenderControl(this.splitContainer1.Panel2);
            //mPropView

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            if (mRenderView != null)
            {
                mRenderView.ShowCoordinateGrid(true);
                mRenderView.SetBackgroundColor(0.5f, 0f, 0f, 1f);
                mRenderView.SetViewCube(EnumViewCoordinateType.Axis);
                var shape = ShapeBuilder.MakeSphere(new GPnt(0, 0, 0),50); // I need to open the file in this step
                mRenderView.ShowShape(shape, ColorTable.Beige);
            }

        }
    }
</code>```

Body:
I need to display a 3D model from FBX file by loading it to the RenderControl of AnyCad library

Loading a 3D model from a file

 public partial class Form1 : Form
    {
        RenderControl mRenderView;
        //Control
        public Form1()
        {
            InitializeComponent();
            mRenderView = new RenderControl(this.splitContainer1.Panel2);
            //mPropView

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            if (mRenderView != null)
            {
                mRenderView.ShowCoordinateGrid(true);
                mRenderView.SetBackgroundColor(0.5f, 0f, 0f, 1f);
                mRenderView.SetViewCube(EnumViewCoordinateType.Axis);
                var shape = ShapeBuilder.MakeSphere(new GPnt(0, 0, 0),50); // I need to open the file in this step
                mRenderView.ShowShape(shape, ColorTable.Beige);
            }

        }
    }


问:
@each in Sass does not work when only one element is used
```<code>In Sass document, @each does not mention only one element.

https://sass-lang.com/documentation/at-rules/control/each

It works well when multiple elements are used as in the example.
under the code I used.

</code>```

send

```<code>@include buttonSelect(
    (
        "album-clear" $button-default-color,
        "album-preview" $button-sub-color,
        "album-add" $button-main-color
    )
);
</code>```

accept

```<code>@mixin buttonSelect($buttons) {

  @each $name, $color in $buttons {
    .#{$name}-button {
      color: $color;
      border-color: $color;
    }
  }
}
</code>```

But, when only one element is used, it expresses the following error.
under, code with error

send

```<code>@include buttonSelect(("inspect-write" $button-main-color));
</code>```

error

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

Module build failed (from ./node_modules/react-scripts/node_modules/sass-loader/dist/cjs.js):
SassError: argument $color of rgba($color, $alpha) must be a color
on line 21 of src/views/scss/mixins/button.scss, in function rgba
from line 21 of src/views/scss/mixins/button.scss, in mixin buttonSelect
from line 27 of src/views/components/modal/exception/AlbumInspect.scss

```<code>    background-color: rgba($color: $color, $alpha: 1);
</code>```

--------------------------^

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

why?

Body:
In Sass document, @each does not mention only one element.

https://sass-lang.com/documentation/at-rules/control/each

It works well when multiple elements are used as in the example.
under the code I used.

send

@include buttonSelect(
    (
        "album-clear" $button-default-color,
        "album-preview" $button-sub-color,
        "album-add" $button-main-color
    )
);

accept

@mixin buttonSelect($buttons) {

  @each $name, $color in $buttons {
    .#{$name}-button {
      color: $color;
      border-color: $color;
    }
  }
}

But, when only one element is used, it expresses the following error.
under, code with error

send

@include buttonSelect(("inspect-write" $button-main-color));

error

Module build failed (from ./node_modules/react-scripts/node_modules/sass-loader/dist/cjs.js):
SassError: argument $color of rgba($color, $alpha) must be a color
on line 21 of src/views/scss/mixins/button.scss, in function rgba
from line 21 of src/views/scss/mixins/button.scss, in mixin buttonSelect
from line 27 of src/views/components/modal/exception/AlbumInspect.scss

    background-color: rgba($color: $color, $alpha: 1);

--------------------------^

why?


问:
GPT-3 codex doc sample for explanations doesn't provide explanation
In the docs is this example:

```<code>SELECT DISTINCT department.name
FROM department
JOIN employee ON department.id = employee.department_id
JOIN salary_payments ON employee.id = salary_payments.employee_id
WHERE salary_payments.date BETWEEN '2020-06-01' AND '2020-06-30'
GROUP BY department.name
HAVING COUNT(employee.id) > 10;
-- Explanation of the above query in human readable format
--
</code>```

I have tried copying this into the playground with code-davinci-002 but it just spews out the same query over and over again.

ChatGPT/davinci-003 works fine but the actual codex cant handle it's own sample from it's docs.

Is code-davinci-002 capable of writing explanations of code?

Body:
In the docs is this example:

SELECT DISTINCT department.name
FROM department
JOIN employee ON department.id = employee.department_id
JOIN salary_payments ON employee.id = salary_payments.employee_id
WHERE salary_payments.date BETWEEN '2020-06-01' AND '2020-06-30'
GROUP BY department.name
HAVING COUNT(employee.id) > 10;
-- Explanation of the above query in human readable format
--

I have tried copying this into the playground with code-davinci-002 but it just spews out the same query over and over again.

ChatGPT/davinci-003 works fine but the actual codex cant handle it's own sample from it's docs.

Is code-davinci-002 capable of writing explanations of code?


问:
The dropdown calculation in react to select the remaining tickets
I have 4 seperate dropdown boxes. Consider if ticket value is 5 all boxes in selection should display 1-5 for selection.If I select 3 in anyone of the boxes the remaining boxes should display 1 or 2 in selection.If I select 2 in next box the remaining boxes should display 0 for selection But I don't know how to achive it.insted it display 5 for all dropdown for selection.How can I achive the solution.</p>
```<code>import { useState } from "react";
const Example = () => {
  const [numTickets, setNumTickets] = useState(5);
  const [selectedValues, setSelectedValues] = useState({
    adultNonVeg: "0",
    childNonVeg: "0",
    adultVeg: "0",
    childVeg: "0",
  });

  function handleChange(event, name) {
    const value = event.target.value;
    setSelectedValues({ ...selectedValues, [name]: value });
  }

  return (
    <div>
      <label>
        Number of tickets:
        <input
          type="number"
          value={numTickets}
          onChange={(event) => setNumTickets(event.target.value)}
        />
      </label>
      <br />
      <label>
        Adult Non-Veg:
        <select
          value={selectedValues.adultNonVeg}
          onChange={(event) => handleChange(event, "adultNonVeg")}
        >
          <option value="0">Select an option</option>
          {[...Array(numTickets)].map((it, i) => (
            <option key={i + 1} value={i + 1}>
              {i + 1}
            </option>
          ))}
        </select>
      </label>
      <br />
      <label>
        Child Non-Veg:
        <select
          value={selectedValues.childNonVeg}
          onChange={(event) => handleChange(event, "childNonVeg")}
        >
          <option value="0">Select an option</option>
          {[...Array(numTickets)].map((it, i) => (
            <option key={i + 1} value={i + 1}>
              {i + 1}
            </option>
          ))}
        </select>
      </label>
      <br />
      <label>
        Adult Veg:
        <select
          value={selectedValues.adultVeg}
          onChange={(event) => handleChange(event, "adultVeg")}
        >
          <option value="0">Select an option</option>
          {[...Array(numTickets)].map((it, i) => (
            <option key={i + 1} value={i + 1}>
              {i + 1}
            </option>
          ))}
        </select>
      </label>
      <br />
      <label>
        Child Veg:
        <select
          value={selectedValues.childVeg}
          onChange={(event) => handleChange(event, "childVeg")}
        >
          <option value="0">Select an option</option>
          {[...Array(numTickets)].map((it, i) => (
            <option key={i + 1} value={i + 1}>
              {i + 1}
            </option>
          ))}
        </select>
      </label>
    </div>
  );
};
export default Example;
</code>```

Body:
I have 4 seperate dropdown boxes. Consider if ticket value is 5 all boxes in selection should display 1-5 for selection.If I select 3 in anyone of the boxes the remaining boxes should display 1 or 2 in selection.If I select 2 in next box the remaining boxes should display 0 for selection But I don't know how to achive it.insted it display 5 for all dropdown for selection.How can I achive the solution.

import { useState } from "react";
const Example = () => {
  const [numTickets, setNumTickets] = useState(5);
  const [selectedValues, setSelectedValues] = useState({
    adultNonVeg: "0",
    childNonVeg: "0",
    adultVeg: "0",
    childVeg: "0",
  });

  function handleChange(event, name) {
    const value = event.target.value;
    setSelectedValues({ ...selectedValues, [name]: value });
  }

  return (

        Number of tickets:
        <input
          type="number"
          value={numTickets}
          onChange={(event) => setNumTickets(event.target.value)}
        />

        Adult Non-Veg:
        <select
          value={selectedValues.adultNonVeg}
          onChange={(event) => handleChange(event, "adultNonVeg")}
        >
          <option value="0">Select an option</option>
          {[...Array(numTickets)].map((it, i) => (
            <option key={i + 1} value={i + 1}>
              {i + 1}
            </option>
          ))}
        </select>

        Child Non-Veg:
        <select
          value={selectedValues.childNonVeg}
          onChange={(event) => handleChange(event, "childNonVeg")}
        >
          <option value="0">Select an option</option>
          {[...Array(numTickets)].map((it, i) => (
            <option key={i + 1} value={i + 1}>
              {i + 1}
            </option>
          ))}
        </select>

        Adult Veg:
        <select
          value={selectedValues.adultVeg}
          onChange={(event) => handleChange(event, "adultVeg")}
        >
          <option value="0">Select an option</option>
          {[...Array(numTickets)].map((it, i) => (
            <option key={i + 1} value={i + 1}>
              {i + 1}
            </option>
          ))}
        </select>

        Child Veg:
        <select
          value={selectedValues.childVeg}
          onChange={(event) => handleChange(event, "childVeg")}
        >
          <option value="0">Select an option</option>
          {[...Array(numTickets)].map((it, i) => (
            <option key={i + 1} value={i + 1}>
              {i + 1}
            </option>
          ))}
        </select>

  );
};
export default Example;


问:
Error with command Selection.Insert Shift:=xlDown
I'm trying to run the following code to add one empty line, but it only works if I run the macro as soon as I open the excel:

```<code>Sub LinhasAuto()
Dim lRow As Long
Dim RepeatFactor As Variant

lRow = 11
Do While (Cells(lRow, "A") <> "")

RepeatFactor = Cells(lRow, "AO")
If ((RepeatFactor > 0) And IsNumeric(RepeatFactor)) Then

Range(Cells(lRow, "A"), Cells(lRow, "AT")).Copy
Range(Cells(lRow + 1, "A"), Cells(lRow + RepeatFactor, "AT")).Select
Selection.Insert Shift:=xlDown

lRow = lRow + RepeatFactor
End If

lRow = lRow + 1
Loop
End Sub
</code>```

If i change anything in the file after open it up and before run the code, I get the following error:

Run-time error '-2147417848 (80010108)':
Automation error

Thanks for your help!

Body:
I'm trying to run the following code to add one empty line, but it only works if I run the macro as soon as I open the excel:

Sub LinhasAuto()
Dim lRow As Long
Dim RepeatFactor As Variant

lRow = 11
Do While (Cells(lRow, "A") <> "")

RepeatFactor = Cells(lRow, "AO")
If ((RepeatFactor > 0) And IsNumeric(RepeatFactor)) Then

Range(Cells(lRow, "A"), Cells(lRow, "AT")).Copy
Range(Cells(lRow + 1, "A"), Cells(lRow + RepeatFactor, "AT")).Select
Selection.Insert Shift:=xlDown

lRow = lRow + RepeatFactor
End If

lRow = lRow + 1
Loop
End Sub

If i change anything in the file after open it up and before run the code, I get the following error:

Run-time error '-2147417848 (80010108)':
Automation error

Thanks for your help!


问:
I want to catch and mte(encode) every data that is going from my windows machine to another windows machine from a openvpn tunnel using python
I just want to catch data and mte that data and then send to other machine. I am using python. But i think i am at dead end.

I have tried every place to found a soultion. But I did not found.


问:
How can we set tint html color for image?
I want to change my image color dynamically with HTML color codes or RGBA for png image.

```<code><img  src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQeSIKRkAOaco7-ho-0VMICMF7ZeF3LE21NsQ&usqp=CAU" alt="logo"></img>
</code>```

How is this possible?

Body:
I want to change my image color dynamically with HTML color codes or RGBA for png image.

How is this possible?


问:
CartScreen Qty value doesn't update in screen or in redux state
Hey im having issues with my code; my Quantity value wont change after using addToCart function inside a Form of bootstrap.
In the Redux-Devtools it shows in 'action' that the qty is changing; although in the state it isn't. full repository in end of post.

This is the specific Code which captures + addToCart the qty by form in CartScreen.js:

```<code>      <Form.Control
                      as='select'
                      value={item.qty}
                      onChange={(e) =>
                        dispatch(
                          addToCart(item.product, Number(e.target.value))
                        )
                      }
                    >
                      {[...Array(item.countInStock).keys()].map((x) => (
                        <option key={x + 1} value={x + 1}>
                          {x + 1}
                        </option>
                      ))}
                    </Form.Control>
</code>```

This is the Full CartScreen.js file for full scope.

```<code>import React, { useEffect } from 'react';
import { Link, useNavigate, useParams, useLocation } from 'react-router-dom';
import { useDispatch, useSelector } from 'react-redux';
import {
  Row,
  Col,
  ListGroup,
  Image,
  Form,
  Button,
  Card,
} from 'react-bootstrap';
import Message from '../components/Message';
import { addToCart } from '../actions/cartActions';

const CartScreen = () => {
  //   const navigate = useNavigate();
  const queryParams = new URLSearchParams(window.location.search);
  const qty = queryParams ? Number(queryParams.get('qty')) : 1;
  const { id } = useParams();
  const productId = id;
  const dispatch = useDispatch();
  const cart = useSelector((state) => state.cart);
  const { cartItems } = cart;

  useEffect(() => {
    if (productId) {
      dispatch(addToCart(productId, qty));
    }
  }, [dispatch, productId, qty]);

  const removeFromCartHandler = (id) => {
    console.log('remove');
  };
  const checkoutHandler = (id) => {
    console.log('remove');
  };

  return (
    <Row>
      <Col md={8}>
        <h1>Shopping Cart</h1>
        {cartItems.length === 0 ? (
          <Message>
            Your cart is empty <Link to='/'>Go Back</Link>
          </Message>
        ) : (
          <ListGroup variant='flush'>
            {cartItems.map((item) => (
              <ListGroup.Item key={item.product}>
                <Row>
                  <Col md={2}>
                    <Image src={item.image} alt={item.name} fluid rounded />
                  </Col>
                  <Col md={3}>
                    <Link to={`/product/${item.product}`}>{item.name}</Link>
                  </Col>
                  <Col md={2}>${item.price}</Col>
                  <Col md={2}>
                    <Form.Control
                      as='select'
                      value={item.qty}
                      onChange={(e) =>
                        dispatch(
                          addToCart(item.product, Number(e.target.value))
                        )
                      }
                    >
                      {[...Array(item.countInStock).keys()].map((x) => (
                        <option key={x + 1} value={x + 1}>
                          {x + 1}
                        </option>
                      ))}
                    </Form.Control>
                  </Col>
                  <Col md={2}>
                    <Button
                      type='button'
                      variant='light'
                      onClick={() => removeFromCartHandler(item.product)}
                    >
                      <i className='fas fa-trash'></i>
                    </Button>
                  </Col>
                </Row>
              </ListGroup.Item>
            ))}
          </ListGroup>
        )}
      </Col>
      <Col md={4}>
        <Card>
          <ListGroup variant='flush'>
            <ListGroup.Item>
              <h2>
                Subtotal ({cartItems.reduce((acc, item) => acc + item.qty, 0)})
                items
              </h2>
              $
              {cartItems
                .reduce((acc, item) => acc + item.qty * item.price, 0)
                .toFixed(2)}
            </ListGroup.Item>
            <ListGroup.Item>
              <Button
                type='button'
                className='btn-block'
                disabled={cartItems.length === 0}
                onClick={checkoutHandler}
              >
                Proceed To Checkout
              </Button>
            </ListGroup.Item>
          </ListGroup>
        </Card>
      </Col>
    </Row>
  );
};

export default CartScreen;

</code>```

I was trying to change the values but nothing helps to change the state, However the CART_ADD_ITEM Function does run on change as supposed to, just Not changing the state or adding to the cart.
I can add the rest of the files here aswell.

Edit:
That's the repository for the full files:
https://github.com/IdanKfir/Proshop

Body:
Hey im having issues with my code; my Quantity value wont change after using addToCart function inside a Form of bootstrap.
In the Redux-Devtools it shows in 'action' that the qty is changing; although in the state it isn't. full repository in end of post.

This is the specific Code which captures + addToCart the qty by form in CartScreen.js:

      <Form.Control
                      as='select'
                      value={item.qty}
                      onChange={(e) =>
                        dispatch(
                          addToCart(item.product, Number(e.target.value))
                        )
                      }
                    >
                      {[...Array(item.countInStock).keys()].map((x) => (
                        <option key={x + 1} value={x + 1}>
                          {x + 1}
                        </option>
                      ))}
                    </Form.Control>

This is the Full CartScreen.js file for full scope.

import React, { useEffect } from 'react';
import { Link, useNavigate, useParams, useLocation } from 'react-router-dom';
import { useDispatch, useSelector } from 'react-redux';
import {
  Row,
  Col,
  ListGroup,
  Image,
  Form,
  Button,
  Card,
} from 'react-bootstrap';
import Message from '../components/Message';
import { addToCart } from '../actions/cartActions';

const CartScreen = () => {
  //   const navigate = useNavigate();
  const queryParams = new URLSearchParams(window.location.search);
  const qty = queryParams ? Number(queryParams.get('qty')) : 1;
  const { id } = useParams();
  const productId = id;
  const dispatch = useDispatch();
  const cart = useSelector((state) => state.cart);
  const { cartItems } = cart;

  useEffect(() => {
    if (productId) {
      dispatch(addToCart(productId, qty));
    }
  }, [dispatch, productId, qty]);

  const removeFromCartHandler = (id) => {
    console.log('remove');
  };
  const checkoutHandler = (id) => {
    console.log('remove');
  };

  return (
    <Row>
      <Col md={8}>

Shopping Cart

        {cartItems.length === 0 ? (
          <Message>
            Your cart is empty <Link to='/'>Go Back</Link>
          </Message>
        ) : (
          <ListGroup variant='flush'>
            {cartItems.map((item) => (
              <ListGroup.Item key={item.product}>
                <Row>
                  <Col md={2}>
                    <Image src={item.image} alt={item.name} fluid rounded />
                  </Col>
                  <Col md={3}>
                    <Link to={`/product/${item.product}`}>{item.name}</Link>
                  </Col>
                  <Col md={2}>${item.price}</Col>
                  <Col md={2}>
                    <Form.Control
                      as='select'
                      value={item.qty}
                      onChange={(e) =>
                        dispatch(
                          addToCart(item.product, Number(e.target.value))
                        )
                      }
                    >
                      {[...Array(item.countInStock).keys()].map((x) => (
                        <option key={x + 1} value={x + 1}>
                          {x + 1}
                        </option>
                      ))}
                    </Form.Control>
                  </Col>
                  <Col md={2}>
                    <Button
                      type='button'
                      variant='light'
                      onClick={() => removeFromCartHandler(item.product)}
                    >

                    </Button>
                  </Col>
                </Row>
              </ListGroup.Item>
            ))}
          </ListGroup>
        )}
      </Col>
      <Col md={4}>
        <Card>
          <ListGroup variant='flush'>
            <ListGroup.Item>

                Subtotal ({cartItems.reduce((acc, item) => acc + item.qty, 0)})
                items

              $
              {cartItems
                .reduce((acc, item) => acc + item.qty * item.price, 0)
                .toFixed(2)}
            </ListGroup.Item>
            <ListGroup.Item>
              <Button
                type='button'
                className='btn-block'
                disabled={cartItems.length === 0}
                onClick={checkoutHandler}
              >
                Proceed To Checkout
              </Button>
            </ListGroup.Item>
          </ListGroup>
        </Card>
      </Col>
    </Row>
  );
};

export default CartScreen;

I was trying to change the values but nothing helps to change the state, However the CART_ADD_ITEM Function does run on change as supposed to, just Not changing the state or adding to the cart.
I can add the rest of the files here aswell.

Edit:
That's the repository for the full files:
https://github.com/IdanKfir/Proshop


问:
Can we set the order of the nodes in one layer by edges using dot to draw a tree diagram?
How to set the order of the nodes in one layer by the order of the definition of edges rather than the definition of nodes when using dot to draw a tree diagram?

For example,
For some reasons i need to first define node1, node2, and node3,
and then draw the edges: node3 -> node2, and node3 -> node1,
and i hope that the edges are drawn as they are defined.

below are the .dot files

```<code>digraph G {
    node1 [label = 1];
    node2 [label = 2];
    node3 [label = 3];
    node3 -> node2;
    node3 -> node1;
}
</code>```

but I want it to be like this:

How can i realize this? Thank you for help.

How to set the order of the nodes in one layer by the order of the definition of edges rather than the definition of nodes when using dot to draw a tree diagram?

Body:
How to set the order of the nodes in one layer by the order of the definition of edges rather than the definition of nodes when using dot to draw a tree diagram?

For example,
For some reasons i need to first define node1, node2, and node3,
and then draw the edges: node3 -> node2, and node3 -> node1,
and i hope that the edges are drawn as they are defined.

below are the .dot files

digraph G {
    node1 [label = 1];
    node2 [label = 2];
    node3 [label = 3];
    node3 -> node2;
    node3 -> node1;
}

but I want it to be like this:

How can i realize this? Thank you for help.

How to set the order of the nodes in one layer by the order of the definition of edges rather than the definition of nodes when using dot to draw a tree diagram?


问:
Analyze REST API performance
Are there any tools to analyze the REST API performance specifically the response time, to figure out why API is slow ? These APIs are built using spring boot</p>

Title: Analyze REST API performance


问:
Laravel broadcast pusher is not working in server
Everything works fine on my local server
But in the server it is not working

There are no errors in the server

i'm checked

broadcasting.php file

```<code>        'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER'),
                'useTLS' => true,
            ],
        ]
</code>```

.env file

```<code>BROADCAST_DRIVER=pusher

PUSHER_APP_ID=my-pusher-app-id
PUSHER_APP_KEY=my-pusher-key
PUSHER_APP_SECRET=my-pusher-secret
PUSHER_APP_CLUSTER=mt1
</code>```
```<code>use App\Events\MyEvent;

        MyEvent::dispatch($id);
        broadcast(new MyEvent($id));
        event(new MyEvent($id));

</code>```

installed
composer require pusher/pusher-php-server

```<code>php artisan config:clear
</code>```

config/app.php file

```<code>App\Providers\BroadcastServiceProvider::class
</code>```

Why does it works local server but not in the real server?

Body:
Everything works fine on my local server
But in the server it is not working

There are no errors in the server

i'm checked

broadcasting.php file

        'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER'),
                'useTLS' => true,
            ],
        ]

.env file

BROADCAST_DRIVER=pusher

PUSHER_APP_ID=my-pusher-app-id
PUSHER_APP_KEY=my-pusher-key
PUSHER_APP_SECRET=my-pusher-secret
PUSHER_APP_CLUSTER=mt1

use App\Events\MyEvent;

        MyEvent::dispatch($id);
        broadcast(new MyEvent($id));
        event(new MyEvent($id));

installed
composer require pusher/pusher-php-server

php artisan config:clear

config/app.php file

App\Providers\BroadcastServiceProvider::class

Why does it works local server but not in the real server?


问:
How to create css shape for calendar (see image)
I dont know how add those semi-circles at the middle, so that they gnaw off that area, and it would be possible to add filter: drop-shadow on whole element.
I already use ::after/before, but I need background color on them transparent, so filter: drop-shadow will work, but with transparent color these elements not visible.


问:
How i can create two differet sites on apache 2.2 / windows server
In my case, all domains redirect to memberspage.com when I enter domain names in the browser.

In httpd.conf i use:

```<code>Listen 80
Listen 81
</code>```

In httpd-vhosts.conf:

```<code><VirtualHost *:80>
    ServerAdmin admin@gmail.com
    ServerName memberspage.com
    ServerAlias www.memberspage.com
    DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/memberspage.com/"
    <Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/memberspage.com/">
        Options Indexes FollowSymLinks
        AllowOverride All
        #Require all granted
    </Directory>
    <IfModule mod_dir.c>
        DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
    </IfModule>
</VirtualHost>

<VirtualHost *:81>
    ServerAdmin admin@gmail.com
    ServerName mysite2.com
    ServerAlias mysite2.com
    DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mysite2.com/"
    <Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mysite2.com/">
        Options Indexes FollowSymLinks
        AllowOverride All
        #Require all granted
    </Directory>
    <IfModule mod_dir.c>
        DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
    </IfModule>
</VirtualHost>
</code>```

And in hosts:

```<code>127.0.0.1       memberspage.com
127.0.0.1       mysite2.com
</code>```

Body:
In my case, all domains redirect to memberspage.com when I enter domain names in the browser.

In httpd.conf i use:

Listen 80
Listen 81

In httpd-vhosts.conf:

<VirtualHost *:80>
    ServerAdmin admin@gmail.com
    ServerName memberspage.com
    ServerAlias www.memberspage.com
    DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/memberspage.com/"
    <Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/memberspage.com/">
        Options Indexes FollowSymLinks
        AllowOverride All
        #Require all granted
    </Directory>
    <IfModule mod_dir.c>
        DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
    </IfModule>
</VirtualHost>

<VirtualHost *:81>
    ServerAdmin admin@gmail.com
    ServerName mysite2.com
    ServerAlias mysite2.com
    DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mysite2.com/"
    <Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mysite2.com/">
        Options Indexes FollowSymLinks
        AllowOverride All
        #Require all granted
    </Directory>
    <IfModule mod_dir.c>
        DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
    </IfModule>
</VirtualHost>

And in hosts:

127.0.0.1       memberspage.com
127.0.0.1       mysite2.com


问:
Visualisation another dependencies under/above x axis in Matplotlib
I would like to add second independent x-axis into graph... I think, it's better to show actual picture. enter image description here
I have a graph that shows the dependence of energy on distance... And also I have another information, which i need to add to the graph. In the picture, I show it as a stripes of color and different color represents diferent value (normaly from e.g. 0-10)
I use matplotlib in python. Data is stored in the pandas library. "method" contains number for different color.

Pandas dataset(output from terminal):

```<code>
  distance  discs  E_ub  E_lb  SavGoy_lb  SavGoy_ub  method
0    0.000000      0  -2.7  -2.7  -2.730672  -2.654917       0
1    0.269943      1  -2.5  -2.7  -2.695078  -2.651095       0
2    0.539909      2  -2.8  -2.8  -2.697831  -2.660829       1
3    0.809902      3  -2.7  -2.7  -2.721566  -2.666852       1
4    1.011805      4  -2.6  -2.7  -2.753260  -2.657803       2
..        ...    ...   ...   ...        ...        ...     ...
93  16.661845     93  -2.0  -2.0  -1.912246  -1.881990       1
94  16.861845     94  -1.9  -1.9  -1.852786  -1.832744       1
95  17.061845     95  -1.8  -1.8  -1.820197  -1.814021       1
96  17.261845     96  -1.8  -1.9  -1.859792  -1.853782       2
98  17.461845     98  -2.0  -2.0  -2.033249  -1.985779       2
</code>```

Python code:

```<code>energy_dat = {'distance': distances, 'discs': discs, 'E_ub': energies_ub_max,
              'E_lb': energies_lb, 'SavGoy_lb': yhat_lb, 'SavGoy_ub': yhat_ub,
              'method': a }`

df = pd.DataFrame(energy_dat, discs)
plt.xlabel('Trajectory [Å]')
plt.ylabel('Binding energy [kcal/mol]')
.
.
.
cmap = plt.cm.get_cmap('Set3')
for c in df['discs']:
    if c == len(df['discs']):
        plt.axvspan(c-1, c, color=cmap.colors[df.loc[c, 'method']])
    else:
        plt.axvspan(c, c+1, color=cmap.colors[df.loc[c, 'method']])

legend = [Patch(facecolor=cmap.colors[c], label=c) for c in df['method'].unique()]
plt.legend(handles=legend)
</code>```

My problem is, that I wanna add a new line under/above the graph, where I can show an interval of each value. E.g from 0-10 -> 1; 10-50 -> 0; 60-55 ->2;...
of course even better with color representation.

My question is how can I add another row below/above the graph with the new dependency so that the result looks like the picture.enter image description here

Thank you.

Body:
I would like to add second independent x-axis into graph... I think, it's better to show actual picture. enter image description here
I have a graph that shows the dependence of energy on distance... And also I have another information, which i need to add to the graph. In the picture, I show it as a stripes of color and different color represents diferent value (normaly from e.g. 0-10)
I use matplotlib in python. Data is stored in the pandas library. "method" contains number for different color.

Pandas dataset(output from terminal):

  distance  discs  E_ub  E_lb  SavGoy_lb  SavGoy_ub  method
0    0.000000      0  -2.7  -2.7  -2.730672  -2.654917       0
1    0.269943      1  -2.5  -2.7  -2.695078  -2.651095       0
2    0.539909      2  -2.8  -2.8  -2.697831  -2.660829       1
3    0.809902      3  -2.7  -2.7  -2.721566  -2.666852       1
4    1.011805      4  -2.6  -2.7  -2.753260  -2.657803       2
..        ...    ...   ...   ...        ...        ...     ...
93  16.661845     93  -2.0  -2.0  -1.912246  -1.881990       1
94  16.861845     94  -1.9  -1.9  -1.852786  -1.832744       1
95  17.061845     95  -1.8  -1.8  -1.820197  -1.814021       1
96  17.261845     96  -1.8  -1.9  -1.859792  -1.853782       2
98  17.461845     98  -2.0  -2.0  -2.033249  -1.985779       2

Python code:

energy_dat = {'distance': distances, 'discs': discs, 'E_ub': energies_ub_max,
              'E_lb': energies_lb, 'SavGoy_lb': yhat_lb, 'SavGoy_ub': yhat_ub,
              'method': a }`

df = pd.DataFrame(energy_dat, discs)
plt.xlabel('Trajectory [Å]')
plt.ylabel('Binding energy [kcal/mol]')
.
.
.
cmap = plt.cm.get_cmap('Set3')
for c in df['discs']:
    if c == len(df['discs']):
        plt.axvspan(c-1, c, color=cmap.colors[df.loc[c, 'method']])
    else:
        plt.axvspan(c, c+1, color=cmap.colors[df.loc[c, 'method']])

legend = [Patch(facecolor=cmap.colors[c], label=c) for c in df['method'].unique()]
plt.legend(handles=legend)

My problem is, that I wanna add a new line under/above the graph, where I can show an interval of each value. E.g from 0-10 -> 1; 10-50 -> 0; 60-55 ->2;...
of course even better with color representation.

My question is how can I add another row below/above the graph with the new dependency so that the result looks like the picture.enter image description here

Thank you.


问:
How to check how many users are downloading and/or using a hacked version of an app?
I am trying to find a way to understand how many users are downloading and/or using unofficial hacked versions of our app but I could not find anything about it.

First of all, are these included in Play Console download figures or not? Is there a way to understand how many downloads hacked apk's get? We have implemented our system for events tracking but I guess it can be disabled in an hacked apk, so looking at the number of people using it without being subscribed would possibly provide biased estimates. Any suggestions?


问:
KafkaJS consumer disconnects after connecting to Kafka container
I have implemented a typescript application containing the "Kafka JS" library to initialize a Kafka consumer within it.

This is the code of the consumer:

export class KafkaConsumer {
  public kafka: Kafka = {} as Kafka;
  public consumer: Consumer = {} as Consumer;

  public async InitKafkaConsumer() {
    this.kafka = new Kafka({
          logLevel: logLevel.DEBUG,
          clientId: 'kafka-consumer-client',
          brokers: ['kafka:29092'],
          ssl: false,
          retry: {
            initialRetryTime: 100,
            retries: 8
          }
        } as KafkaConfig);

    this.consumer = KafkaConsumer.kafka.consumer({
        groupId: 'kafka-consumer-group',
        sessionTimeout: 300000
    });
    await this.consumer.connect();
  }
}
```
<p>In addition, I composed a single Kafka broker with all its dependencies, both are deployed in a docker-compose file:</p>
<pre class="lang-yaml prettyprint-override"><code>myservice:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - 8086:8086
    depends_on:
      - kafka
    networks:
      - kafka-network
zookeeper:
    image: "confluentinc/cp-zookeeper"
    container_name: zookeeper
    restart: always
    ports:
      - 2181:2181
    environment:
      TZ: ${TZ_SET}
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
    networks:
      - kafka-network
kafka:
    image: "confluentinc/cp-kafka"
    container_name: kafka
    restart: always
    depends_on:
      - zookeeper
    ports:
      - '9092:9092'
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
      KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 100
      CONFLUENT_METRICS_ENABLE: 'false'
    networks:
      - kafka-network

networks:
  kafka-network:
</code>```

Eventually, while running the compose file and the application started to ran, the consumer can't connect to the broker.

These are the logs from the container:

```<code>2023-01-02 13:22:04 {"level":"ERROR","timestamp":"2023-01-02T11:22:04.032Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:04 {"level":"ERROR","timestamp":"2023-01-02T11:22:04.033Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":0,"retryTime":90}
2023-01-02 13:22:05 {"level":"ERROR","timestamp":"2023-01-02T11:22:05.126Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:05 {"level":"ERROR","timestamp":"2023-01-02T11:22:05.127Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":1,"retryTime":174}
2023-01-02 13:22:06 {"level":"ERROR","timestamp":"2023-01-02T11:22:06.303Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:06 {"level":"ERROR","timestamp":"2023-01-02T11:22:06.304Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":2,"retryTime":400}
2023-01-02 13:22:07 {"level":"ERROR","timestamp":"2023-01-02T11:22:07.705Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:07 {"level":"ERROR","timestamp":"2023-01-02T11:22:07.706Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":3,"retryTime":734}
2023-01-02 13:22:09 {"level":"ERROR","timestamp":"2023-01-02T11:22:09.442Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:09 {"level":"ERROR","timestamp":"2023-01-02T11:22:09.443Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":4,"retryTime":1448}
2023-01-02 13:22:11 {"level":"ERROR","timestamp":"2023-01-02T11:22:11.892Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:11 {"level":"ERROR","timestamp":"2023-01-02T11:22:11.893Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":5,"retryTime":2584}
2023-01-02 13:22:15 {"level":"ERROR","timestamp":"2023-01-02T11:22:15.481Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:15 {"level":"ERROR","timestamp":"2023-01-02T11:22:15.483Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":6,"retryTime":4660}
2023-01-02 13:22:21 {"level":"ERROR","timestamp":"2023-01-02T11:22:21.145Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:21 {"level":"ERROR","timestamp":"2023-01-02T11:22:21.149Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":7,"retryTime":10256}
2023-01-02 13:22:32 {"level":"ERROR","timestamp":"2023-01-02T11:22:32.407Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:32 {"level":"ERROR","timestamp":"2023-01-02T11:22:32.409Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":8,"retryTime":19094}
2023-01-02 13:22:32 {"level":"error","message":"KafkaConsumner >> StartConsuming >> failed with error: [KafkaJSNumberOfRetriesExceeded: Connection timeout]"}
2023-01-02 13:22:32 node:internal/process/promises:246
2023-01-02 13:22:32           triggerUncaughtException(err, true /* fromPromise */);
2023-01-02 13:22:32           ^
2023-01-02 13:22:32
2023-01-02 13:22:32 KafkaJSNonRetriableError
2023-01-02 13:22:32   Caused by: KafkaJSConnectionError: Connection timeout
2023-01-02 13:22:32     at Timeout.onTimeout [as _onTimeout] (/node-typescript-template/node_modules/kafkajs/src/network/connection.js:223:23)
2023-01-02 13:22:32     at listOnTimeout (node:internal/timers:557:17)
2023-01-02 13:22:32     at processTimers (node:internal/timers:500:7) {
2023-01-02 13:22:32   name: 'KafkaJSNumberOfRetriesExceeded',
2023-01-02 13:22:32   retriable: false,
2023-01-02 13:22:32   helpUrl: undefined,
2023-01-02 13:22:32   retryCount: 8,
2023-01-02 13:22:32   retryTime: 19094
2023-01-02 13:22:32 }
</code>```

What could be the problem?

Thanks in advance!

Body:
I have implemented a typescript application containing the "Kafka JS" library to initialize a Kafka consumer within it.

This is the code of the consumer:

export class KafkaConsumer {
  public kafka: Kafka = {} as Kafka;
  public consumer: Consumer = {} as Consumer;

  public async InitKafkaConsumer() {
    this.kafka = new Kafka({
          logLevel: logLevel.DEBUG,
          clientId: 'kafka-consumer-client',
          brokers: ['kafka:29092'],
          ssl: false,
          retry: {
            initialRetryTime: 100,
            retries: 8
          }
        } as KafkaConfig);

    this.consumer = KafkaConsumer.kafka.consumer({
        groupId: 'kafka-consumer-group',
        sessionTimeout: 300000
    });
    await this.consumer.connect();
  }
}

In addition, I composed a single Kafka broker with all its dependencies, both are deployed in a docker-compose file:

myservice:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - 8086:8086
    depends_on:
      - kafka
    networks:
      - kafka-network
zookeeper:
    image: "confluentinc/cp-zookeeper"
    container_name: zookeeper
    restart: always
    ports:
      - 2181:2181
    environment:
      TZ: ${TZ_SET}
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
    networks:
      - kafka-network
kafka:
    image: "confluentinc/cp-kafka"
    container_name: kafka
    restart: always
    depends_on:
      - zookeeper
    ports:
      - '9092:9092'
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
      KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 100
      CONFLUENT_METRICS_ENABLE: 'false'
    networks:
      - kafka-network

networks:
  kafka-network:

Eventually, while running the compose file and the application started to ran, the consumer can't connect to the broker.

These are the logs from the container:

2023-01-02 13:22:04 {"level":"ERROR","timestamp":"2023-01-02T11:22:04.032Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:04 {"level":"ERROR","timestamp":"2023-01-02T11:22:04.033Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":0,"retryTime":90}
2023-01-02 13:22:05 {"level":"ERROR","timestamp":"2023-01-02T11:22:05.126Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:05 {"level":"ERROR","timestamp":"2023-01-02T11:22:05.127Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":1,"retryTime":174}
2023-01-02 13:22:06 {"level":"ERROR","timestamp":"2023-01-02T11:22:06.303Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:06 {"level":"ERROR","timestamp":"2023-01-02T11:22:06.304Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":2,"retryTime":400}
2023-01-02 13:22:07 {"level":"ERROR","timestamp":"2023-01-02T11:22:07.705Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:07 {"level":"ERROR","timestamp":"2023-01-02T11:22:07.706Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":3,"retryTime":734}
2023-01-02 13:22:09 {"level":"ERROR","timestamp":"2023-01-02T11:22:09.442Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:09 {"level":"ERROR","timestamp":"2023-01-02T11:22:09.443Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":4,"retryTime":1448}
2023-01-02 13:22:11 {"level":"ERROR","timestamp":"2023-01-02T11:22:11.892Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:11 {"level":"ERROR","timestamp":"2023-01-02T11:22:11.893Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":5,"retryTime":2584}
2023-01-02 13:22:15 {"level":"ERROR","timestamp":"2023-01-02T11:22:15.481Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:15 {"level":"ERROR","timestamp":"2023-01-02T11:22:15.483Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":6,"retryTime":4660}
2023-01-02 13:22:21 {"level":"ERROR","timestamp":"2023-01-02T11:22:21.145Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:21 {"level":"ERROR","timestamp":"2023-01-02T11:22:21.149Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":7,"retryTime":10256}
2023-01-02 13:22:32 {"level":"ERROR","timestamp":"2023-01-02T11:22:32.407Z","logger":"kafkajs","message":"[Connection] Connection timeout","broker":"kafka:29092","clientId":"kafka-consumer-client"}
2023-01-02 13:22:32 {"level":"ERROR","timestamp":"2023-01-02T11:22:32.409Z","logger":"kafkajs","message":"[BrokerPool] Failed to connect to seed broker, trying another broker from the list: Connection timeout","retryCount":8,"retryTime":19094}
2023-01-02 13:22:32 {"level":"error","message":"KafkaConsumner >> StartConsuming >> failed with error: [KafkaJSNumberOfRetriesExceeded: Connection timeout]"}
2023-01-02 13:22:32 node:internal/process/promises:246
2023-01-02 13:22:32           triggerUncaughtException(err, true /* fromPromise */);
2023-01-02 13:22:32           ^
2023-01-02 13:22:32
2023-01-02 13:22:32 KafkaJSNonRetriableError
2023-01-02 13:22:32   Caused by: KafkaJSConnectionError: Connection timeout
2023-01-02 13:22:32     at Timeout.onTimeout [as _onTimeout] (/node-typescript-template/node_modules/kafkajs/src/network/connection.js:223:23)
2023-01-02 13:22:32     at listOnTimeout (node:internal/timers:557:17)
2023-01-02 13:22:32     at processTimers (node:internal/timers:500:7) {
2023-01-02 13:22:32   name: 'KafkaJSNumberOfRetriesExceeded',
2023-01-02 13:22:32   retriable: false,
2023-01-02 13:22:32   helpUrl: undefined,
2023-01-02 13:22:32   retryCount: 8,
2023-01-02 13:22:32   retryTime: 19094
2023-01-02 13:22:32 }

What could be the problem?

Thanks in advance!


问:
Timeout while connecting to Oracle db from C#
I am running a C# web application in local which is connecting to Oracle database .

I am getting a time out error while connecting to Oracle db with following information .

"Total time processing Duration : 15000  Timing opening of connection"

I am able to connect to db using PL/SQL developer , facing the issue only while connecting from app. What could be the possible issue in this case? If some developer has opened a connection to db and forgot to close , then in that case I shouldnt be able to connect from pl/sql developer also right?


问:
How to execute script in compute nodes using nrpe?
I want to execute script using nrpe in selected compute nodes and output the result

I want to run scripts on compute nodes. I can select the compute nodes and input command to execute. Executed result will be given as output. I want to provide the compute nodes where the scripts are to be executed.


问:
Alternatives to merge for large and multiple lists
I am combining/merging multiple lists using Reduce, however, some of my input files (n=5000) are large (200MB) and the functions takes several hours to complete. Any suggestions on alternative ways of performing the desired merging of my lists? (Sorry, I did not get dput to work, it only produced a very large structure)

```<code>> head(datalist[[1]])
V1  V2 V3              V1_V2
1 NW_001849834.1  97  1  NW_001849834.1_97
2 NW_001849834.1  98  1  NW_001849834.1_98
3 NW_001849834.1  99  1  NW_001849834.1_99
4 NW_001849834.1 100  1 NW_001849834.1_100
5 NW_001849834.1 101  1 NW_001849834.1_101
6 NW_001849834.1 102  1 NW_001849834.1_102

> head(datalist[[2]])
V1 V2 V3             V1_V2
1 NW_001849834.1 57  1 NW_001849834.1_57
2 NW_001849834.1 58  1 NW_001849834.1_58
3 NW_001849834.1 59  1 NW_001849834.1_59
4 NW_001849834.1 60  1 NW_001849834.1_60
5 NW_001849834.1 61  1 NW_001849834.1_61
6 NW_001849834.1 62  1 NW_001849834.1_62

library(plyr); library(dplyr)
dfs.bac <- Map(function(x, nm) { names(x)[names(x) == "V3"] <- nm; x[, c("V1_V2", nm)]; }, datalist, names(datalist))
dfs.out.bac <- Reduce(function(d1, d2) merge(d1, d2, by = "V1_V2", all = TRUE), dfs.bac)
dfs.out.bac[is.na(dfs.out.bac)] <- 0
rownames(dfs.out.bac) <- dfs.out.bac$V1_V2
dfs.out.bac$V1_V2 <- NULL
dfs.out.bac.df <- data.frame(ID=rownames(dfs.out.bac),rowSums=rowSums(dfs.out.bac))
</code>```

Body:
I am combining/merging multiple lists using Reduce, however, some of my input files (n=5000) are large (200MB) and the functions takes several hours to complete. Any suggestions on alternative ways of performing the desired merging of my lists? (Sorry, I did not get dput to work, it only produced a very large structure)

> head(datalist[[1]])
V1  V2 V3              V1_V2
1 NW_001849834.1  97  1  NW_001849834.1_97
2 NW_001849834.1  98  1  NW_001849834.1_98
3 NW_001849834.1  99  1  NW_001849834.1_99
4 NW_001849834.1 100  1 NW_001849834.1_100
5 NW_001849834.1 101  1 NW_001849834.1_101
6 NW_001849834.1 102  1 NW_001849834.1_102

> head(datalist[[2]])
V1 V2 V3             V1_V2
1 NW_001849834.1 57  1 NW_001849834.1_57
2 NW_001849834.1 58  1 NW_001849834.1_58
3 NW_001849834.1 59  1 NW_001849834.1_59
4 NW_001849834.1 60  1 NW_001849834.1_60
5 NW_001849834.1 61  1 NW_001849834.1_61
6 NW_001849834.1 62  1 NW_001849834.1_62

library(plyr); library(dplyr)
dfs.bac <- Map(function(x, nm) { names(x)[names(x) == "V3"] <- nm; x[, c("V1_V2", nm)]; }, datalist, names(datalist))
dfs.out.bac <- Reduce(function(d1, d2) merge(d1, d2, by = "V1_V2", all = TRUE), dfs.bac)
dfs.out.bac[is.na(dfs.out.bac)] <- 0
rownames(dfs.out.bac) <- dfs.out.bac$V1_V2
dfs.out.bac$V1_V2 <- NULL
dfs.out.bac.df <- data.frame(ID=rownames(dfs.out.bac),rowSums=rowSums(dfs.out.bac))


问:
How to extract values from a nested json that has a mutable key in pyspark 2.47 while maintaining the position of the row?
THere is this DF were one of the columns is a nested JSON that has crucial info.
The primary key always changes and any row can have 0 to 10 different primary keys.
Keys 1, 2 and 3 are always the same.

I need to have only the values from key2 while maitaining their row. Here is a simple example.

{"primary key1":{"key1":"value1","key2":"value2","key3":"value3"},
"primary key2":{"key1":"value4","key2":"value5","key3":"value6"}}
```


问:
What is the correct code to do the following combination
Following the the array where i want to get 1 element from every array from the object and create an new array.

Input array--

```<code>const categories = [
  {
    code: "noodle",
    ingredients: ["wheat_noodle", "maida_noodle", "rice_noodle"],
  },
  {
    code: "oil",
    ingredients: ["soyabeen_oil", "peenut_oil", "sunflower_oil"],
  },
  {
    code: "salt",
    ingredients: ["kosher_salt", "ground_salt", "table_salt"],
  },
  {
    code: "sauce",
    ingredients: ["soya_sauce", "chilli_sauce", "tommato_sauce"],
  },
]
</code>```

Following is how i want my array output to be. Basically take every 1 element from each object and make combination.

```<code>[
  [ 'wheat_noodle', 'soyabeen_oil', 'kosher_salt', 'soya_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'kosher_salt', 'chilli_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'kosher_salt', 'tommato_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'ground_salt', 'soya_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'ground_salt', 'chilli_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'ground_salt', 'tommato_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'table_salt', 'soya_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'table_salt', 'chilli_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'table_salt', 'tommato_sauce' ],
  [ 'wheat_noodle', 'peenut_oil', 'kosher_salt', 'soya_sauce' ],
  [ 'wheat_noodle', 'peenut_oil', 'kosher_salt', 'chilli_sauce' ],
  [ 'wheat_noodle', 'peenut_oil', 'kosher_salt', 'tommato_sauce' ],
  [ 'wheat_noodle', 'peenut_oil', 'ground_salt', 'soya_sauce' ],
  [ 'wheat_noodle', 'peenut_oil', 'ground_salt', 'chilli_sauce' ],
  [ 'wheat_noodle', 'peenut_oil', 'ground_salt', 'tommato_sauce' ],
  ...
]
</code>```

Body:
Following the the array where i want to get 1 element from every array from the object and create an new array.

Input array--

const categories = [
  {
    code: "noodle",
    ingredients: ["wheat_noodle", "maida_noodle", "rice_noodle"],
  },
  {
    code: "oil",
    ingredients: ["soyabeen_oil", "peenut_oil", "sunflower_oil"],
  },
  {
    code: "salt",
    ingredients: ["kosher_salt", "ground_salt", "table_salt"],
  },
  {
    code: "sauce",
    ingredients: ["soya_sauce", "chilli_sauce", "tommato_sauce"],
  },
]

Following is how i want my array output to be. Basically take every 1 element from each object and make combination.

[
  [ 'wheat_noodle', 'soyabeen_oil', 'kosher_salt', 'soya_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'kosher_salt', 'chilli_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'kosher_salt', 'tommato_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'ground_salt', 'soya_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'ground_salt', 'chilli_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'ground_salt', 'tommato_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'table_salt', 'soya_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'table_salt', 'chilli_sauce' ],
  [ 'wheat_noodle', 'soyabeen_oil', 'table_salt', 'tommato_sauce' ],
  [ 'wheat_noodle', 'peenut_oil', 'kosher_salt', 'soya_sauce' ],
  [ 'wheat_noodle', 'peenut_oil', 'kosher_salt', 'chilli_sauce' ],
  [ 'wheat_noodle', 'peenut_oil', 'kosher_salt', 'tommato_sauce' ],
  [ 'wheat_noodle', 'peenut_oil', 'ground_salt', 'soya_sauce' ],
  [ 'wheat_noodle', 'peenut_oil', 'ground_salt', 'chilli_sauce' ],
  [ 'wheat_noodle', 'peenut_oil', 'ground_salt', 'tommato_sauce' ],
  ...
]


问:
Why form values are prototypes?
Im trying to create an Angular form for a simple login.

Html code :

```<code> <img src="./assets/Logo100Legal.png" alt="Logo" class="logoHome">
    <form #login="ngForm" (ngSubmit)="submit(login)">
        <div class="input-group-lg inputStyle form-group" >
            <h5>Nombre de usuario o correo electronico</h5>
            <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-lg" ngModel>
        </div>

        <div class="input-group-lg inputStyle form-group">
            <h5>Contraseña</h5>
            <input type="text" class="form-control"  aria-label="Sizing example input" aria-describedby="inputGroup-sizing-lg" ngModel>
        </div>

        <input type="submit" class="btn btn-lg myButton" value="Iniciar Sesion">
    </form>
    <br>
    <br>
</code>```

TS Code :

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

  constructor() { }

  ngOnInit(): void {

  }

  submit(login:any){
    console.log(login.value )
  }

}
</code>```

All content appears correctly, but when i click on button it returns a [[prototype]] value instead of actual values

Title: Why form values are prototypes?

Body:
Im trying to create an Angular form for a simple login.

Html code :

    <form #login="ngForm" (ngSubmit)="submit(login)">

Nombre de usuario o correo electronico

            <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-lg" ngModel>

Contraseña

            <input type="text" class="form-control"  aria-label="Sizing example input" aria-describedby="inputGroup-sizing-lg" ngModel>

        <input type="submit" class="btn btn-lg myButton" value="Iniciar Sesion">
    </form>

TS Code :

export class LogInComponent implements OnInit {

  constructor() { }

  ngOnInit(): void {

  }

  submit(login:any){
    console.log(login.value )
  }

}

All content appears correctly, but when i click on button it returns a [[prototype]] value instead of actual values


问:
Puppeteer .innerHTML on element returns undefined
I've been scraping a bunch of websites lately and some of them work just fine, while on others I encounter problems.
`

```<code>const { url, selectors } = WebsiteUtils

const getData = async (url) => {
    const browser = await puppeteer.launch({ headless: false })
    const page = await browser.newPage()
    await page.setViewport({
        height: 20000,
        width: 1500,
    })
    await page.goto(url, { waitUntil: 'networkidle2' })

    const link = page.$(selectors.link)
    return link.innerHTML
}

console.log(await getData(url))
</code>```

`

In this case, the 'selectors.link' is literally just 'ul' as there's a bunch of them in the page. I already tried to wait for the selector (.waitForSelector), I used page.evaluate instead of .$, even put a 5 secs timeout to make sure everything was loaded. The HTML is not even inside an iframe, it's a really straightforward page. When I get to this I'm pretty much out of options.

The output here is undefined,
if i just log 'link' I get ElementHandle {}

Update:
I figured this out. Unlike what i previously wrote, iframe were indeed present in the page although they were not present in the HTML of the devtools.
I just spotted them running page.frames() and access the content of the individual frames with frame.$eval()

Body:
I've been scraping a bunch of websites lately and some of them work just fine, while on others I encounter problems.
`

const { url, selectors } = WebsiteUtils

const getData = async (url) => {
    const browser = await puppeteer.launch({ headless: false })
    const page = await browser.newPage()
    await page.setViewport({
        height: 20000,
        width: 1500,
    })
    await page.goto(url, { waitUntil: 'networkidle2' })

    const link = page.$(selectors.link)
    return link.innerHTML
}

console.log(await getData(url))

`

In this case, the 'selectors.link' is literally just 'ul' as there's a bunch of them in the page. I already tried to wait for the selector (.waitForSelector), I used page.evaluate instead of .$, even put a 5 secs timeout to make sure everything was loaded. The HTML is not even inside an iframe, it's a really straightforward page. When I get to this I'm pretty much out of options.

The output here is undefined,
if i just log 'link' I get ElementHandle {}

Update:
I figured this out. Unlike what i previously wrote, iframe were indeed present in the page although they were not present in the HTML of the devtools.
I just spotted them running page.frames() and access the content of the individual frames with frame.$eval()


问:
Why can't I access the protected function in the derived class
I have a Base class and derived another class from it. The derived class has a function which takes as an argument const Base& and calls its protected member function. I get an error saying that the function being called is protected in that context. I'd like to know why that happens and can I  solve it without making the protected function in base class public.

```<code>class Base {
protected:
    void call() const {}
};

class C : public Base {
public:
    void func(const Base& b) {
        b.call();
    }
};
</code>```

I tried adding using Base::call in the derived class but that didn't help

Body:
I have a Base class and derived another class from it. The derived class has a function which takes as an argument const Base& and calls its protected member function. I get an error saying that the function being called is protected in that context. I'd like to know why that happens and can I  solve it without making the protected function in base class public.

class Base {
protected:
    void call() const {}
};

class C : public Base {
public:
    void func(const Base& b) {
        b.call();
    }
};

I tried adding using Base::call in the derived class but that didn't help


问:
.navigationBarTitleDisplayMode(.inline) crashes Xcode preview
I am consistently coming across this issue whenever I use .navigationBarTitleDisplayMode(.inline). Is there a problematic use of this method, or is there something incorrect about my code ?

How to reproduce error:

In the preview, hit the "list.bullet.rectangle.fill" and dismiss the dialog. Do it a second time and now Xcode crashes the Preview.

Xcode Version 14.2 (14C18)

import SwiftUI

struct PDFTableContentsView: View {
    var body: some View {
        Text("PDF Table Contents View")
        .bold()
        .underline()
    }
}

struct PDFContentView: View {
    @State private var showContents: Bool = false

    var body: some View {
        VStack {
            Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
        }
        .navigationTitle("PDF Title")
        .navigationBarTitleDisplayMode(.inline)
        .toolbar {
            ToolbarItem(placement: .navigationBarTrailing) {
                Button {
                    showContents.toggle()
                } label: {
                    Image(systemName: "list.bullet.rectangle.fill")
                }
            }
        }
        .sheet(isPresented: $showContents) {
            PDFTableContentsView()
        }
    }
}

struct PDFContentView_Previews: PreviewProvider {
    static var previews: some View {
        NavigationView {
            PDFContentView()
        }
    }
}
```


问:
Sort a text file by line length including spaces
I want to write a program that reads the lines in a text file and sorts them by length. After reading the file, I want to output the contents into the command line and an output file. I also want to use the text files as arguments of the command-line.

These are my created sentences for trials

```<code>1. hello world
2. john doe at the bay watch
3. Great Heavens
4. altair
5. Jim and Jamy
</code>```

my source.c

```<code>int main(void) {

    FILE* fread = fopen("C:\\Users\\Peter\\desktop\\input.txt", "r");
    FILE* fwrite = fopen("C:\\Users\\Peter\\desktop\\output.txt", "w");

    if (fread == NULL || fwrite == NULL) {
        printf("One file wouldn't open!\n");
        return -1;
    }

        //(1.) this copies the text from input.txt to output.txt
    char c;
    while ((c = fgetc(fread)) != EOF) {
        fputc(c, fwrite);
    }

        //(2.) this pastes the text from input.txt into the command-line
    char line[1000] = "";
    while (fscanf(fread, "%s", line) == 1) {
        printf("%s\n", line);
    }

    fclose(fread);
    fclose(fwrite);

}
</code>```

Results

output.txt

```<code>1. hello world
2. john doe at the bay watch
3. Great Heavens
4. altair
5. Jim and Jamy
</code>```

terminal / command-line

```<code>1.
hello
world
2.
john
doe
at
the
bay
watch
3.
Great
Heavens
4.
altair
5.
Jim
and
Jamy
</code>```

My problems are:

For (1.) and (2.) only one works at the time. so if I switch them around the other one doesn't work anymore

The command-line ignores spaces and uses that as a new line

I wouldn't know how to sort the strings by length (1-2-3-4-5 into 2-3-5-1-4)

Pasting the second order in the output.txt file and the command-line at the same time

Body:
I want to write a program that reads the lines in a text file and sorts them by length. After reading the file, I want to output the contents into the command line and an output file. I also want to use the text files as arguments of the command-line.

These are my created sentences for trials

1. hello world
2. john doe at the bay watch
3. Great Heavens
4. altair
5. Jim and Jamy

my source.c

int main(void) {

    FILE* fread = fopen("C:\\Users\\Peter\\desktop\\input.txt", "r");
    FILE* fwrite = fopen("C:\\Users\\Peter\\desktop\\output.txt", "w");

    if (fread == NULL || fwrite == NULL) {
        printf("One file wouldn't open!\n");
        return -1;
    }

        //(1.) this copies the text from input.txt to output.txt
    char c;
    while ((c = fgetc(fread)) != EOF) {
        fputc(c, fwrite);
    }

        //(2.) this pastes the text from input.txt into the command-line
    char line[1000] = "";
    while (fscanf(fread, "%s", line) == 1) {
        printf("%s\n", line);
    }

    fclose(fread);
    fclose(fwrite);

}

Results

output.txt

1. hello world
2. john doe at the bay watch
3. Great Heavens
4. altair
5. Jim and Jamy

terminal / command-line

1.
hello
world
2.
john
doe
at
the
bay
watch
3.
Great
Heavens
4.
altair
5.
Jim
and
Jamy

My problems are:

For (1.) and (2.) only one works at the time. so if I switch them around the other one doesn't work anymore

The command-line ignores spaces and uses that as a new line

I wouldn't know how to sort the strings by length (1-2-3-4-5 into 2-3-5-1-4)

Pasting the second order in the output.txt file and the command-line at the same time


问:
How to execute a transformers python script through nodejs and containerize it?
I have a text statement in nodejs which i want to send to python,apply transformers and process it and then retrieve the processed text back into nodejs. Then to write a dockerfile and containerise the integrated code into a single container.
The dockerfile,python script and nodejs codes are attached.
The nodejs code:

```<code>const questions = JSON.stringify('Hello World machine learning dynamic learning advanced neural nets techs')
const pythonprocess = spawn('python3',["./py_mo2.py"],{
  shell: true,
  env:{
  ...process.env
  }
});
console.log("before process")
pythonprocess.stdout.on('data',(data) => {
    console.log(data.toString());
});
console.log("nodejs is working")
</code>```

The python code:

```<code>import sys
import json
import warnings
warnings.filterwarnings("ignore")
text=sys.argv[1]
from transformers import pipeline
summarizer=pipeline('summarization',model='lidiya/bart-base-samsum')
print(json.dumps(summarizer(text)))
</code>```

The dockerfile code:

```<code>FROM python:3.7
ENV VIRTUAL_ENV=/app/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 16.19.0
RUN mkdir -p $NVM_DIR
WORKDIR $NVM_DIR
RUN apt-get update && curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get install nodejs
ENV NODE_PATH $NVM_DIR/node/lib/node_modules
ENV PATH="$NVM_DIR/node/bin:$PATH"
WORKDIR /app/venv
COPY requirements.txt /app/venv/
RUN . /app/venv/bin/activate && pip3 install -r requirements.txt
COPY package*.json /app/venv/
RUN npm install
COPY . /app/venv/
CMD /usr/bin/node /app/venv/nomo.js
</code>```

I tried experimenting using multi-stage builds in dockerfile,to install python on node image and vice versa.Am able to get a simple text output from the python code in the absence of the transformers library.Once i use it the container just exits after running the nodejs code but no output from the python code.

Thank you for the help! kudos

Body:
I have a text statement in nodejs which i want to send to python,apply transformers and process it and then retrieve the processed text back into nodejs. Then to write a dockerfile and containerise the integrated code into a single container.
The dockerfile,python script and nodejs codes are attached.
The nodejs code:

const questions = JSON.stringify('Hello World machine learning dynamic learning advanced neural nets techs')
const pythonprocess = spawn('python3',["./py_mo2.py"],{
  shell: true,
  env:{
  ...process.env
  }
});
console.log("before process")
pythonprocess.stdout.on('data',(data) => {
    console.log(data.toString());
});
console.log("nodejs is working")

The python code:

import sys
import json
import warnings
warnings.filterwarnings("ignore")
text=sys.argv[1]
from transformers import pipeline
summarizer=pipeline('summarization',model='lidiya/bart-base-samsum')
print(json.dumps(summarizer(text)))

The dockerfile code:

FROM python:3.7
ENV VIRTUAL_ENV=/app/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 16.19.0
RUN mkdir -p $NVM_DIR
WORKDIR $NVM_DIR
RUN apt-get update && curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get install nodejs
ENV NODE_PATH $NVM_DIR/node/lib/node_modules
ENV PATH="$NVM_DIR/node/bin:$PATH"
WORKDIR /app/venv
COPY requirements.txt /app/venv/
RUN . /app/venv/bin/activate && pip3 install -r requirements.txt
COPY package*.json /app/venv/
RUN npm install
COPY . /app/venv/
CMD /usr/bin/node /app/venv/nomo.js

I tried experimenting using multi-stage builds in dockerfile,to install python on node image and vice versa.Am able to get a simple text output from the python code in the absence of the transformers library.Once i use it the container just exits after running the nodejs code but no output from the python code.

Thank you for the help! kudos


问:
Overwrite code in includes folder of woocommerce
How do I overwrite functions in woocommerce/includes folder?

I want to delete line 1101 of woocommerce/includes/class-wc-form-handler.php
'wc_add_notice( __( 'Your account was created successfully. Your login details have been sent to your email address.', 'woocommerce' ) );'

I want to prevent the notice above from appearing when I sign up,
If I directly modify the files in the includes folder, they will be initialized on every update.

So I want to know what code to put in functions.php of my theme.
please help thank you.

Duplicate marked answers don't work.


问:
Arranging JSX according to a certain algorithm
I'm making a simple web app that helps people organize teams by skill level, you enter the player name, skill level ( 0 - 10 ), and the player's avatar.
For example, you add 3 players in team1 and 4 in team2 and then you get them displayed in a way where the sum of skill value of team1 is equal to team2.
I ended up making the app create a new player instance each time the user presses the add button and then push that instance to an array. just like you see here:

class Player {
    constructor(name, image, skill) {
        this.name = name;
        this.image = image;
        this.skill = skill;
    }
}

const createPlayer = (name, image, skill) => {
    // creates a player with given data and pushes it to the playersList array
    const playerIns = new Player(name, image, skill);
    playersList.push(playerIns);
};
```

Then the app maps through the playersList array and returns a list element for each player just like a basic todo-app.
I need help with implementing the logic that organizes the players correctly as described above.

I can't really think of a way to make this work so I'd appreciate any help.

Body:
I'm making a simple web app that helps people organize teams by skill level, you enter the player name, skill level ( 0 - 10 ), and the player's avatar.
For example, you add 3 players in team1 and 4 in team2 and then you get them displayed in a way where the sum of skill value of team1 is equal to team2.
I ended up making the app create a new player instance each time the user presses the add button and then push that instance to an array. just like you see here:

class Player {
    constructor(name, image, skill) {
        this.name = name;
        this.image = image;
        this.skill = skill;
    }
}

const createPlayer = (name, image, skill) => {
    // creates a player with given data and pushes it to the playersList array
    const playerIns = new Player(name, image, skill);
    playersList.push(playerIns);
};

Then the app maps through the playersList array and returns a list element for each player just like a basic todo-app.
I need help with implementing the logic that organizes the players correctly as described above.

I can't really think of a way to make this work so I'd appreciate any help.


问:
Is there a list of all default urls/functions for magento2?
I have been working my way into Magento2 for quite some time. From time to time I find new URLs by accident - mostly when I Google for a function or feature.
So that I don't forget to style anything in a new store or also to test functions I would like to have an overview of all automatically created pages which can't be maintained in the backend.

As examples these URLs would be here:

/sales/guest/form

/contact

...

Should the whole be version dependent gladly from 2.4.0 and upwards


问:
How to recreate MUI Select value click behavior in react testing library?
PROBLEM :

How to recreate click and select options behavior in MUI SELECT component using react testing library?

CODESANDBOX


问:
An unhandled exception of type 'System.ArgumentException' occurred in System.Drawing.dll in vb.net
why when running the program after a few minutes an error appears as I attached below. Please have a solution

Thanks


问:
Clicking reCaptchas in JavaScript
I am working on a project, and it involves me clicking a reCaptcha element (iframe) in JavaScript. I have found multiple ways to detect if there is a reCaptcha element (".g-recaptcha", role='presentation' on the iframe itself, etc) however upon trying to click it I get console errors. Note that right now I am just executing the code in the web console, and have not actually programmed it into an extension. Basically, the command I am trying to run the console is :

```<code>document.querySelector('[role="presentation"]').contentWindow.document.getElementById("recaptcha-anchor").click()
</code>```

The reason this "should" work is because the iframe element has the unique attribute of "role=presentation", it then goes into the html code embedded in the iframe and tries to click the little box, as noted by "recaptcha-anchor". However, testing this code grants me the following error:

```<code>VM8195:1 Uncaught DOMException: Blocked a frame with origin "https://minecraft.buzz" from accessing a cross-origin frame.
    at <anonymous>:1:62
(anonymous) @   VM8195:1
</code>```

Does someone have any ways to get around this, or potentially know how I could code something in a JS chrome extension to do this?

Title: Clicking reCaptchas in JavaScript

Body:
I am working on a project, and it involves me clicking a reCaptcha element (iframe) in JavaScript. I have found multiple ways to detect if there is a reCaptcha element (".g-recaptcha", role='presentation' on the iframe itself, etc) however upon trying to click it I get console errors. Note that right now I am just executing the code in the web console, and have not actually programmed it into an extension. Basically, the command I am trying to run the console is :

document.querySelector('[role="presentation"]').contentWindow.document.getElementById("recaptcha-anchor").click()

The reason this "should" work is because the iframe element has the unique attribute of "role=presentation", it then goes into the html code embedded in the iframe and tries to click the little box, as noted by "recaptcha-anchor". However, testing this code grants me the following error:

VM8195:1 Uncaught DOMException: Blocked a frame with origin "https://minecraft.buzz" from accessing a cross-origin frame.
    at <anonymous>:1:62
(anonymous) @   VM8195:1

Does someone have any ways to get around this, or potentially know how I could code something in a JS chrome extension to do this?


问:
How to create a new activity for each of the CardView in the Grid Layout that was created using onCreateView method and Adapters?
Currently, I'm making a quiz app project for my University final exam course. I don't have any basics on Android development, so far I only followed tutorials online, particularly from this: https://www.youtube.com/watch?v=eRYxlKWXY5c&list=PLnfB3OWST3K3lEQmiRR6LhbqdgzTEy8_B&index=4

So, I have created a grid layout with its values, however it's not manually created one by one.

It's created by the onCreateView method

```<code>@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_category, container, false);

    catView = view.findViewById(R.id.cat_grid);

    loadCategories();

    CategoryAdapter adapter = new CategoryAdapter(catList);
    catView.setAdapter(adapter);

    return view;
}
</code>```

and by the help of CategoryAdapter.

```<code>public class CategoryAdapter extends BaseAdapter {

    private List<CategoryModel> cat_list;

    public CategoryAdapter(List<CategoryModel> cat_list) {
        this.cat_list = cat_list;
    }

    @Override
    public int getCount() {
        return cat_list.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {

        View myView;

        if(view == null){
            myView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.cat_item_layout,viewGroup,false);
        }
        else{
            myView = view;
        }

        TextView catName = myView.findViewById(R.id.catName);
        catName.setText(cat_list.get(i).getName());
        return myView;
    }
</code>```

Then, add the categories using loadCategories() method

```<code>private void loadCategories(){
    catList.clear();

    catList.add(new CategoryModel("1","Introduction"));
    catList.add(new CategoryModel("2","Learning Roadmap"));
    catList.add(new CategoryModel("3","Genomics"));
    catList.add(new CategoryModel("4","Metagenomics (coming soon)"));
    catList.add(new CategoryModel("5","Metabolomics (coming soon)"));
    catList.add(new CategoryModel("6","Proteomics (coming soon)"));
    catList.add(new CategoryModel("7","Transcriptomics (coming soon)"));
    catList.add(new CategoryModel("8","Epigenetics (coming soon)"));
    catList.add(new CategoryModel("9","Medical Informatics (coming soon)"));

}
</code>```

What I want to do is that for each of those grid cards, it will open up different activities (since they are different topics).

I saw in a certain tutorial that we need to assign an id to each of the grid cards. But, in my case I don't know how, because I didn't create those cards manually and cannot click on the objects in the .xml file.

Does anyone know how to tackle this problem? Thank you very much beforehand.

onCreateView Method
app

Unfortunately I haven't tried it myself, after searching online I couldn't find any reference.

Body:
Currently, I'm making a quiz app project for my University final exam course. I don't have any basics on Android development, so far I only followed tutorials online, particularly from this: https://www.youtube.com/watch?v=eRYxlKWXY5c&list=PLnfB3OWST3K3lEQmiRR6LhbqdgzTEy8_B&index=4

So, I have created a grid layout with its values, however it's not manually created one by one.

It's created by the onCreateView method

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_category, container, false);

    catView = view.findViewById(R.id.cat_grid);

    loadCategories();

    CategoryAdapter adapter = new CategoryAdapter(catList);
    catView.setAdapter(adapter);

    return view;
}

and by the help of CategoryAdapter.

public class CategoryAdapter extends BaseAdapter {

    private List<CategoryModel> cat_list;

    public CategoryAdapter(List<CategoryModel> cat_list) {
        this.cat_list = cat_list;
    }

    @Override
    public int getCount() {
        return cat_list.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {

        View myView;

        if(view == null){
            myView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.cat_item_layout,viewGroup,false);
        }
        else{
            myView = view;
        }

        TextView catName = myView.findViewById(R.id.catName);
        catName.setText(cat_list.get(i).getName());
        return myView;
    }

Then, add the categories using loadCategories() method

private void loadCategories(){
    catList.clear();

    catList.add(new CategoryModel("1","Introduction"));
    catList.add(new CategoryModel("2","Learning Roadmap"));
    catList.add(new CategoryModel("3","Genomics"));
    catList.add(new CategoryModel("4","Metagenomics (coming soon)"));
    catList.add(new CategoryModel("5","Metabolomics (coming soon)"));
    catList.add(new CategoryModel("6","Proteomics (coming soon)"));
    catList.add(new CategoryModel("7","Transcriptomics (coming soon)"));
    catList.add(new CategoryModel("8","Epigenetics (coming soon)"));
    catList.add(new CategoryModel("9","Medical Informatics (coming soon)"));

}

What I want to do is that for each of those grid cards, it will open up different activities (since they are different topics).

I saw in a certain tutorial that we need to assign an id to each of the grid cards. But, in my case I don't know how, because I didn't create those cards manually and cannot click on the objects in the .xml file.

Does anyone know how to tackle this problem? Thank you very much beforehand.

onCreateView Method
app

Unfortunately I haven't tried it myself, after searching online I couldn't find any reference.


Title: Re-calculate the score for all other groups when the condition is met

Body:
I have a dataframe (df) that contains the user with their vectors (x1), group number, group vector (x2), p2, counts the members of each group (k), and the threshold for each group.

df = pd.DataFrame({'user': ['user 1', 'user 2', 'user 3', 'user 4', 'user 5'],
                   'group': [1, 0, 0, 2, 1],
                   'x1': [[0.2, 0.3, 0.5], [0.3, 0.3, 0.4], [0.4, 0.4, 0.2], [0.2, 0.1, 0.7], [0.5,0.3,0.2]],
                   'x2': [[0.5, 0.2, 0.3], [0.4, 0.2, 0.4], [0.4, 0.2, 0.4], [0.5, 0.1, 0.4], [0.5, 0.2, 0.3]],
                   'p2': [0.342, 0.231, 0.231, 0.411, 0.342],
                   'k': [2, 2, 2, 1, 2],
                   'threshold': [0.6, 0.9, 0.9, 0.8, 0.6],})

I calculated for each user, the score (S) with respect to its group by using the code:

output:

user    group   x1  x2  p2  k   threshold   score
0   user 1  1   [0.2, 0.3, 0.5] [0.5, 0.2, 0.3] 0.342   2   0.6 0.909357
1   user 2  0   [0.3, 0.3, 0.4] [0.4, 0.2, 0.4] 0.231   2   0.9 0.586580
2   user 3  0   [0.4, 0.4, 0.2] [0.4, 0.2, 0.4] 0.231   2   0.9 0.846320
3   user 4  2   [0.2, 0.1, 0.7] [0.5, 0.1, 0.4] 0.411   1   0.8 1.437956
4   user 5  1   [0.5, 0.3, 0.2] [0.5, 0.2, 0.3] 0.342   2   0.6 0.558480

I want to re-calculate the score with respect to all other groups, If the score is higher than the threshold.


问:
React-spring drag and drop is not working in mobile view
When I change my screen from desktop view to mobile view, the drag and drop is not working for me. Instead of drag and drop it selects the text nearby the draggable element. I tried with adding custom events of touchstart, touchend etc. Want a functionality in both desktop view and mobile view.

```<code>    const [dragSpring, dragSpringApi] = useSpring(() => ({
    x: 0,
    y: 0,
    zIndex: 0,
    shadow: 0,
    cursor: "grab",
    width: "100%" as string | number,
    position: "absolute" as CSSProperties["position"],
    immediate: (k: string) => k !== "shadow",
  }));
</code>```

The start function of drag and drop

```<code>    const handleDragStart: Parameters<typeof drag>[0]["onStart"] = ({
    initial,
  }) => {
    const startScrollOffset = scrollContainerRef.current
      ? scrollContainerRef.current.scrollTop
      : 0;
    dragSpringApi.start({
      x: initial.item.fixedPosition.left,
      y: initial.item.fixedPosition.top,
      zIndex: 100,
      shadow: 15,
      cursor: "grabbing",
      position: "fixed",
      width: initial.item.width,
      immediate: (k: string) => k !== "shadow",
    });
    return { startScrollOffset };
  };
</code>```

And the element to be drag and drop which is:

```<code><animated.div
            ref={drag({
              itemId: project.id,
              type: "SIDE_NAV_PROJECT",
              itemRef,
              onStart: handleDragStart,
              onUpdate: handleDragUpdate,
              onEnd: handleDragEnd,
            })}
            style={{
              cursor: dragSpring.cursor,
              zIndex: 1,
              opacity: animatedStyle.combine.to((o) => 1 - o),
              transform: animatedStyle.combine
                .to({
                  range: [0, 1],
                  output: [1, 0],
                })
                .to((s) => `scale(${s})`),
            }}
            id="drag-here"
          >
            <DragIndicatorIcon height={24} width={24} />
          </animated.div>
</code>```

Body:
When I change my screen from desktop view to mobile view, the drag and drop is not working for me. Instead of drag and drop it selects the text nearby the draggable element. I tried with adding custom events of touchstart, touchend etc. Want a functionality in both desktop view and mobile view.

    const [dragSpring, dragSpringApi] = useSpring(() => ({
    x: 0,
    y: 0,
    zIndex: 0,
    shadow: 0,
    cursor: "grab",
    width: "100%" as string | number,
    position: "absolute" as CSSProperties["position"],
    immediate: (k: string) => k !== "shadow",
  }));

The start function of drag and drop

    const handleDragStart: Parameters<typeof drag>[0]["onStart"] = ({
    initial,
  }) => {
    const startScrollOffset = scrollContainerRef.current
      ? scrollContainerRef.current.scrollTop
      : 0;
    dragSpringApi.start({
      x: initial.item.fixedPosition.left,
      y: initial.item.fixedPosition.top,
      zIndex: 100,
      shadow: 15,
      cursor: "grabbing",
      position: "fixed",
      width: initial.item.width,
      immediate: (k: string) => k !== "shadow",
    });
    return { startScrollOffset };
  };

And the element to be drag and drop which is:

<animated.div
            ref={drag({
              itemId: project.id,
              type: "SIDE_NAV_PROJECT",
              itemRef,
              onStart: handleDragStart,
              onUpdate: handleDragUpdate,
              onEnd: handleDragEnd,
            })}
            style={{
              cursor: dragSpring.cursor,
              zIndex: 1,
              opacity: animatedStyle.combine.to((o) => 1 - o),
              transform: animatedStyle.combine
                .to({
                  range: [0, 1],
                  output: [1, 0],
                })
                .to((s) => `scale(${s})`),
            }}
            id="drag-here"
          >
            <DragIndicatorIcon height={24} width={24} />
          </animated.div>


问:
popup window stick to top while scrolling

I want to close popup when list scroll. How can I achieve this with kotlin??

following code used on onBindViewHolder of categoryAdapter.

```<code>           if (popupWindow != null) {
               popupWindow?.dismiss()
               popupWindow = null
           }

//this code is for open popup menu
val handler = Handler(Looper.getMainLooper())
               val runnable = Runnable {
                   popupOptionMenus(position, holder.relCatSelectionTemp, subCat)
               }
               handler.postDelayed(runnable, 300)```

```

Body:
I want to close popup when list scroll. How can I achieve this with kotlin??

following code used on onBindViewHolder of categoryAdapter.

           if (popupWindow != null) {
               popupWindow?.dismiss()
               popupWindow = null
           }

//this code is for open popup menu
val handler = Handler(Looper.getMainLooper())
               val runnable = Runnable {
                   popupOptionMenus(position, holder.relCatSelectionTemp, subCat)
               }
               handler.postDelayed(runnable, 300)```


问:
The SDK directory is not writable but flutter wanted to install Android SDK in the directory
I try to run my testprogram. The android studio replies "The SDK directory is not writable (C:\Program Files (x86)\Android\android-sdk)".

Well flutter doctor wanted me to install it in this directory to make flutter find the SDK. What can I do to fix it?


问:
Get radius from Vector size
Using p5js a circle gets created:

```<code>EarthSize = createVector(width/3, height/3);
Eclipse(200, 200, EarthSize.x, EarthSize.y);
</code>```

I want to get the size in radius of the circle.

off course I can use width/3 similar to what the vector is using but can I get this directly from the EarthSize vector?

Title: Get radius from Vector size

Body:
Using p5js a circle gets created:

EarthSize = createVector(width/3, height/3);
Eclipse(200, 200, EarthSize.x, EarthSize.y);

I want to get the size in radius of the circle.

off course I can use width/3 similar to what the vector is using but can I get this directly from the EarthSize vector?


问:
International routing in Next js based on region
I am using next.js version 12.2.5. I want to create internationalized region-based sub-path routing in my web app as https://www.apple.com/ do. Let's say the user from Australia lands on my web app, so my route should be like '${mydomain}/au' and the rest of the pages in my web application should be like for eg '${mydomain}/au/faq', '${mydomain}/au/blog' etc. Similarly, if the user from another country let's say India lands on my web application the routing should work like: '${mydomain}/in' and the rest of the pages in my web application should be like for eg '${mydomain}/in/blog', '${mydomain}/in/faq', '${mydomain}/in/about' etc.

I am using i18n sub-path routing strategies of next js. Which allows me to create sub-path routes based on locales. So if a user from Australia comes to my website. My route is automatically changed to '${mydomain}/en-Au' based on the locale configured in my browser.

I only want to show the region in the route i.e '${mydomain}/au' not the complete locale. Can anyone help me to achieve my end goal using the same strategy I am following? Please suggest me a better way of doing this, If I am following the wrong approach.

Your help would be really appreciated. Thanks in Advance.


问:
Change background gradient on scroll + transition
java script is a new area for me but i’m working my way through it. I’m stuck right now and just can’t get any further.

I would like the background to change depending on the position when scrolling. The whole page should have several color gradients and a smooth transition between the changes. I get the gradients, but not the smooth transition. Are transition already available for css/javascript?

Hope somebody can help me out
Cheers

```<code>\<script\>
{
var body = document.getElementsByTagName(‘body’)\[0\];
body.style.background = ‘linear-gradient(0deg, rgba(63,94,251,1) 0%, rgba(214,20,20,1) 100%)’;

    window.onscroll = function (event)

            {
        var scroll = window.pageYOffset;
        if (scroll < 300) {

           body.style.background = 'linear-gradient(0deg, rgba(63,94,251,1) 0%, rgba(28,255,9,1) 100%), transition: background 5s ease';
                    }

                else if (scroll >= 300 && scroll < 600) {

            body.style.background = 'linear-gradient(0deg, rgba(63,94,251,1) 0%, rgba(171,156,46,1) 100%), transition: background 5s ease';

        }

                else if (scroll >= 600 && scroll < 1200) {

            body.style.background  = 'linear-gradient(0deg, rgba(63,94,251,1) 0%, rgba(46,161,171,1) 100%), transition: background 5s ease';
        }

    }

;

\</script\>
</code>```

Body:
java script is a new area for me but i’m working my way through it. I’m stuck right now and just can’t get any further.

I would like the background to change depending on the position when scrolling. The whole page should have several color gradients and a smooth transition between the changes. I get the gradients, but not the smooth transition. Are transition already available for css/javascript?

Hope somebody can help me out
Cheers

\