问:
Jest: How can I pan while testing the rating component using fireGestureHandler from react-native-gesture-handler?
I have created a swipeable rating component:

import FontistiIcon from '@expo/vector-icons/Fontisto';
import React, { useCallback, useMemo } from 'react';
import { LayoutRectangle, View } from 'react-native';
import {
  Gesture,
  GestureDetector,
  TouchableOpacity,
} from 'react-native-gesture-handler';

import { useTheme } from '@theme';
import { roundToStep } from '@utils';

import { useStyle } from './numerical-rating.styles';
import { RatingProps } from './numerical-rating.type';

const NumericalRating: React.FC<RatingProps> = props => {
  const {
    scale = 5,
    testID = 'TestID__component-NumericalRating',
    starTestID = 'TestID__component-NumericalRating-star',
    isFractional = false,
    onChange,
    value,
  } = props;
  const styles = useStyle();
  const theme = useTheme();
  const [ratingContainerLayout, setRatingContainerLayout] =
    React.useState<LayoutRectangle | null>(null);

  // if scale is not a whole number, then we need to round it to the nearest whole number
  const scaleRounded = Math.round(scale);
  const scaleList = Array.from(Array(scaleRounded).keys(), x => x + 1);

  // Create [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
  const fractionalScaleList = scaleList.reduce<number[][]>(
    (acc, curr) => [...acc, [curr - 0.5, curr]],
    [],
  );

  const iconSize = theme.t.moderateScale(58);
  const iconWidth = Math.floor(iconSize / 2);

  // value should be between the range of 0 and scale
  const selectedRating = Math.max(0, Math.min(value, scale));
  const [draggedRating, setDraggedRating] = React.useState(selectedRating);

  const onRatingTap = (rating: number) => () => {
    onChange(rating);
    setDraggedRating(rating);
  };

  const getRatingByPosition = useCallback(
    (position: number) => {
      if (ratingContainerLayout?.width) {
        // get the rating icon size based on the number of stars and width of the container
        const ratingIconSize = ratingContainerLayout.width / scaleRounded;

        // Calculate the rating value based on the position of the finger
        const calculatedRatingValue = position / ratingIconSize;

        return roundToStep(calculatedRatingValue, isFractional ? 0.5 : 1);
      }

      return 0;
    },
    [isFractional, ratingContainerLayout, scaleRounded],
  );

  /**
   * ONLY IF YOU NEED IT
   * 1. shouldCancelWhenOutside - should cancel the gesture if the user moves their
   * finger outside of the rating container
   *
   * 2. failOffsetY([0, 0]) - should fail the gesture if the user moves their finger
   * vertically. First zero indicates the minimum offset to the top, second zero
   * indicates the minimum offset to the bottom. We have set both to zero because
   * we want the user to be able to move their finger vertically so that they could
   * scroll the screen
   */
  const gesture = useMemo(
    () =>
      Gesture.Pan()
        .runOnJS(true)
        .onUpdate(e => {
          setDraggedRating(getRatingByPosition(e.x));
        })
        .onEnd(e => {
          onChange(getRatingByPosition(e.x));
        }),
    [getRatingByPosition, onChange],
  );

  // Render the full icon rating
  const renderScale = () =>
    scaleList.map(rating => (
      <TouchableOpacity
        key={rating}
        onPress={onRatingTap(rating)}
        testID={starTestID}
        accessibilityState={{
          selected: draggedRating >= rating,
        }}
      >
        <View style={styles.scale}>
          <FontistiIcon
            name="star"
            size={iconSize}
            color={
              draggedRating >= rating
                ? theme.t.palette.accents.color2
                : theme.t.palette.accents.color4
            }
          />
        </View>
      </TouchableOpacity>
    ));

  // fractionalScaleList = e.g [[0.5, 1], [1.5, 2], [2.5, 3], [3.5, 4], [4.5, 5]]
  // Render the fractional icon rating
  const renderFractionalScale = () =>
    fractionalScaleList.map((ratingPair: number[], index) => (
      <View style={[styles.ratingPair, styles.scale]} key={index}>
        {/* ratingPair = e.g [0.5, 1] */}
        {ratingPair.map((rating: number) => (
          <View key={rating} style={rating % 1 === 0 ? styles.rightHalf : {}}>
            <TouchableOpacity
              onPress={onRatingTap(rating)}
              testID={starTestID}
              accessibilityState={{
                selected: draggedRating >= rating,
              }}
            >
              <FontistiIcon
                name="star-half"
                size={iconSize}
                style={{
                  width: iconWidth,
                }}
                color={
                  draggedRating >= rating
                    ? theme.t.palette.accents.color2
                    : theme.t.palette.accents.color4
                }
              />
            </TouchableOpacity>
          </View>
        ))}
      </View>
    ));

  // Render the rating scale based on the isFractional prop
  const renderRating = () => {
    if (isFractional) {
      return renderFractionalScale();
    }

    return renderScale();
  };

  return (
    <GestureDetector gesture={gesture}>
      {/* This View helps us in letting the panning continue even after
      reaching the end */}
      <View>
        {/* This View is contained within the width of the rendered stars */}
        <View
          style={styles.container}
          testID={testID}
          onLayout={e => setRatingContainerLayout(e.nativeEvent.layout)}
        >
          {renderRating()}
        </View>
      </View>
    </GestureDetector>
  );
};

export default NumericalRating;

```
<p>I am trying to test the pan gesture using <code>fireGestureHandler</code> from <code>react-native-gesture-handler/jest-utils</code>. Below, you can see the code I have written:</p>
<pre class="lang-js prettyprint-override"><code>  it('should select the correct star on swipe', () => {
    const onChange = jest.fn();
    render(<NumericalRating value={2} onChange={onChange} />);

    const starContainer = screen.getByTestId(
      'TestID__component-NumericalRating',
    );

    fireGestureHandler<PanGesture>(starContainer, [
      { x: 5, y: 15 },
      { x: 6, y: 16 },
      { x: 7, y: 17 },
    ]);

    expect(onChange).toHaveBeenCalledWith(1);
  });
</code>```

The component doesn't detect the pan gesture. react-native-gesture-handler doesn't have a lot of examples showing how we test pan gestures. The piece of code related to the pan gesture reduces my code coverage.

Body:
I have created a swipeable rating component:

import FontistiIcon from '@expo/vector-icons/Fontisto';
import React, { useCallback, useMemo } from 'react';
import { LayoutRectangle, View } from 'react-native';
import {
  Gesture,
  GestureDetector,
  TouchableOpacity,
} from 'react-native-gesture-handler';

import { useTheme } from '@theme';
import { roundToStep } from '@utils';

import { useStyle } from './numerical-rating.styles';
import { RatingProps } from './numerical-rating.type';

const NumericalRating: React.FC<RatingProps> = props => {
  const {
    scale = 5,
    testID = 'TestID__component-NumericalRating',
    starTestID = 'TestID__component-NumericalRating-star',
    isFractional = false,
    onChange,
    value,
  } = props;
  const styles = useStyle();
  const theme = useTheme();
  const [ratingContainerLayout, setRatingContainerLayout] =
    React.useState<LayoutRectangle | null>(null);

  // if scale is not a whole number, then we need to round it to the nearest whole number
  const scaleRounded = Math.round(scale);
  const scaleList = Array.from(Array(scaleRounded).keys(), x => x + 1);

  // Create [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
  const fractionalScaleList = scaleList.reduce<number[][]>(
    (acc, curr) => [...acc, [curr - 0.5, curr]],
    [],
  );

  const iconSize = theme.t.moderateScale(58);
  const iconWidth = Math.floor(iconSize / 2);

  // value should be between the range of 0 and scale
  const selectedRating = Math.max(0, Math.min(value, scale));
  const [draggedRating, setDraggedRating] = React.useState(selectedRating);

  const onRatingTap = (rating: number) => () => {
    onChange(rating);
    setDraggedRating(rating);
  };

  const getRatingByPosition = useCallback(
    (position: number) => {
      if (ratingContainerLayout?.width) {
        // get the rating icon size based on the number of stars and width of the container
        const ratingIconSize = ratingContainerLayout.width / scaleRounded;

        // Calculate the rating value based on the position of the finger
        const calculatedRatingValue = position / ratingIconSize;

        return roundToStep(calculatedRatingValue, isFractional ? 0.5 : 1);
      }

      return 0;
    },
    [isFractional, ratingContainerLayout, scaleRounded],
  );

  /**
   * ONLY IF YOU NEED IT
   * 1. shouldCancelWhenOutside - should cancel the gesture if the user moves their
   * finger outside of the rating container
   *
   * 2. failOffsetY([0, 0]) - should fail the gesture if the user moves their finger
   * vertically. First zero indicates the minimum offset to the top, second zero
   * indicates the minimum offset to the bottom. We have set both to zero because
   * we want the user to be able to move their finger vertically so that they could
   * scroll the screen
   */
  const gesture = useMemo(
    () =>
      Gesture.Pan()
        .runOnJS(true)
        .onUpdate(e => {
          setDraggedRating(getRatingByPosition(e.x));
        })
        .onEnd(e => {
          onChange(getRatingByPosition(e.x));
        }),
    [getRatingByPosition, onChange],
  );

  // Render the full icon rating
  const renderScale = () =>
    scaleList.map(rating => (
      <TouchableOpacity
        key={rating}
        onPress={onRatingTap(rating)}
        testID={starTestID}
        accessibilityState={{
          selected: draggedRating >= rating,
        }}
      >
        <View style={styles.scale}>
          <FontistiIcon
            name="star"
            size={iconSize}
            color={
              draggedRating >= rating
                ? theme.t.palette.accents.color2
                : theme.t.palette.accents.color4
            }
          />
        </View>
      </TouchableOpacity>
    ));

  // fractionalScaleList = e.g [[0.5, 1], [1.5, 2], [2.5, 3], [3.5, 4], [4.5, 5]]
  // Render the fractional icon rating
  const renderFractionalScale = () =>
    fractionalScaleList.map((ratingPair: number[], index) => (
      <View style={[styles.ratingPair, styles.scale]} key={index}>
        {/* ratingPair = e.g [0.5, 1] */}
        {ratingPair.map((rating: number) => (
          <View key={rating} style={rating % 1 === 0 ? styles.rightHalf : {}}>
            <TouchableOpacity
              onPress={onRatingTap(rating)}
              testID={starTestID}
              accessibilityState={{
                selected: draggedRating >= rating,
              }}
            >
              <FontistiIcon
                name="star-half"
                size={iconSize}
                style={{
                  width: iconWidth,
                }}
                color={
                  draggedRating >= rating
                    ? theme.t.palette.accents.color2
                    : theme.t.palette.accents.color4
                }
              />
            </TouchableOpacity>
          </View>
        ))}
      </View>
    ));

  // Render the rating scale based on the isFractional prop
  const renderRating = () => {
    if (isFractional) {
      return renderFractionalScale();
    }

    return renderScale();
  };

  return (
    <GestureDetector gesture={gesture}>
      {/* This View helps us in letting the panning continue even after
      reaching the end */}
      <View>
        {/* This View is contained within the width of the rendered stars */}
        <View
          style={styles.container}
          testID={testID}
          onLayout={e => setRatingContainerLayout(e.nativeEvent.layout)}
        >
          {renderRating()}
        </View>
      </View>
    </GestureDetector>
  );
};

export default NumericalRating;

I am trying to test the pan gesture using fireGestureHandler from react-native-gesture-handler/jest-utils. Below, you can see the code I have written:

  it('should select the correct star on swipe', () => {
    const onChange = jest.fn();
    render(<NumericalRating value={2} onChange={onChange} />);

    const starContainer = screen.getByTestId(
      'TestID__component-NumericalRating',
    );

    fireGestureHandler<PanGesture>(starContainer, [
      { x: 5, y: 15 },
      { x: 6, y: 16 },
      { x: 7, y: 17 },
    ]);

    expect(onChange).toHaveBeenCalledWith(1);
  });

The component doesn't detect the pan gesture. react-native-gesture-handler doesn't have a lot of examples showing how we test pan gestures. The piece of code related to the pan gesture reduces my code coverage.


来源: stackexchange

问:
How to include multiple arguments to seasonal_decompose for ARIMA forecasting?
I would like to forecast multiple variables over quarters. Currently, my code can only work with one column. And I would also like the plot to display the each x-axis position as a date or quarter instead of arbitrary numbers.

Here is my code:

```<code>import pandas as pd
    from datetime import date, timedelta
    import datetime
    import matplotlib.pyplot as plt
    plt.style.use('fivethirtyeight')
    from statsmodels.tsa.seasonal import seasonal_decompose
    from statsmodels.graphics.tsaplots import plot_pacf
    from statsmodels.tsa.arima_model import ARIMA
    import statsmodels.api as sm
    import warnings

    from plotly.offline import download_plotlyjs, init_notebook_mode,  plot
    from plotly.graph_objs import *
    init_notebook_mode()

    'set filepath'

    inputfilepath = 'C:/Documents/' \
                'Forecast/Input/' \
                    'Forecast Data csv.csv'

    df = pd.read_csv(inputfilepath)

    'Convert column from object to datetime'

df["Time Period"] = pd.to_datetime(df['Time Period'], format="%d/%m/%Y")

print(df["Time Period"].dtype)

print(df)

'display graphical output using df columns and rows and dependant and independant variables'

    import plotly.express as px
    figure = px.line(df, x="Time Period",
                      y=["HR","Legal","Fin","Leadership" \
                        ,"Market","UX","Overall"],
                     title='Quarterly scores')

result = seasonal_decompose(df["HR","Legal","Fin","Leadership" \
                        ,"Market","UX","Overall"],
                            model='multiplicative', period = 3)

fig = plt.figure()
fig = result.plot()
</code>```

The line:

```<code>>result = seasonal_decompose(df["HR","Legal","Fin","Leadership" \
                            ,"Market","UX","Overall"],
                            model='multiplicative', period = 3)
</code>```

gives me the following error:

KeyError: ('HR', 'Legal', 'Fin', 'Leadership', 'Market', 'UX', 'EM&T')

and if, instead I use:

```<code>>result = seasonal_decompose(df["HR"],["Legal"],["Fin"],["Leadership"] \
                                     ,["Market"],["UX"],["Overall"],
                                    model='multiplicative', period = 3)
</code>```

I get the following error:

```<code>>TypeError: seasonal_decompose() got multiple values for argument 'model'
</code>```

The only way I've gotten it to somewhat work is to write an individual line for each variable:

```<code>result1 = seasonal_decompose(df["HR"],
                                      model='multiplicative', period = 3)

result2 = seasonal_decompose(df["Legal"],
                                      model='multiplicative', period = 3)

result3 = seasonal_decompose(df["Fin"],
                                      model='multiplicative', period = 3)

result4 = seasonal_decompose(df["Leadership"],
                                      model='multiplicative', period = 3)

result5 = seasonal_decompose(df["Market"],
                                      model='multiplicative', period = 3)

result6 = seasonal_decompose(df["UX"],
                                      model='multiplicative', period = 3)

result7 = seasonal_decompose(df["Overall"],
                                      model='multiplicative', period = 3)

fig1 = plt.figure()
fig1 = result1.plot()

fig2 = plt.figure()
fig2 = result2.plot()

fig3 = plt.figure()
fig3 = result3.plot()

fig4 = plt.figure()
fig4 = result4.plot()

fig5 = plt.figure()
fig5 = result5.plot()

fig6 = plt.figure()
fig6 = result6.plot()

fig7 = plt.figure()
fig7 = result7.plot()
</code>```

Which gives me this example of HR where the x-axis doesn't really make sense to me:

Is there a way to incorporate all these variables into one 'result' variable and one plot graph?

ContentLicense: CC BY-SA 4.0

Body:
I would like to forecast multiple variables over quarters. Currently, my code can only work with one column. And I would also like the plot to display the each x-axis position as a date or quarter instead of arbitrary numbers.

Here is my code:

import pandas as pd
    from datetime import date, timedelta
    import datetime
    import matplotlib.pyplot as plt
    plt.style.use('fivethirtyeight')
    from statsmodels.tsa.seasonal import seasonal_decompose
    from statsmodels.graphics.tsaplots import plot_pacf
    from statsmodels.tsa.arima_model import ARIMA
    import statsmodels.api as sm
    import warnings

    from plotly.offline import download_plotlyjs, init_notebook_mode,  plot
    from plotly.graph_objs import *
    init_notebook_mode()

    'set filepath'

    inputfilepath = 'C:/Documents/' \
                'Forecast/Input/' \
                    'Forecast Data csv.csv'

    df = pd.read_csv(inputfilepath)

    'Convert column from object to datetime'

df["Time Period"] = pd.to_datetime(df['Time Period'], format="%d/%m/%Y")

print(df["Time Period"].dtype)

print(df)

'display graphical output using df columns and rows and dependant and independant variables'

    import plotly.express as px
    figure = px.line(df, x="Time Period",
                      y=["HR","Legal","Fin","Leadership" \
                        ,"Market","UX","Overall"],
                     title='Quarterly scores')

result = seasonal_decompose(df["HR","Legal","Fin","Leadership" \
                        ,"Market","UX","Overall"],
                            model='multiplicative', period = 3)

fig = plt.figure()
fig = result.plot()

The line:

>result = seasonal_decompose(df["HR","Legal","Fin","Leadership" \
                            ,"Market","UX","Overall"],
                            model='multiplicative', period = 3)

gives me the following error:

KeyError: ('HR', 'Legal', 'Fin', 'Leadership', 'Market', 'UX', 'EM&T')

and if, instead I use:

>result = seasonal_decompose(df["HR"],["Legal"],["Fin"],["Leadership"] \
                                     ,["Market"],["UX"],["Overall"],
                                    model='multiplicative', period = 3)

I get the following error:

>TypeError: seasonal_decompose() got multiple values for argument 'model'

The only way I've gotten it to somewhat work is to write an individual line for each variable:

result1 = seasonal_decompose(df["HR"],
                                      model='multiplicative', period = 3)

result2 = seasonal_decompose(df["Legal"],
                                      model='multiplicative', period = 3)

result3 = seasonal_decompose(df["Fin"],
                                      model='multiplicative', period = 3)

result4 = seasonal_decompose(df["Leadership"],
                                      model='multiplicative', period = 3)

result5 = seasonal_decompose(df["Market"],
                                      model='multiplicative', period = 3)

result6 = seasonal_decompose(df["UX"],
                                      model='multiplicative', period = 3)

result7 = seasonal_decompose(df["Overall"],
                                      model='multiplicative', period = 3)

fig1 = plt.figure()
fig1 = result1.plot()

fig2 = plt.figure()
fig2 = result2.plot()

fig3 = plt.figure()
fig3 = result3.plot()

fig4 = plt.figure()
fig4 = result4.plot()

fig5 = plt.figure()
fig5 = result5.plot()

fig6 = plt.figure()
fig6 = result6.plot()

fig7 = plt.figure()
fig7 = result7.plot()

Which gives me this example of HR where the x-axis doesn't really make sense to me:

Is there a way to incorporate all these variables into one 'result' variable and one plot graph?


问:
Why is PostgreSQL giving me an UndefinedFunction error (Version 9.6)
I'm learning PosgreSQL, i'm trying to call function get_color in a SELECT statement inserting the column name of the table as parameter, but PostgreSQL version 9.6 (i've tried on 13.0 with the same result) returns me an UndefinedFunction error.

Here's the complete query code:

```<code>SELECT n
FROM pianokeys pn,
LATERAL get_color(pn.n) AS res;

CREATE OR REPLACE FUNCTION get_color(n integer) RETURNS text AS $$

  BEGIN

    IF((n % 88) % 2)

    THEN

       RETURN $b$black$b$;

    ELSE

       RETURN $w$white$w$;

    END IF;

  END;
  $$

  LANGUAGE plpgsql;
</code>```

`

Here's the compiler error:

```<code>There was an error with the SQL query:

PG::UndefinedFunction: ERROR:  function get_color(integer) does not exist
LINE 8: lateral get_color(pn.n) as res) AS "t1" LIMIT 1
                ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
</code>```

What am i missing?

Body:
I'm learning PosgreSQL, i'm trying to call function get_color in a SELECT statement inserting the column name of the table as parameter, but PostgreSQL version 9.6 (i've tried on 13.0 with the same result) returns me an UndefinedFunction error.

Here's the complete query code:

SELECT n
FROM pianokeys pn,
LATERAL get_color(pn.n) AS res;

CREATE OR REPLACE FUNCTION get_color(n integer) RETURNS text AS $$

  BEGIN

    IF((n % 88) % 2)

    THEN

       RETURN $b$black$b$;

    ELSE

       RETURN $w$white$w$;

    END IF;

  END;
  $$

  LANGUAGE plpgsql;

`

Here's the compiler error:

There was an error with the SQL query:

PG::UndefinedFunction: ERROR:  function get_color(integer) does not exist
LINE 8: lateral get_color(pn.n) as res) AS "t1" LIMIT 1
                ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

What am i missing?


问:
Automatic review and analysis of AWS Identity Center managed users and groups for permissions granted
I want to use something like IAM analyzer but with more details of analysis for permissions review process.

Also we have moved out of Iam Completely and is now using SSO or Okta to manage our users and policies grant. (hence Iam analyzer only able to detect assume role time for users)

Is there any way i can get the following details for monthly or half yearly review ? requirements:

list of users and groups. what groups are they in

with those users. what permissions they

optional: last access

i have searched through the console and documents but no native feature


问:
How can I see the effect sizes of my predictor variables on both my dependent variables in a system of equations?
I originally got two formulas that were expected two have the same predictor variables (X-variables) and the same control variables (C-variables):

```<code>Y1 = X1 + X2 + X3 + C1 + C2 + C3
Y2 = X1 + X2 + X3 + C1 + C2 + C3
</code>```

However, my dependent variable Y1 could also be used as a dependent variable in the regression for Y2. So my new formula became:

```<code>Y1 = X1 + X2 + X3 + C1 + C2 + C3
Y2 = Y1 + X1 + X2 + X3 + C1 + C2 + C3
</code>```

I tried to model this as a system of equations in R. I understand that "X1 + X2 + X3 + C1 + C2 + C3" should not be in the formula for Y2 as they already are in the formula for Y1. Now the problem is that I am interested in the effect of the predictor variables on Y1 as well as Y2 (in order to reject or approve hypotheses), but the output form my system of equations only gives the effect of Y1 on Y2. How can I account for the effect of Y1 on Y2 and also be able to see the effects of X1, X2 and X3 on both formulas?

I have used the following formula:

```<code>model_1 <- ivreg(Y2 ~ Y1 + C1
                 |. - Y1 + X1 + X2 + X3 + C2 + C3, data = df)
</code>```

This gives the following output:

Body:
I originally got two formulas that were expected two have the same predictor variables (X-variables) and the same control variables (C-variables):

Y1 = X1 + X2 + X3 + C1 + C2 + C3
Y2 = X1 + X2 + X3 + C1 + C2 + C3

However, my dependent variable Y1 could also be used as a dependent variable in the regression for Y2. So my new formula became:

Y1 = X1 + X2 + X3 + C1 + C2 + C3
Y2 = Y1 + X1 + X2 + X3 + C1 + C2 + C3

I tried to model this as a system of equations in R. I understand that "X1 + X2 + X3 + C1 + C2 + C3" should not be in the formula for Y2 as they already are in the formula for Y1. Now the problem is that I am interested in the effect of the predictor variables on Y1 as well as Y2 (in order to reject or approve hypotheses), but the output form my system of equations only gives the effect of Y1 on Y2. How can I account for the effect of Y1 on Y2 and also be able to see the effects of X1, X2 and X3 on both formulas?

I have used the following formula:

model_1 <- ivreg(Y2 ~ Y1 + C1
                 |. - Y1 + X1 + X2 + X3 + C2 + C3, data = df)

This gives the following output:


问:
How to create expandable icon groups in pyqt?
I created an application in PyQt using QListView that has a bunch of icons when doubled clicked opens respective application.

I'd like to combine similar category apps into one group to reduce clutter. User can click on the group to expand and select the icon/app they need. Click outside to collapse the group. The group needs to be in the same level as other icons/apps

I tried using Stacked Widget but that's not an elegant solution. What widgets/techniques can I use to achieve this? Thanks in advance!

Edit:
To clarify, I'm using Icon based GUI instead of list based

I'd like to combine multiple icons into single group that expands to show icons. Similar to grouping apps together on a phone.


问:
Per-voxel code vector equates to a per-voxel feature channel?
in this paper they mention "learned per-voxel code vectors", or "We extract a feature vector from the feature map using bilinear sampling and store the result in the code vector associated with the voxel."

This was very confusing until they mentioned the following:
" We use a uniform volumetric grid of size w x h x d voxels, where each voxel has f feature channels, i.e., the stored code vector has size f . "
From this, is it accurate to conclude that its basically like an RGB image, which consists of 3 tensors, one for each colour?

What further confuses me is that a voxel is a single unit, how does it have a feature channel?


问:
AWS CDK / NodejsFunction: beforeInstall, beforeBundling, afterBundling
I'm working on a project with an AWS Infrastructure. I work with aws-cdk-lib for IaC to simplify the whole process.

The flow is the following:

User upload photo/video to S3 Bucket

A lambda is triggered to compress the file with sharp and store it on another S3 Bucket with a short TTL.

A S3 Notification event trigger another lambda which will upload the S3Object to a Storj Bucket.

So, I need to use uplink-nodejs library to store images and videos on the Storj DCS service.

The issue is that, in order to install uplink-nodejs i need to install make command and copy ./node_modules/uplink-nodejs/* / for uplink command to be available to the system.

But I can't find a way to install all required dependancies and make the required commands.

I've already tried multiple solutions:

Use NodejsFunction bundling options (beforeInstall, beforeBundling, afterBundling).

Create a .dockerfile in my lambda folder.

The first solution throw an error for su command and sudo command, which prevent me from installing make

The second solution doesn't seems specifically relevant in my situation.

Someone have an idea of what's happening ?

Here's the AWS CDK NestedStack for the ContentService with the lambdas:

```<code>import * as cdk from 'aws-cdk-lib';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as s3 from 'aws-cdk-lib/aws-s3';

import * as path from 'path';

import { Construct } from 'constructs';
import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';
import { DockerImage } from 'aws-cdk-lib';
import { LambdaDestination } from 'aws-cdk-lib/aws-s3-notifications';

interface ContentServiceProps extends cdk.NestedStackProps {
    main_table: dynamodb.Table;
    user_content_bucket: s3.Bucket;
};

export class ContentService extends cdk.NestedStack {

    public readonly content_service_handler: NodejsFunction;
    public readonly storj_image_lambda: NodejsFunction;

    constructor(scope: Construct, id: string, props: ContentServiceProps) {
        super(scope, id, props);

        this.storj_image_lambda = new NodejsFunction(this, "storj_image_lambda", {
            entry: path.join(__dirname, '../../lambda-fns/src/functions/storj_upload/index.ts'),
            bundling: {
                nodeModules: ["uplink-nodejs", "node-gyp"],
                forceDockerBundling: true,
                commandHooks: {
                    beforeInstall(_inputDir, outputDir) {
                        return [
                            'export PATH=$PATH:$GOPATH/bin',
                            'sudo yum -y install make'
                        ]
                    },
                    beforeBundling(inputDir, outputDir) {
                        return [
                            ''
                        ]
                    },
                    afterBundling(inputDir, outputDir) {
                        return [`cp -r ./node_modules/uplink-nodejs /usr`]
                    }
                }
            }
        });

        this.content_service_handler = new NodejsFunction(this, "content_service_handler", {
            runtime: lambda.Runtime.NODEJS_16_X,
            handler: 'handler',
            entry: path.join(__dirname, "../../lambda-fns/src/functions/content/index.ts"),
            environment: {
                TABLE_NAME: props.main_table.tableName,
                USER_CONTENT: props.user_content_bucket.bucketName,
                STORJ_LAMBDA: this.storj_image_lambda.functionName
            }
        });

        props.main_table.grantFullAccess(this.content_service_handler);
        props.user_content_bucket.grantRead(this.content_service_handler);
        props.user_content_bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new LambdaDestination(this.storj_image_lambda));
    };
};
</code>```

And here's the logs I get when I try to deploy the my Stack:

```<code>Bundling asset MainStack/content_service/storj_image_lambda/Code/Stage...

  asset-output/index.js  1.5kb

⚡ Done in 21ms
bash: sudo: command not found
/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/core/lib/asset-staging.js:2
`),localBundling=options.local?.tryBundle(bundleDir,options),!localBundling){let user;if(options.user)user=options.user;else{const userInfo=os.userInfo();user=userInfo.uid!==-1?`${userInfo.uid}:${userInfo.gid}`:"1000:1000"}options.image.run({command:options.command,user,volumes,environment:options.environment,entrypoint:options.entrypoint,workingDirectory:options.workingDirectory??AssetStaging.BUNDLING_INPUT_DIR,securityOpt:options.securityOpt??""})}}catch(err){const bundleErrorDir=bundleDir+"-error";throw fs.existsSync(bundleErrorDir)&&fs.removeSync(bundleErrorDir),fs.renameSync(bundleDir,bundleErrorDir),new Error(`Failed to bundle asset ${this.node.path}, bundle output is located at ${bundleErrorDir}: ${err}`)}if(fs_1.FileSystem.isEmpty(bundleDir)){const outputDir=localBundling?bundleDir:AssetStaging.BUNDLING_OUTPUT_DIR;throw new Error(`Bundling did not produce any output. Check that content is written to ${outputDir}.`)}}calculateHash(hashType,bundling,outputDir){if(hashType==assets_1.AssetHashType.CUSTOM||hashType==assets_1.AssetHashType.SOURCE&&bundling){const hash=crypto.createHash("sha256");return hash.update(this.customSourceFingerprint??fs_1.FileSystem.fingerprint(this.sourcePath,this.fingerprintOptions)),bundling&&hash.update(JSON.stringify(bundling)),hash.digest("hex")}switch(hashType){case assets_1.AssetHashType.SOURCE:return fs_1.FileSystem.fingerprint(this.sourcePath,this.fingerprintOptions);case assets_1.AssetHashType.BUNDLE:case assets_1.AssetHashType.OUTPUT:if(!outputDir)throw new Error(`Cannot use \`${hashType}\` hash type when \`bundling\` is not specified.`);return fs_1.FileSystem.fingerprint(outputDir,this.fingerprintOptions);default:throw new Error("Unknown asset hash type.")}}}exports.AssetStaging=AssetStaging,_a=JSII_RTTI_SYMBOL_1,AssetStaging[_a]={fqn:"aws-cdk-lib.AssetStaging",version:"2.53.0"},AssetStaging.BUNDLING_INPUT_DIR="/asset-input",AssetStaging.BUNDLING_OUTPUT_DIR="/asset-output",AssetStaging.assetCache=new cache_1.Cache;function renderAssetFilename(assetHash,extension=""){return`asset.${assetHash}${extension}`}function determineHashType(assetHashType,customSourceFingerprint){const hashType=customSourceFingerprint?assetHashType??assets_1.AssetHashType.CUSTOM:assetHashType??assets_1.AssetHashType.SOURCE;if(customSourceFingerprint&&hashType!==assets_1.AssetHashType.CUSTOM)throw new Error(`Cannot specify \`${assetHashType}\` for \`assetHashType\` when \`assetHash\` is specified. Use \`CUSTOM\` or leave \`undefined\`.`);if(hashType===assets_1.AssetHashType.CUSTOM&&!customSourceFingerprint)throw new Error("`assetHash` must be specified when `assetHashType` is set to `AssetHashType.CUSTOM`.");return hashType}function calculateCacheKey(props){return crypto.createHash("sha256").update(JSON.stringify(sortObject(props))).digest("hex")}function sortObject(object){if(typeof object!="object"||object instanceof Array)return object;const ret={};for(const key of Object.keys(object).sort())ret[key]=sortObject(object[key]);return ret}function singleArchiveFile(directory){if(!fs.existsSync(directory))throw new Error(`Directory ${directory} does not exist.`);if(!fs.statSync(directory).isDirectory())throw new Error(`${directory} is not a directory.`);const content=fs.readdirSync(directory);if(content.length===1){const file=path.join(directory,content[0]),extension=getExtension(content[0]).toLowerCase();if(fs.statSync(file).isFile()&&ARCHIVE_EXTENSIONS.includes(extension))return file}}function determineBundledAsset(bundleDir,outputType){const archiveFile=singleArchiveFile(bundleDir);switch(outputType===bundling_1.BundlingOutput.AUTO_DISCOVER&&(outputType=archiveFile?bundling_1.BundlingOutput.ARCHIVED:bundling_1.BundlingOutput.NOT_ARCHIVED),outputType){case bundling_1.BundlingOutput.NOT_ARCHIVED:return{path:bundleDir,packaging:assets_1.FileAssetPackaging.ZIP_DIRECTORY};case bundling_1.BundlingOutput.ARCHIVED:if(!archiveFile)throw new Error("Bundling output directory is expected to include only a single archive file when `output` is set to `ARCHIVED`");return{path:archiveFile,packaging:assets_1.FileAssetPackaging.FILE,extension:getExtension(archiveFile)}}}function getExtension(source){for(const ext of ARCHIVE_EXTENSIONS)if(source.toLowerCase().endsWith(ext))return ext;return path.extname(source)}
                                                                                ^
Error: Failed to bundle asset MainStack/content_service/storj_image_lambda/Code/Stage, bundle output is located at /Users/thomgeenen/Git/nude_safer_cdk/cdk.out/bundling-temp-4e95a752d2aca74dd84aa402102b31591eb7ee9ec0a94b306360353a61e924f0-error: Error: docker exited with status 127
    at AssetStaging.bundle (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/core/lib/asset-staging.js:2:614)
    at AssetStaging.stageByBundling (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:4506)
    at stageThisAsset (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:1867)
    at Cache.obtain (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/core/lib/private/cache.js:1:242)
    at new AssetStaging (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:2262)
    at new Asset (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.js:1:736)
    at AssetCode.bind (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/aws-lambda/lib/code.js:1:4628)
    at new Function (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/aws-lambda/lib/function.js:1:2803)
    at new NodejsFunction (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/function.js:1:1171)
    at new ContentService (/Users/thomgeenen/Git/nude_safer_cdk/lib/services/content/index.ts:24:35)
Detected file changes during deployment. Invoking 'cdk deploy' again
[+] Building 0.5s (13/13) FINISHED
 => [internal] load build definition from Dockerfile                                                                                0.0s
 => => transferring dockerfile: 37B                                                                                0.0s
 => [internal] load .dockerignore                                                                                0.0s
 => => transferring context: 2B                                                                                0.0s
 => [internal] load metadata for public.ecr.aws/sam/build-nodejs14.x:latest                                                                    0.4s
 => [1/9] FROM public.ecr.aws/sam/build-nodejs14.x@sha256:cfe32c14b97a6d5d7128f4e110c6d11b80bf89c0cca8a3493879f8c587627655                     0.0s
 => CACHED [2/9] RUN npm install --global yarn@1.22.5                                                                                0.0s
 => CACHED [3/9] RUN npm install --global pnpm                                                                                0.0s
 => CACHED [4/9] RUN npm install --global typescript                                                                                0.0s
 => CACHED [5/9] RUN npm install --global --unsafe-perm=true esbuild@0                                                                         0.0s
 => CACHED [6/9] RUN mkdir /tmp/npm-cache &&     chmod -R 777 /tmp/npm-cache &&     npm config --global set cache /tmp/npm-cache               0.0s
 => CACHED [7/9] RUN mkdir /tmp/yarn-cache &&     chmod -R 777 /tmp/yarn-cache &&     yarn config set cache-folder /tmp/yarn-cache             0.0s
 => CACHED [8/9] RUN npm config --global set update-notifier false                                                                             0.0s
 => CACHED [9/9] RUN /sbin/useradd -u 1000 user && chmod 711 /                                                                                0.0s
 => exporting to image                                                                                0.0s
 => => exporting layers                                                                                0.0s
 => => writing image sha256:c83389551577052395325ed8a0fb51c59639344b8c92baa1656956f23c765d18                                                   0.0s
 => => naming to docker.io/library/cdk-7ef608663d730a301f1ab98604e57fd96273751c63db25a1a75f1390f462c655                                        0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
</code>```

Body:
I'm working on a project with an AWS Infrastructure. I work with aws-cdk-lib for IaC to simplify the whole process.

The flow is the following:

User upload photo/video to S3 Bucket

A lambda is triggered to compress the file with sharp and store it on another S3 Bucket with a short TTL.

A S3 Notification event trigger another lambda which will upload the S3Object to a Storj Bucket.

So, I need to use uplink-nodejs library to store images and videos on the Storj DCS service.

The issue is that, in order to install uplink-nodejs i need to install make command and copy ./node_modules/uplink-nodejs/* / for uplink command to be available to the system.

But I can't find a way to install all required dependancies and make the required commands.

I've already tried multiple solutions:

Use NodejsFunction bundling options (beforeInstall, beforeBundling, afterBundling).

Create a .dockerfile in my lambda folder.

The first solution throw an error for su command and sudo command, which prevent me from installing make

The second solution doesn't seems specifically relevant in my situation.

Someone have an idea of what's happening ?

Here's the AWS CDK NestedStack for the ContentService with the lambdas:

import * as cdk from 'aws-cdk-lib';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import * as s3 from 'aws-cdk-lib/aws-s3';

import * as path from 'path';

import { Construct } from 'constructs';
import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';
import { DockerImage } from 'aws-cdk-lib';
import { LambdaDestination } from 'aws-cdk-lib/aws-s3-notifications';

interface ContentServiceProps extends cdk.NestedStackProps {
    main_table: dynamodb.Table;
    user_content_bucket: s3.Bucket;
};

export class ContentService extends cdk.NestedStack {

    public readonly content_service_handler: NodejsFunction;
    public readonly storj_image_lambda: NodejsFunction;

    constructor(scope: Construct, id: string, props: ContentServiceProps) {
        super(scope, id, props);

        this.storj_image_lambda = new NodejsFunction(this, "storj_image_lambda", {
            entry: path.join(__dirname, '../../lambda-fns/src/functions/storj_upload/index.ts'),
            bundling: {
                nodeModules: ["uplink-nodejs", "node-gyp"],
                forceDockerBundling: true,
                commandHooks: {
                    beforeInstall(_inputDir, outputDir) {
                        return [
                            'export PATH=$PATH:$GOPATH/bin',
                            'sudo yum -y install make'
                        ]
                    },
                    beforeBundling(inputDir, outputDir) {
                        return [
                            ''
                        ]
                    },
                    afterBundling(inputDir, outputDir) {
                        return [`cp -r ./node_modules/uplink-nodejs /usr`]
                    }
                }
            }
        });

        this.content_service_handler = new NodejsFunction(this, "content_service_handler", {
            runtime: lambda.Runtime.NODEJS_16_X,
            handler: 'handler',
            entry: path.join(__dirname, "../../lambda-fns/src/functions/content/index.ts"),
            environment: {
                TABLE_NAME: props.main_table.tableName,
                USER_CONTENT: props.user_content_bucket.bucketName,
                STORJ_LAMBDA: this.storj_image_lambda.functionName
            }
        });

        props.main_table.grantFullAccess(this.content_service_handler);
        props.user_content_bucket.grantRead(this.content_service_handler);
        props.user_content_bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new LambdaDestination(this.storj_image_lambda));
    };
};

And here's the logs I get when I try to deploy the my Stack:

Bundling asset MainStack/content_service/storj_image_lambda/Code/Stage...

  asset-output/index.js  1.5kb

⚡ Done in 21ms
bash: sudo: command not found
/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/core/lib/asset-staging.js:2
`),localBundling=options.local?.tryBundle(bundleDir,options),!localBundling){let user;if(options.user)user=options.user;else{const userInfo=os.userInfo();user=userInfo.uid!==-1?`${userInfo.uid}:${userInfo.gid}`:"1000:1000"}options.image.run({command:options.command,user,volumes,environment:options.environment,entrypoint:options.entrypoint,workingDirectory:options.workingDirectory??AssetStaging.BUNDLING_INPUT_DIR,securityOpt:options.securityOpt??""})}}catch(err){const bundleErrorDir=bundleDir+"-error";throw fs.existsSync(bundleErrorDir)&&fs.removeSync(bundleErrorDir),fs.renameSync(bundleDir,bundleErrorDir),new Error(`Failed to bundle asset ${this.node.path}, bundle output is located at ${bundleErrorDir}: ${err}`)}if(fs_1.FileSystem.isEmpty(bundleDir)){const outputDir=localBundling?bundleDir:AssetStaging.BUNDLING_OUTPUT_DIR;throw new Error(`Bundling did not produce any output. Check that content is written to ${outputDir}.`)}}calculateHash(hashType,bundling,outputDir){if(hashType==assets_1.AssetHashType.CUSTOM||hashType==assets_1.AssetHashType.SOURCE&&bundling){const hash=crypto.createHash("sha256");return hash.update(this.customSourceFingerprint??fs_1.FileSystem.fingerprint(this.sourcePath,this.fingerprintOptions)),bundling&&hash.update(JSON.stringify(bundling)),hash.digest("hex")}switch(hashType){case assets_1.AssetHashType.SOURCE:return fs_1.FileSystem.fingerprint(this.sourcePath,this.fingerprintOptions);case assets_1.AssetHashType.BUNDLE:case assets_1.AssetHashType.OUTPUT:if(!outputDir)throw new Error(`Cannot use \`${hashType}\` hash type when \`bundling\` is not specified.`);return fs_1.FileSystem.fingerprint(outputDir,this.fingerprintOptions);default:throw new Error("Unknown asset hash type.")}}}exports.AssetStaging=AssetStaging,_a=JSII_RTTI_SYMBOL_1,AssetStaging[_a]={fqn:"aws-cdk-lib.AssetStaging",version:"2.53.0"},AssetStaging.BUNDLING_INPUT_DIR="/asset-input",AssetStaging.BUNDLING_OUTPUT_DIR="/asset-output",AssetStaging.assetCache=new cache_1.Cache;function renderAssetFilename(assetHash,extension=""){return`asset.${assetHash}${extension}`}function determineHashType(assetHashType,customSourceFingerprint){const hashType=customSourceFingerprint?assetHashType??assets_1.AssetHashType.CUSTOM:assetHashType??assets_1.AssetHashType.SOURCE;if(customSourceFingerprint&&hashType!==assets_1.AssetHashType.CUSTOM)throw new Error(`Cannot specify \`${assetHashType}\` for \`assetHashType\` when \`assetHash\` is specified. Use \`CUSTOM\` or leave \`undefined\`.`);if(hashType===assets_1.AssetHashType.CUSTOM&&!customSourceFingerprint)throw new Error("`assetHash` must be specified when `assetHashType` is set to `AssetHashType.CUSTOM`.");return hashType}function calculateCacheKey(props){return crypto.createHash("sha256").update(JSON.stringify(sortObject(props))).digest("hex")}function sortObject(object){if(typeof object!="object"||object instanceof Array)return object;const ret={};for(const key of Object.keys(object).sort())ret[key]=sortObject(object[key]);return ret}function singleArchiveFile(directory){if(!fs.existsSync(directory))throw new Error(`Directory ${directory} does not exist.`);if(!fs.statSync(directory).isDirectory())throw new Error(`${directory} is not a directory.`);const content=fs.readdirSync(directory);if(content.length===1){const file=path.join(directory,content[0]),extension=getExtension(content[0]).toLowerCase();if(fs.statSync(file).isFile()&&ARCHIVE_EXTENSIONS.includes(extension))return file}}function determineBundledAsset(bundleDir,outputType){const archiveFile=singleArchiveFile(bundleDir);switch(outputType===bundling_1.BundlingOutput.AUTO_DISCOVER&&(outputType=archiveFile?bundling_1.BundlingOutput.ARCHIVED:bundling_1.BundlingOutput.NOT_ARCHIVED),outputType){case bundling_1.BundlingOutput.NOT_ARCHIVED:return{path:bundleDir,packaging:assets_1.FileAssetPackaging.ZIP_DIRECTORY};case bundling_1.BundlingOutput.ARCHIVED:if(!archiveFile)throw new Error("Bundling output directory is expected to include only a single archive file when `output` is set to `ARCHIVED`");return{path:archiveFile,packaging:assets_1.FileAssetPackaging.FILE,extension:getExtension(archiveFile)}}}function getExtension(source){for(const ext of ARCHIVE_EXTENSIONS)if(source.toLowerCase().endsWith(ext))return ext;return path.extname(source)}
                                                                                ^
Error: Failed to bundle asset MainStack/content_service/storj_image_lambda/Code/Stage, bundle output is located at /Users/thomgeenen/Git/nude_safer_cdk/cdk.out/bundling-temp-4e95a752d2aca74dd84aa402102b31591eb7ee9ec0a94b306360353a61e924f0-error: Error: docker exited with status 127
    at AssetStaging.bundle (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/core/lib/asset-staging.js:2:614)
    at AssetStaging.stageByBundling (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:4506)
    at stageThisAsset (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:1867)
    at Cache.obtain (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/core/lib/private/cache.js:1:242)
    at new AssetStaging (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/core/lib/asset-staging.js:1:2262)
    at new Asset (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/aws-s3-assets/lib/asset.js:1:736)
    at AssetCode.bind (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/aws-lambda/lib/code.js:1:4628)
    at new Function (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/aws-lambda/lib/function.js:1:2803)
    at new NodejsFunction (/Users/thomgeenen/Git/nude_safer_cdk/node_modules/aws-cdk-lib/aws-lambda-nodejs/lib/function.js:1:1171)
    at new ContentService (/Users/thomgeenen/Git/nude_safer_cdk/lib/services/content/index.ts:24:35)
Detected file changes during deployment. Invoking 'cdk deploy' again
[+] Building 0.5s (13/13) FINISHED
 => [internal] load build definition from Dockerfile                                                                                0.0s
 => => transferring dockerfile: 37B                                                                                0.0s
 => [internal] load .dockerignore                                                                                0.0s
 => => transferring context: 2B                                                                                0.0s
 => [internal] load metadata for public.ecr.aws/sam/build-nodejs14.x:latest                                                                    0.4s
 => [1/9] FROM public.ecr.aws/sam/build-nodejs14.x@sha256:cfe32c14b97a6d5d7128f4e110c6d11b80bf89c0cca8a3493879f8c587627655                     0.0s
 => CACHED [2/9] RUN npm install --global yarn@1.22.5                                                                                0.0s
 => CACHED [3/9] RUN npm install --global pnpm                                                                                0.0s
 => CACHED [4/9] RUN npm install --global typescript                                                                                0.0s
 => CACHED [5/9] RUN npm install --global --unsafe-perm=true esbuild@0                                                                         0.0s
 => CACHED [6/9] RUN mkdir /tmp/npm-cache &&     chmod -R 777 /tmp/npm-cache &&     npm config --global set cache /tmp/npm-cache               0.0s
 => CACHED [7/9] RUN mkdir /tmp/yarn-cache &&     chmod -R 777 /tmp/yarn-cache &&     yarn config set cache-folder /tmp/yarn-cache             0.0s
 => CACHED [8/9] RUN npm config --global set update-notifier false                                                                             0.0s
 => CACHED [9/9] RUN /sbin/useradd -u 1000 user && chmod 711 /                                                                                0.0s
 => exporting to image                                                                                0.0s
 => => exporting layers                                                                                0.0s
 => => writing image sha256:c83389551577052395325ed8a0fb51c59639344b8c92baa1656956f23c765d18                                                   0.0s
 => => naming to docker.io/library/cdk-7ef608663d730a301f1ab98604e57fd96273751c63db25a1a75f1390f462c655                                        0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them


问:
Optimized way to join pyspark dataframes on closest distance
I'm trying to join the GHCN weather dataset and another dataset:

Weather Dataset: (called "weather" in the code)

station_id
date
PRCP
SNOW
SNWD
TMAX
TMIN
Latitude
Longitude
Elevation
State
date_final

CA001010235
19730707
null
null
0.0
0.0
null
48.4
-123.4833
17.0
BC
1973-07-07

CA001010235
19780337
14
8
0.0
0.0
null
48.4
-123.4833
17.0
BC
1978-03-30

CA001010595
19690607
null
null
0.0
0.0
null
48.5833
-123.5167
17.0
BC
1969-06-07

Species Dataset: (called "ebird" in the code where "ebird_id" is unique for each row in the dataset)

speciesCode
comName
sciName
locId
locName
ObsDt
howMany
lat
lng
obsValid
obsReview
locationPrivate
subId
ebird_id

nswowl
Northern Saw-whet Owl
Aegolius acadicus
L787133
Kumdis Slough
2017-03-20 23:15
1
53.7392187
-132.1612358
TRUE
FALSE
TRUE
S35611913
eff-178121-fff

wilsni1
Wilson's Snipe
Gallinago delicata
L1166559
Hornby Island--Ford Cove
2017-03-20 21:44
1
49.4973435
-124.6768427
TRUE
FALSE
FALSE
S35323282
abc-1920192-fff

cacgoo1
Cackling Goose
Branta hutchinsii
L833055
Central Saanich--»æIKEL (Maber Flats)
2017-03-20 19:24
5
48.5724686
-123.4305167
TRUE
FALSE
FALSE
S35322116
yhj-9102910-fff

Result Expected: I need to join these tables by finding the closest weather station for each row in the species dataset for the same date. So in this example, ebird_id "eff-178121-fff" is closest to the weather station "CA001010235" and the distance is around 20 kms.

speciesCode
comName
sciName
locId
locName
ObsDt
howMany
lat
lng
obsValid
obsReview
locationPrivate
subId
ebird_id

station_id
date
PRCP
SNOW
SNWD
TMAX
TMIN
Latitude
Longitude
Elevation
State
date_final
distance(kms)

nswowl
Northern Saw-whet Owl
Aegolius acadicus
L787133
Kumdis Slough
2017-03-20 23:15
1
53.7392187
-132.1612358
TRUE
FALSE
TRUE
S35611913
eff-178121-fff

CA001010235
20170320
null
null
0.0
0.0
null
48.4
-123.4833
17.0
BC
2017-03-20
20

wilsni1
Wilson's Snipe
Gallinago delicata
L1166559
Hornby Island--Ford Cove
2017-03-20 21:44
1
49.4973435
-124.6768427
TRUE
FALSE
FALSE
S35323282
abc-1920192-fff

CA001010595
20170320
null
null
0.0
0.0
null
48.5833
-123.5167
17.0
BC
2017-03-20

What I have tried so far: I referred to this link and it works for a sample of the datasets but when I tried to run the below code for the entire weather and entire species dataset, the cross join worked but the partitionBy and windows function line was taking too long. I also tried replacing the partionBy and windows function with pyspark SQL queries in case that would be faster but it's still taking time. Is there any optimized way to do this?

```<code>join_df = ebird.crossJoin(weather).withColumn("dist_longit", radians(weather["Longitude"]) - radians(ebird["lng"])).withColumn("dist_latit", radians(weather["Latitude"]) - radians(ebird["lat"]))

join_df = join_df.withColumn("haversine_distance_kms", asin(sqrt(
                                         sin(join_df["dist_latit"] / 2) ** 2 + cos(radians(join_df["lat"]))
                                         * cos(radians(join_df["Latitude"])) * sin(join_df["dist_longit"] / 2) ** 2
                                         )
                                    ) * 2 * 6371).drop("dist_longit","dist_latit")
W = W.partitionBy("ebird_id")
result = join_df.withColumn("min_dist", min(join_df['haversine_distance_kms']).over(W))\
.filter(col("min_dist") == col('haversine_distance_kms'))

print(result.show(1))
</code>```

Edit:

Size of the datasets:

```<code>print(weather.count()) #output: 8211812
print(ebird.count()) #output: 1564574
</code>```

Body:
I'm trying to join the GHCN weather dataset and another dataset:

Weather Dataset: (called "weather" in the code)

station_id
date
PRCP
SNOW
SNWD
TMAX
TMIN
Latitude
Longitude
Elevation
State
date_final

CA001010235
19730707
null
null
0.0
0.0
null
48.4
-123.4833
17.0
BC
1973-07-07

CA001010235
19780337
14
8
0.0
0.0
null
48.4
-123.4833
17.0
BC
1978-03-30

CA001010595
19690607
null
null
0.0
0.0
null
48.5833
-123.5167
17.0
BC
1969-06-07

Species Dataset: (called "ebird" in the code where "ebird_id" is unique for each row in the dataset)

speciesCode
comName
sciName
locId
locName
ObsDt
howMany
lat
lng
obsValid
obsReview
locationPrivate
subId
ebird_id

nswowl
Northern Saw-whet Owl
Aegolius acadicus
L787133
Kumdis Slough
2017-03-20 23:15
1
53.7392187
-132.1612358
TRUE
FALSE
TRUE
S35611913
eff-178121-fff

wilsni1
Wilson's Snipe
Gallinago delicata
L1166559
Hornby Island--Ford Cove
2017-03-20 21:44
1
49.4973435
-124.6768427
TRUE
FALSE
FALSE
S35323282
abc-1920192-fff

cacgoo1
Cackling Goose
Branta hutchinsii
L833055
Central Saanich--»æIKEL (Maber Flats)
2017-03-20 19:24
5
48.5724686
-123.4305167
TRUE
FALSE
FALSE
S35322116
yhj-9102910-fff

Result Expected: I need to join these tables by finding the closest weather station for each row in the species dataset for the same date. So in this example, ebird_id "eff-178121-fff" is closest to the weather station "CA001010235" and the distance is around 20 kms.

speciesCode
comName
sciName
locId
locName
ObsDt
howMany
lat
lng
obsValid
obsReview
locationPrivate
subId
ebird_id

station_id
date
PRCP
SNOW
SNWD
TMAX
TMIN
Latitude
Longitude
Elevation
State
date_final
distance(kms)

nswowl
Northern Saw-whet Owl
Aegolius acadicus
L787133
Kumdis Slough
2017-03-20 23:15
1
53.7392187
-132.1612358
TRUE
FALSE
TRUE
S35611913
eff-178121-fff

CA001010235
20170320
null
null
0.0
0.0
null
48.4
-123.4833
17.0
BC
2017-03-20
20

wilsni1
Wilson's Snipe
Gallinago delicata
L1166559
Hornby Island--Ford Cove
2017-03-20 21:44
1
49.4973435
-124.6768427
TRUE
FALSE
FALSE
S35323282
abc-1920192-fff

CA001010595
20170320
null
null
0.0
0.0
null
48.5833
-123.5167
17.0
BC
2017-03-20

What I have tried so far: I referred to this link and it works for a sample of the datasets but when I tried to run the below code for the entire weather and entire species dataset, the cross join worked but the partitionBy and windows function line was taking too long. I also tried replacing the partionBy and windows function with pyspark SQL queries in case that would be faster but it's still taking time. Is there any optimized way to do this?

join_df = ebird.crossJoin(weather).withColumn("dist_longit", radians(weather["Longitude"]) - radians(ebird["lng"])).withColumn("dist_latit", radians(weather["Latitude"]) - radians(ebird["lat"]))

join_df = join_df.withColumn("haversine_distance_kms", asin(sqrt(
                                         sin(join_df["dist_latit"] / 2) ** 2 + cos(radians(join_df["lat"]))
                                         * cos(radians(join_df["Latitude"])) * sin(join_df["dist_longit"] / 2) ** 2
                                         )
                                    ) * 2 * 6371).drop("dist_longit","dist_latit")
W = W.partitionBy("ebird_id")
result = join_df.withColumn("min_dist", min(join_df['haversine_distance_kms']).over(W))\
.filter(col("min_dist") == col('haversine_distance_kms'))

print(result.show(1))

Edit:

Size of the datasets:

print(weather.count()) #output: 8211812
print(ebird.count()) #output: 1564574


问:
How to read text from file edit it and print using in ASSEMBLY
I am trying to create a assembly 8086 program which scans input.txt file and searches for string "word". The result should be output.txt with the same text from input.txt but strings "word" should be replaced with "new_word".

Program compiles and starts but output.txt is not created.
I think the problem is with CMP instruction and values used with it. What would be correct way to perform comparison?

Any help would be really appreciated because there isn't much info on the internet about TURBO (TASM) Assembler.

```<code>.data
    file_name db "input.txt", 0
    output_name db "output.txt", 0
    new_word db "new_word", 13, 10, "$"
    file_hand dw 0
    output_file_hand dw 0
    counter db 0
    buffer db 1 dup(0), "$"
    buffer2 db 10 dup(0), "$"
</code>```

COMPARISON FUNCTION:

```<code>checking:
    mov al, ds:[buffer]
    cmp al, 77h ; comparing to letter 'w'
    je reading_word
    jmp printing_symbol
    jmp reading
</code>```

FUNCTION checks if 3 continuing bytes make "word"

```<code>reading_word: ;
    mov bx, file_hand
    mov ah, 3fh
    mov al, 0
    mov cx, 3
    mov dx, offset buffer2
    mov file_hand, bx ; updating file_hand
    mov al, ds:[buffer2 + 1]
    cmp al, 6fh ; comparing to letter 'o'
    inc counter
    mov al, ds:[buffer2 + 2]
    cmp al, 72h ; comparing to letter 'r'
    inc counter
    mov al, ds:[buffer2 + 3]
    cmp al, 64h ; comparing to letter 'd'
    inc counter
    ;if "word" found
    cmp counter, 3
    je printing_string
    jmp reading
</code>```

FULL APPLICATION CODE: https://pastecode.io/s/esostirn

I have tried different ways to CMP value in the buffer but could not make it work.

Body:
I am trying to create a assembly 8086 program which scans input.txt file and searches for string "word". The result should be output.txt with the same text from input.txt but strings "word" should be replaced with "new_word".

Program compiles and starts but output.txt is not created.
I think the problem is with CMP instruction and values used with it. What would be correct way to perform comparison?

Any help would be really appreciated because there isn't much info on the internet about TURBO (TASM) Assembler.

.data
    file_name db "input.txt", 0
    output_name db "output.txt", 0
    new_word db "new_word", 13, 10, "$"
    file_hand dw 0
    output_file_hand dw 0
    counter db 0
    buffer db 1 dup(0), "$"
    buffer2 db 10 dup(0), "$"

COMPARISON FUNCTION:

checking:
    mov al, ds:[buffer]
    cmp al, 77h ; comparing to letter 'w'
    je reading_word
    jmp printing_symbol
    jmp reading

FUNCTION checks if 3 continuing bytes make "word"

reading_word: ;
    mov bx, file_hand
    mov ah, 3fh
    mov al, 0
    mov cx, 3
    mov dx, offset buffer2
    mov file_hand, bx ; updating file_hand
    mov al, ds:[buffer2 + 1]
    cmp al, 6fh ; comparing to letter 'o'
    inc counter
    mov al, ds:[buffer2 + 2]
    cmp al, 72h ; comparing to letter 'r'
    inc counter
    mov al, ds:[buffer2 + 3]
    cmp al, 64h ; comparing to letter 'd'
    inc counter
    ;if "word" found
    cmp counter, 3
    je printing_string
    jmp reading

FULL APPLICATION CODE: https://pastecode.io/s/esostirn

I have tried different ways to CMP value in the buffer but could not make it work.


问:
Speech Recognition using oculus quest 2, any idea how to do it in Unreal Engine?
Does anyone have any ideas how to do speech recognition for vr with unreal engine?

Are there any plugins or tutorials?


问:
Inserting [{"image":"base 64 data", "desc.":"desc."},{"image":"base 64 data", "desc.":"desc."}] into postgres from JS generated data
I am trying to develop functionality using JS/jQuery and Postgres.

From the JS side, we've created functionality to create an Array of the card image and descriptions. The card consists of base64 data and a description.

And now the data is looking like this:

```<code>    [{"image": "base 64 data of image", "description": "Angular is a platform and framework for building single-page client applications using HTML and TypeScript. Angular is written in TypeScript. It implements core and optional functionality as a set of TypeScript libraries that you import into your applications."}
,{"image": "base 65 data",  "description": "Angular is a platform and framework for building single-page client applications using HTML and TypeScript. Angular is written in TypeScript. It implements core and optional functionality as a set of TypeScript libraries that you import into your applications."}....]
</code>```

And I want to store this type of data in my Postgres. Can I store this in a single array or JSON format? Any other solution is also helpful for me which is faster and more efficient for this type of data.

I tried :

```<code>INSERT INTO orb select * from json_populate_recordset(1213360, '[{"img":"base 64 data", "description":"RabbitMQ is a messaging broker - an intermediary for messaging. It gives your applications a common platform to send and receive messages, and your messages a safe place to live until received."}]')
</code>```

but it is showing me :

```<code>    ERROR:  syntax error at or near "s"
LINE 1: ...//Gpbe66w79i0AAAAASUVORK5CYII=", "description": "It's used for...
                                                             ^
SQL state: 42601
Character: 632179
</code>```

Body:
I am trying to develop functionality using JS/jQuery and Postgres.

From the JS side, we've created functionality to create an Array of the card image and descriptions. The card consists of base64 data and a description.

And now the data is looking like this:

    [{"image": "base 64 data of image", "description": "Angular is a platform and framework for building single-page client applications using HTML and TypeScript. Angular is written in TypeScript. It implements core and optional functionality as a set of TypeScript libraries that you import into your applications."}
,{"image": "base 65 data",  "description": "Angular is a platform and framework for building single-page client applications using HTML and TypeScript. Angular is written in TypeScript. It implements core and optional functionality as a set of TypeScript libraries that you import into your applications."}....]

And I want to store this type of data in my Postgres. Can I store this in a single array or JSON format? Any other solution is also helpful for me which is faster and more efficient for this type of data.

I tried :

INSERT INTO orb select * from json_populate_recordset(1213360, '[{"img":"base 64 data", "description":"RabbitMQ is a messaging broker - an intermediary for messaging. It gives your applications a common platform to send and receive messages, and your messages a safe place to live until received."}]')

but it is showing me :

    ERROR:  syntax error at or near "s"
LINE 1: ...//Gpbe66w79i0AAAAASUVORK5CYII=", "description": "It's used for...
                                                             ^
SQL state: 42601
Character: 632179


问:
'AsyncTeleBot' object has no attribute 'register_next_step_handler'
Trying to create simple ask, answer, remember telegram bot with pyTelegramBot.
Everything were normal, when TeleBot were used. TeleBot.register_next_message_handler helped me a lot.

Example:

```<code>...

@bot.message_handler(func=lambda msg: msg.text is not None and '/start' in msg.text)
def send_welcome(msg):
    global cur_user
    cur_user = msg.from_user.id
    keyboard = types.InlineKeyboardMarkup()
    keyboard.add(types.InlineKeyboardButton('Да', callback_data='old'),
                 types.InlineKeyboardButton('Нет', callback_data='new'))
    keyboard.add(types.InlineKeyboardButton('Пора остановиться', callback_data='stop_bot'))
    greet = 'Бла...бла...бла\nМы знакомы?'
    bot.send_message(msg.chat.id, greet, reply_markup=keyboard)

...

@bot.callback_query_handler(func=lambda call: True)
def query_processing(call):
    global user
    global cur_user
    if call.data == 'new':
        user = dict.fromkeys(user, None)
        nxt = bot.send_message(call.message.chat.id, 'Как звать?')
        bot.register_next_step_handler(nxt, get_name_ask_goal)

...
</code>```

Still I need my bot to be asynchronous because of sleep time till message to be send from bot and with simultaneous possibility for user to send messages.

Tried to use AsyncTeleBot, but there is no register_next_step_handler function. I did't find out how to make bot wait user for the name typing and it is almost impossible to me to add register_next_step_handler function into particular files. Although found issue in gitHub and no solution from 2017.

Tried

```<code>...
bot = AsyncTeleBot(os.getenv('token2'))
...

async def beep(chat_id) -> None:
    """Send the beep message."""
    await bot.send_message(chat_id, text='Beep!')
    aioschedule.clear(chat_id)

async def scheduler():
    global chat_id
    aioschedule.every(5).seconds.do(beep, chat_id).tag(chat_id)
    while True:
        await aioschedule.run_pending()
        await asyncio.sleep(1)

async def main():
    await asyncio.gather(scheduler(), bot.polling(non_stop=True))

if __name__ == "__main__":
    asyncio.run(main(), debug=True)
...
</code>```

Result:

TypeError: An asyncio.Future, a coroutine or an awaitable is required

I'm wondering:

is there other appropriate libraries for my task?

is there any simple solution to save user's message?

is it possible to use asyncio with TeleBot that made Thread-style?

Hoping for any help.

Body:
Trying to create simple ask, answer, remember telegram bot with pyTelegramBot.
Everything were normal, when TeleBot were used. TeleBot.register_next_message_handler helped me a lot.

Example:

...

@bot.message_handler(func=lambda msg: msg.text is not None and '/start' in msg.text)
def send_welcome(msg):
    global cur_user
    cur_user = msg.from_user.id
    keyboard = types.InlineKeyboardMarkup()
    keyboard.add(types.InlineKeyboardButton('Да', callback_data='old'),
                 types.InlineKeyboardButton('Нет', callback_data='new'))
    keyboard.add(types.InlineKeyboardButton('Пора остановиться', callback_data='stop_bot'))
    greet = 'Бла...бла...бла\nМы знакомы?'
    bot.send_message(msg.chat.id, greet, reply_markup=keyboard)

...

@bot.callback_query_handler(func=lambda call: True)
def query_processing(call):
    global user
    global cur_user
    if call.data == 'new':
        user = dict.fromkeys(user, None)
        nxt = bot.send_message(call.message.chat.id, 'Как звать?')
        bot.register_next_step_handler(nxt, get_name_ask_goal)

...

Still I need my bot to be asynchronous because of sleep time till message to be send from bot and with simultaneous possibility for user to send messages.

Tried to use AsyncTeleBot, but there is no register_next_step_handler function. I did't find out how to make bot wait user for the name typing and it is almost impossible to me to add register_next_step_handler function into particular files. Although found issue in gitHub and no solution from 2017.

Tried

...
bot = AsyncTeleBot(os.getenv('token2'))
...

async def beep(chat_id) -> None:
    """Send the beep message."""
    await bot.send_message(chat_id, text='Beep!')
    aioschedule.clear(chat_id)

async def scheduler():
    global chat_id
    aioschedule.every(5).seconds.do(beep, chat_id).tag(chat_id)
    while True:
        await aioschedule.run_pending()
        await asyncio.sleep(1)

async def main():
    await asyncio.gather(scheduler(), bot.polling(non_stop=True))

if __name__ == "__main__":
    asyncio.run(main(), debug=True)
...

Result:

TypeError: An asyncio.Future, a coroutine or an awaitable is required

I'm wondering:

is there other appropriate libraries for my task?

is there any simple solution to save user's message?

is it possible to use asyncio with TeleBot that made Thread-style?

Hoping for any help.


问:
How to declare the expected exports type for a model?
I'm using @monaco-editor/react to set up an editor and I want monaco's typescript to validate the export types:

```<code>monaco.editor.createModel(
  `
  type MyType {okok:string}
  declare module './component.tsx' { export default MyType;  }
  `,
  "typescript",
  monaco.Uri.parse("file:///component.d.tsx")
);

[...]

<Editor
    language="typescript"
    theme="dark"
    path="component.tsx"
  />
</code>```

However the declaration seems to not have any effect and monaco doesn't show an error

Body:
I'm using @monaco-editor/react to set up an editor and I want monaco's typescript to validate the export types:

monaco.editor.createModel(
  `
  type MyType {okok:string}
  declare module './component.tsx' { export default MyType;  }
  `,
  "typescript",
  monaco.Uri.parse("file:///component.d.tsx")
);

[...]

<Editor
    language="typescript"
    theme="dark"
    path="component.tsx"
  />

However the declaration seems to not have any effect and monaco doesn't show an error


问:
Java gateway process exited before sending its port number error even after correctly configuring
Working with pyspark and have tried just about everything. I followed a lot of the advice in this stack over flow post Pyspark: Exception: Java gateway process exited before sending the driver its port number to no avail. I am sure that I have spark installed right. I followed this youtube video for the installation: https://www.youtube.com/watch?v=cYL42BBL3Fo

I am using Spark 3.3.1 btw

Here is how I am defining the SparkSession

```<code>spark = SparkSession \
    .builder \
    .master('yarn') \
    .appName('ChainAnalysis_v0') \
    .config('spark.jars', 'gs://spark-lib/bigquery/spark-bigquery-latest.jar') \
    .config('spark.executor.cores', '3') \
    .config('spark.executor.memory', '5g') \
    .config("spark.sql.broadcastTimeout", "36000")\
    .getOrCreate()
</code>```

Here are how my enviroment variables are configured

```<code>os.environ["JAVA_HOME"] = "C:\Program Files\Java\jdk-11.0.16.1"
os.environ["SPARK_HOME"] = 'C:\\Spark'
os.environ["PYSPARK_SUBMIT_ARGS"] = "--master local[3] pyspark-shell"

</code>```

Even with all of this I am still running into the error

```<code>RuntimeError: Java gateway process exited before sending its port number
</code>```

Any Suggestions?

Body:
Working with pyspark and have tried just about everything. I followed a lot of the advice in this stack over flow post Pyspark: Exception: Java gateway process exited before sending the driver its port number to no avail. I am sure that I have spark installed right. I followed this youtube video for the installation: https://www.youtube.com/watch?v=cYL42BBL3Fo

I am using Spark 3.3.1 btw

Here is how I am defining the SparkSession

spark = SparkSession \
    .builder \
    .master('yarn') \
    .appName('ChainAnalysis_v0') \
    .config('spark.jars', 'gs://spark-lib/bigquery/spark-bigquery-latest.jar') \
    .config('spark.executor.cores', '3') \
    .config('spark.executor.memory', '5g') \
    .config("spark.sql.broadcastTimeout", "36000")\
    .getOrCreate()

Here are how my enviroment variables are configured

os.environ["JAVA_HOME"] = "C:\Program Files\Java\jdk-11.0.16.1"
os.environ["SPARK_HOME"] = 'C:\\Spark'
os.environ["PYSPARK_SUBMIT_ARGS"] = "--master local[3] pyspark-shell"

Even with all of this I am still running into the error

RuntimeError: Java gateway process exited before sending its port number

Any Suggestions?


问:
How to convert ReportServer.dbo.CatalogItemExtendedContent.Content to readable string?
Is it possible to obtain the report definition (or perhaps DataMashup file equivalent) of Power BI reports via the ReportServer database?

SSRS reports (ReportServer.dbo.Catalog.Content) convert nicely but the titular column less so.

I tried converting to xml but there's a parsing error and conversion to (n)varchar yields gobbledygook.


问:
How to display a popup to the user if the app were to crash?
I want to be able to display a DisplayAlert after an unhandled exception.

Wrote a method and subscribed it to UnhandledException event in MauiProgram.cs

```<code>public async static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
    Exception exception = (Exception)e.ExceptionObject;
    bool Terminating = e.IsTerminating;
    await Shell.Current.DisplayAlert("Error", "Something went wrong!", "OK");
    Console.WriteLine($"\nUnhandled Exception occurred: *{exception}*\nTERMINATING?:{Terminating}\n");
}

AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
</code>```

This is what I had in mind whilst trying to implement this idea, but the program doesn't display the DisplayAlert but the console message appears.

Body:
I want to be able to display a DisplayAlert after an unhandled exception.

Wrote a method and subscribed it to UnhandledException event in MauiProgram.cs

public async static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
{
    Exception exception = (Exception)e.ExceptionObject;
    bool Terminating = e.IsTerminating;
    await Shell.Current.DisplayAlert("Error", "Something went wrong!", "OK");
    Console.WriteLine($"\nUnhandled Exception occurred: *{exception}*\nTERMINATING?:{Terminating}\n");
}

AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

This is what I had in mind whilst trying to implement this idea, but the program doesn't display the DisplayAlert but the console message appears.


问:
Changing values in column in table using buttons
i would like create a table, where one column would be variables and i want to have "+" and "-" buttons next to it. So when i click button "+" it would show number input and after submit, it would add to the value.
It works for one value, but do not get the other right, without copying whole script.

```<code>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Table</title>
</head>
<style>
    body {
        background-color: lightslategray;
    }
    #PLA {
        float: left;
        width: 30%;
        padding: 10px;
    }
    th, td {
        border: 1px solid;
    }
    .header {
        text-align: center;
        font-size: 20px;
    }
    .celltext {
        font-size: 15px;
    }
    .number {
        text-align: center;
    }
    .vbutton {
        background-color: gray;
        border: 1px solid black;
        border-radius: 6px;
        color: white;
        text-align: center;
        text-decoration: none;
        font-size: 10px;
        padding: 0px;
        margin-right: 4px;
        width: 20px;
        height: 20px;
        float: right;
    }
    button:hover {
        background-color: lightgray;
        color: black;
    }
    .input {
        padding: 0px;
        width: 48px;
        height: 16px;
        font-size: 14px;
        -webkit-appearance: none;
    }
    input[type = number] {
        -moz-appearance: textfield;
    }
    input:focus {
        border: 0px;
        outline: 0px;
    }
</style>
<body>
    <table id="PLA">
        <div>
            PLA
            <span id="test"></span>
            <input type="number" class="input" id="nwpla" onchange="changewpla1()" onkeypress="return onlyNumberKey(event)">
        </div>
        <tr class="header">
            <td>Barva</td>
            <td>Výrobce</td>
            <td>Hmotnost (g)</td>
            <td>Cena (kg)</td>
        </tr>
        <tr class="celltext">
            <td>černá <div class="box black"></div></td>
            <td>Polymaker PolyLite</td>
            <td class="number" id="pla1">
                <span id="wpla1"></span>
                <button class="vbutton" onclick="addpla()"> + </button>
                <button class="vbutton" onclick="subpla()"> - </button>
            </td>
            <td class="number">
                800
            </td>
        </tr>
        <tr class="celltext">
            <td>černá <div class="box black"></div></td>
            <td>Polymaker PolyLite</td>
            <td class="number" id="pla2">
                <span id="wpla2"></span>
                <button class="vbutton" onclick="addpla()"> + </button>
                <button class="vbutton" onclick="subpla()"> - </button>
            </td>
            <td class="number">
                800
            </td>
        </tr>
    </table>
</body>
<script>
    // test
    test = document.getElementById("test");

    // Weight of pla1
    wpla1 = document.getElementById("wpla1");
    nwpla = document.getElementById("nwpla");
    nwpla.style.display = "none";
    var pla1weight = localStorage.pla1weight;
    localStorage.setItem("pla1weight", pla1weight);

    if (localStorage.pla1weight == "undefined" || localStorage.pla1weight == isNaN) {
        localStorage.pla1weight = 0
        pla1weight = 0;
        wpla1.innerHTML = localStorage.pla1weight;
        wpla1.value = localStorage.pla1weight;
    }
    else {
        wpla1.innerHTML = localStorage.pla1weight;
        wpla1.value = localStorage.pla1weight;
    }
    function changewpla1() {
        x = parseInt(wpla1.value, 10);
        y = parseInt(nwpla.value, 10);
        if (p == 1) {
            pla1weight = x - y;
        } else {
            pla1weight = x + y;
        }
        wpla1.innerHTML = pla1weight;
        wpla1.value = pla1weight;
        localStorage.setItem("pla1weight", pla1weight);
        nwpla.style.display = "none";
    }

    // Weight of pla2
    wpla2 = document.getElementById("wpla2");
    nwpla = document.getElementById("nwpla");
    nwpla.style.display = "none";
    var pla2weight = localStorage.pla2weight;
    localStorage.setItem("pla2weight", pla2weight);

    if (localStorage.pla2weight == "undefined" || localStorage.pla2weight == isNaN) {
        localStorage.pla2weight = 0
        pla2weight = 0;
        wpla2.innerHTML = localStorage.pla2weight;
        wpla2.value = localStorage.pla2weight;
    }
    else {
        wpla2.innerHTML = localStorage.pla2weight;
        wpla2.value = localStorage.pla2weight;
    }
    function changewpla2() {
        x = parseInt(wpla2.value, 10);
        y = parseInt(nwpla.value, 10);
        if (p == 1) {
            pla2weight = x - y;
        } else {
            pla2weight = x + y;
        }
        wpla2.innerHTML = pla2weight;
        wpla2.value = pla2weight;
        localStorage.setItem("pla2weight", pla2weight);
        nwpla.style.display = "none";
    }

    function addpla() {
        nwpla.value = 0;
        p = 0;
        nwpla.style.display = "";
    }
    function subpla() {
        nwpla.value = 0
        p = 1;
        nwpla.style.display = "";
    }
    function onlyNumberKey(evt) {
        var ASCIICode = (evt.which) ? evt.which : evt.keyCode
        if (ASCIICode > 31 && (ASCIICode < 48 || ASCIICode > 57))
            return false;
        return true;
    }

</script>
</html>

</code>```

Any idea?
I would like to have a database as last option. Every value would be saved in local storage.

Thanks.

Body:
i would like create a table, where one column would be variables and i want to have "+" and "-" buttons next to it. So when i click button "+" it would show number input and after submit, it would add to the value.
It works for one value, but do not get the other right, without copying whole script.

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Table</title>

            PLA

            <input type="number" class="input" id="nwpla" onchange="changewpla1()" onkeypress="return onlyNumberKey(event)">

            Barva
            Výrobce
            Hmotnost (g)
            Cena (kg)

            černá

            Polymaker PolyLite

                <button class="vbutton" onclick="addpla()"> + </button>
                <button class="vbutton" onclick="subpla()"> - </button>

                800

            černá

            Polymaker PolyLite

                <button class="vbutton" onclick="addpla()"> + </button>
                <button class="vbutton" onclick="subpla()"> - </button>

                800

Any idea?
I would like to have a database as last option. Every value would be saved in local storage.

Thanks.


问:
How to debug React Native app with WebStorm?
I am new to React Native. I am stuck with debugging. What is the standard way of debugging apps? I mean how should I configure WebStorm debugger for it to connect to the running app and stop on breakpoints I put in IDE?

And is there a way to use WebStorm debugger alongside Flipper (use it instead of Chrome)?

I currently use RN 0.70.6


问:
Pages like xyz.html are being directed to xyz.html/abc.html in Apache
I'm having a redirect issue in my website and I'm not fluent in .htaccess and Apache programming so I don't know how to fix it. I'd appreciate any help you can give me! I'd really like a permanent solution and not a redirect as I'm trying to preserve link juice as well.

I've found these issues listed in GSC as not found (404). There are a huge number of redirects to pages like the below examples that don't exist. Here are a few:

```<code>www.example.com/equipment-guides.html/helpdesk.html
www.example.com/shelf.html/racking.html
www.example.com/shelves.html/racks.html
</code>```

Each .html page DOES exist on its own (such as https://www.example.com/equipment guides.html and https://www.example.com/helpdesk.html)

Here is part of my .htaccess file:

```<code>RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]

RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R]

#AddType text/x-server-parsed-html .html for php
AddType application/x-httpd-php .htm .html
AddDefaultCharset utf-8

# redirect html pages to the root domain
# RewriteRule ^index\.html$ / [NC,R,L]
RewriteRule ^index.html$ / [R=301,L]
RewriteRule ^(.*)/index.html$ /$1/ [R=301,L]

# RedirectMatch permanent "^(.*\.html)/.*" "$1"
# RedirectMatch permanent "^(.*\.php)/.*" "$1"
# RewriteRule ^(.*\.html)/.* [R=404,L]
# RewriteRule ^(.*\.php)/.* [R=404,L]
</code>```

Any idea where this went wrong? Thanks for the help!

Some of the commented out lines were my experiements while trying to figure it out. Recently I thought commenting out the below two lines would work but I'm not sure they have, although I haven't gotten the error since 11-25-22 (10 days):

```<code># RewriteRule ^(.*\.html)/.* [R=404,L]
# RewriteRule ^(.*\.php)/.* [R=404,L]
</code>```

Body:
I'm having a redirect issue in my website and I'm not fluent in .htaccess and Apache programming so I don't know how to fix it. I'd appreciate any help you can give me! I'd really like a permanent solution and not a redirect as I'm trying to preserve link juice as well.

I've found these issues listed in GSC as not found (404). There are a huge number of redirects to pages like the below examples that don't exist. Here are a few:

www.example.com/equipment-guides.html/helpdesk.html
www.example.com/shelf.html/racking.html
www.example.com/shelves.html/racks.html

Each .html page DOES exist on its own (such as https://www.example.com/equipment guides.html and https://www.example.com/helpdesk.html)

Here is part of my .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]

RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R]

#AddType text/x-server-parsed-html .html for php
AddType application/x-httpd-php .htm .html
AddDefaultCharset utf-8

# redirect html pages to the root domain
# RewriteRule ^index\.html$ / [NC,R,L]
RewriteRule ^index.html$ / [R=301,L]
RewriteRule ^(.*)/index.html$ /$1/ [R=301,L]

# RedirectMatch permanent "^(.*\.html)/.*" "$1"
# RedirectMatch permanent "^(.*\.php)/.*" "$1"
# RewriteRule ^(.*\.html)/.* [R=404,L]
# RewriteRule ^(.*\.php)/.* [R=404,L]

Any idea where this went wrong? Thanks for the help!

Some of the commented out lines were my experiements while trying to figure it out. Recently I thought commenting out the below two lines would work but I'm not sure they have, although I haven't gotten the error since 11-25-22 (10 days):

# RewriteRule ^(.*\.html)/.* [R=404,L]
# RewriteRule ^(.*\.php)/.* [R=404,L]


问:
Pandas module not working on output window in VSCode
I've been trying to work with pandas for a machine learning course from Google. After installing, importing and using pandas in a file, when I try to run the program in the output window, it shows the error

```<code>ModuleNotFoundError: No module named 'pandas'
</code>```

However, when I run it from the terminal using

```<code>python3 file.py
</code>```

it works.

I installed pandas using

```<code>pip3 install pandas
</code>```

I did the same for the numpy module, and checked that they were in the same location. The difference is that numpy works in the output window, whereas pandas doesn't.
Is this a problem of VSCode? Or have I done something wrong? How can I make my programs that use the pandas module work in the output window? Perhaps pandas doesn't support Python 3.11 yet.

Body:
I've been trying to work with pandas for a machine learning course from Google. After installing, importing and using pandas in a file, when I try to run the program in the output window, it shows the error

ModuleNotFoundError: No module named 'pandas'

However, when I run it from the terminal using

python3 file.py

it works.

I installed pandas using

pip3 install pandas

I did the same for the numpy module, and checked that they were in the same location. The difference is that numpy works in the output window, whereas pandas doesn't.
Is this a problem of VSCode? Or have I done something wrong? How can I make my programs that use the pandas module work in the output window? Perhaps pandas doesn't support Python 3.11 yet.


问:
huggingface transformers installation problem - ar? -cq? cargo rustc?
Any suggestions appreciated:

MacOs Ventura 13.0.1

pip install transformers

...
...

```<code>    running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-arch" "x86_64" "-I" "bzip2-1.0.8" "-D_FILE_OFFSET_BITS=64" "-DBZ_NO_STDIO" "-o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/bzlib.o" "-c" "bzip2-1.0.8/bzlib.c"
    exit status: 0
    cargo:rerun-if-env-changed=AR_x86_64-apple-darwin
    AR_x86_64-apple-darwin = None
    cargo:rerun-if-env-changed=AR_x86_64_apple_darwin
    AR_x86_64_apple_darwin = None
    cargo:rerun-if-env-changed=HOST_AR
    HOST_AR = None
    cargo:rerun-if-env-changed=AR
    AR = None
    running: "ar" "cq" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/libbz2.a" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/blocksort.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/huffman.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/crctable.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/randtable.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/compress.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/decompress.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/bzlib.o"
    cargo:warning=/opt/local/bin/ranlib: object: /private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/libbz2.a(blocksort.o) malformed object (unknown load command 1)
    cargo:warning=ar: internal ranlib command failed
    exit status: 1

    --- stderr

    error occurred: Command "ar" "cq" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/libbz2.a" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/blocksort.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/huffman.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/crctable.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/randtable.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/compress.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/decompress.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/bzlib.o" with args "ar" did not execute successfully (status code exit status: 1).

  warning: build failed, waiting for other jobs to finish...
  error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path Cargo.toml --release -v --features pyo3/extension-module -- --crate-type cdylib -C 'link-args=-undefined dynamic_lookup -Wl,-install_name,@rpath/tokenizers.cpython-311-darwin.so'` failed with code 101
  [end of output]
</code>```

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for tokenizers
Failed to build tokenizers
ERROR: Could not build wheels for tokenizers, which is required to install pyproject.toml-based projects

Body:
Any suggestions appreciated:

MacOs Ventura 13.0.1

pip install transformers

...
...

    running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-arch" "x86_64" "-I" "bzip2-1.0.8" "-D_FILE_OFFSET_BITS=64" "-DBZ_NO_STDIO" "-o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/bzlib.o" "-c" "bzip2-1.0.8/bzlib.c"
    exit status: 0
    cargo:rerun-if-env-changed=AR_x86_64-apple-darwin
    AR_x86_64-apple-darwin = None
    cargo:rerun-if-env-changed=AR_x86_64_apple_darwin
    AR_x86_64_apple_darwin = None
    cargo:rerun-if-env-changed=HOST_AR
    HOST_AR = None
    cargo:rerun-if-env-changed=AR
    AR = None
    running: "ar" "cq" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/libbz2.a" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/blocksort.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/huffman.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/crctable.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/randtable.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/compress.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/decompress.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/bzlib.o"
    cargo:warning=/opt/local/bin/ranlib: object: /private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/libbz2.a(blocksort.o) malformed object (unknown load command 1)
    cargo:warning=ar: internal ranlib command failed
    exit status: 1

    --- stderr

    error occurred: Command "ar" "cq" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/libbz2.a" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/blocksort.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/huffman.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/crctable.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/randtable.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/compress.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/decompress.o" "/private/var/folders/29/bm1qb0td3291c9sdkntk3h900000gn/T/pip-install-u6rnb0rg/tokenizers_98bf14ea2e634d688487bd2fddeb7ec8/target/release/build/bzip2-sys-42fdd9d2b607ea81/out/lib/bzip2-1.0.8/bzlib.o" with args "ar" did not execute successfully (status code exit status: 1).

  warning: build failed, waiting for other jobs to finish...
  error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path Cargo.toml --release -v --features pyo3/extension-module -- --crate-type cdylib -C 'link-args=-undefined dynamic_lookup -Wl,-install_name,@rpath/tokenizers.cpython-311-darwin.so'` failed with code 101
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for tokenizers
Failed to build tokenizers
ERROR: Could not build wheels for tokenizers, which is required to install pyproject.toml-based projects