问:
Algolia, remove unnecessary divs in Template
Does anyone know, how to remove these unnecessary DIV Elements (automatically generated by algolia Widgets)?

```<code>#div class="ais-RefinementList"
     #div class="ais-RefinementList-list"
         #div class="ais-RefinementList-item"
              #div
</code>```

I don't need all of them!

(I Know: I already created my custom Widget doing this well, without putting any unnecessary  DIVS, but there are other problems with it. So i have to use this regular variant now)

```<code>$menus['one']=instantsearch.widgets.refinementList({
              cssClasses: {
                count: 'd-none',
              },
              templates: {
              item(item, { html }) {
                const { url, label, count, isRefined } = item;

                return html`
                  <a href="${url}" style="${isRefined ? 'font-weight: bold' : ''}">
                    <span>${label} (${count})</span>
                  </a>
                `;
              },
            }})
</code>```

Body:
Does anyone know, how to remove these unnecessary DIV Elements (automatically generated by algolia Widgets)?

#div class="ais-RefinementList"
     #div class="ais-RefinementList-list"
         #div class="ais-RefinementList-item"
              #div

I don't need all of them!

(I Know: I already created my custom Widget doing this well, without putting any unnecessary  DIVS, but there are other problems with it. So i have to use this regular variant now)

$menus['one']=instantsearch.widgets.refinementList({
              cssClasses: {
                count: 'd-none',
              },
              templates: {
              item(item, { html }) {
                const { url, label, count, isRefined } = item;

                return html`

                    ${label} (${count})

                `;
              },
            }})


来源: stackexchange

问:
AWK printing single array indices with other text
Trying to print array element and other stuff but awk doesnt print array element if something going after that

```<code>
awk -F, 'FNR==NR{tag[$1]=$2; next} ($1 in tag) {print tag[$1], $0}' OFS=, tags.csv entries.csv

,638000,1670886539191,3,50,30

</code>```

If i ask to print element in the end it prints well

```<code>
awk -F, 'FNR==NR{tag[$1]=$2; next} ($1 in tag) {print $0,tag[$1]}' OFS=, tags.csv entries.csv

result:

830000,1670255312883,3,49,31,5

</code>```

Also tried printf but no differ. Using GNU awk
P.S. I need to put it in one line, not two separate

ContentLicense: CC BY-SA 4.0

Body:
Trying to print array element and other stuff but awk doesnt print array element if something going after that

awk -F, 'FNR==NR{tag[$1]=$2; next} ($1 in tag) {print tag[$1], $0}' OFS=, tags.csv entries.csv

,638000,1670886539191,3,50,30

If i ask to print element in the end it prints well

awk -F, 'FNR==NR{tag[$1]=$2; next} ($1 in tag) {print $0,tag[$1]}' OFS=, tags.csv entries.csv

result:

830000,1670255312883,3,49,31,5

Also tried printf but no differ. Using GNU awk
P.S. I need to put it in one line, not two separate


问:
SFC React textarea not updating on screen when state is changed, despite dev tools html displaying the correct value
I have an application that allows users to input text fields and equations.
I do this by having a Box with an initial textarea that the user can use to type.
When an equation is inserted, below the textarea the equation is displayed in a new div.
A new textarea is created under the equation so the user can continue to type.
When a user deletes an equation I want the two textareas to be combined.
Basic code recreation:

```<code>const Tab = () => {
    const [inputs, setInputs] = React.useState([["text", null]]);

    const handleUpdateInput = (e, i) => { // updates the textarea's input in the state
        e.preventDefault()
        let temp = [...inputs];
        temp[i][1] = e.target.value;
        setInputs(temp);
        console.log(temp)
    }

    const handleAddEquation = (e) => {
        let newVal = e.target.parentNode.parentNode.childNodes[0].value; // gets value of field, gets the latex expression
        let temp = [...inputs];
        temp.push(["eq", newVal]); // adds input as type equation to state
        temp.push(["text", ""]); // this creates a new textarea below the equation so the user can continue typing
        setInputs(temp);
        handleCloseAddEquation(); // closes the equation input

        e.target.parentNode.parentNode.childNodes[0].value = null; // clears field
    }

    const handleDeleteEquation = (i) => { // called when user deletes equation
        let temp = [...inputs];
        temp.splice(i, 1); // removes equation from state

        temp[i-1][1] = temp[i-1][1] + "\n" + temp[i][1]; // combines two inputs
        temp.splice(i, 1); // removes last input since it has been combined with previous

        setInputs(temp);
    }

    const renderInputs = () => {
        let out = []
        console.log("rendered")
        if (inputs.length > 0) {
            for (let i = 1; i < inputs.length; i++) {
                if (inputs[i][0] == "text") {
                    console.log(inputs[i][1])
                    out.push(
                        <textarea
                        defaultValue={inputs[i][1]}
                        key={i} onKeyUp={(e) => handleUpdateInput(e, i)}
                        onInput={(e) => handleResizeTextarea(e, i)}
                        </textarea>
                    )
                }
                else if(inputs[i][0] == "eq") {
                    //... adds equation, has button that calls handleDeleteEquation
                }
            }
        }
        return out;
    }

return (
    <>
    <Box>
        <textarea
        defaultValue={inputs[0][1]}
        onKeyUp={(e) => handleUpdateInput(e, 0)}
        onInput={(e) => handleResizeTextarea(e, 0)}}}>
        </textarea>

        {renderInputs()}

    </Box>
    </>
)

}

export default Tab;

</code>```

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

I had all the solutions I tried here but stackoverflow marked my question as spam so I removed them :/

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

This is what happens

Before equation is deleted
browser ,
chrome dev tools

After equation is deleted
browser ,
chrome dev tools

As you can see the html in chrome dev tools does not match the browser. I have eliminated the possibility of the text being hidden as even appending the text without a "\n" does not update the display, and changing the text completely does not work either.

Body:
I have an application that allows users to input text fields and equations.
I do this by having a Box with an initial textarea that the user can use to type.
When an equation is inserted, below the textarea the equation is displayed in a new div.
A new textarea is created under the equation so the user can continue to type.
When a user deletes an equation I want the two textareas to be combined.
Basic code recreation:

const Tab = () => {
    const [inputs, setInputs] = React.useState([["text", null]]);

    const handleUpdateInput = (e, i) => { // updates the textarea's input in the state
        e.preventDefault()
        let temp = [...inputs];
        temp[i][1] = e.target.value;
        setInputs(temp);
        console.log(temp)
    }

    const handleAddEquation = (e) => {
        let newVal = e.target.parentNode.parentNode.childNodes[0].value; // gets value of field, gets the latex expression
        let temp = [...inputs];
        temp.push(["eq", newVal]); // adds input as type equation to state
        temp.push(["text", ""]); // this creates a new textarea below the equation so the user can continue typing
        setInputs(temp);
        handleCloseAddEquation(); // closes the equation input

        e.target.parentNode.parentNode.childNodes[0].value = null; // clears field
    }

    const handleDeleteEquation = (i) => { // called when user deletes equation
        let temp = [...inputs];
        temp.splice(i, 1); // removes equation from state

        temp[i-1][1] = temp[i-1][1] + "\n" + temp[i][1]; // combines two inputs
        temp.splice(i, 1); // removes last input since it has been combined with previous

        setInputs(temp);
    }

    const renderInputs = () => {
        let out = []
        console.log("rendered")
        if (inputs.length > 0) {
            for (let i = 1; i < inputs.length; i++) {
                if (inputs[i][0] == "text") {
                    console.log(inputs[i][1])
                    out.push(
                        <textarea
                        defaultValue={inputs[i][1]}
                        key={i} onKeyUp={(e) => handleUpdateInput(e, i)}
                        onInput={(e) => handleResizeTextarea(e, i)}
                        </textarea>
                    )
                }
                else if(inputs[i][0] == "eq") {
                    //... adds equation, has button that calls handleDeleteEquation
                }
            }
        }
        return out;
    }

return (
    <>
    <Box>
        <textarea
        defaultValue={inputs[0][1]}
        onKeyUp={(e) => handleUpdateInput(e, 0)}
        onInput={(e) => handleResizeTextarea(e, 0)}}}>
        </textarea>

        {renderInputs()}

    </Box>
    </>
)

}

export default Tab;

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

I had all the solutions I tried here but stackoverflow marked my question as spam so I removed them :/

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

This is what happens

Before equation is deleted
browser ,
chrome dev tools

After equation is deleted
browser ,
chrome dev tools

As you can see the html in chrome dev tools does not match the browser. I have eliminated the possibility of the text being hidden as even appending the text without a "\n" does not update the display, and changing the text completely does not work either.


问:
Do I need to forwardRef for each higher-order component in a chain?
I have an higher-order-component pattern that looks like this

```<code>
/**
 * This is a simple HoC that is a noop that supports ref forwarding.  The ref fowarding logic is added
 * as [refs are not passed through](https://reactjs.org/docs/higher-order-components.html#refs-arent-passed-through)
 * HoCs by default.
 * @param Component component to wrap
 * @param options options for the HoC building
 * @typeParam P the exposed props of the higher order component (does not require Q props)
 * @typeParam Q the props for the wrapped component
 * @typeParam T type for ref attribute of the wrapped component
 * @typeParam O options for the HoC building
 * @returns A named exotic componentwith P props that accepts a ref
 */
function hoc<
    P extends Q,
    Q extends {},
    T,
    O = {}
>(Component: ComponentType<Q>, options?: O): NamedExoticComponent<PropsWithoutRef<P> & RefAttributes<T>> {
    function useWrapped(props: P, ref: Ref<T>): ReactElement<Q> {
        // the an unknown as Q here is an example, but P and Q can be different.
        const componentProps: Q = props as Q;
        return <Component {...componentProps} ref={ref} />
    }
    const displayName =
        Component.displayName || Component.name || "AnonymousComponent";
    useWrapped.displayName = displayName;
    return forwardRef(useWrapped);
}
</code>```

I use the technique with o issues as follows:

```<code>export const Text = withStyledText(
  withI18n(
    withTextRole(
      withReplacedWithNativeFonts<TextProps, TextProps, RNText>(RNText)
    ),
    {
      _tIsChild: true,
    }
  )
);
export const TextInput = withStyledText(
  withI18n(
    withTextRole(
      withReplacedWithNativeFonts<TextInputProps, TextInputProps, RNTextInput>(
        RNTextInput
      )
    ),
    {
      localizedMap: {
        _a: "accessibilityLabel",
        _p: "placeholder",
        _rkl: "returnKeyLabel",
      },
    }
  )
);
</code>```

So the usage isn't really consistent.

On the debugger I see forwardRef on every higher-order component wrapping.  I really need to implement forwardRef on every level or should I just remove the forwardRef and just wrap it all up on top in the end?

Something like

```<code>function hoc<
    P extends Q,
    Q extends {},
    T,
    O = {}
>(Component: ComponentType<Q>, options?: O): NamedExoticComponent<PropsWithoutRef<P> & RefAttributes<T>> {
    function useWrapped(props: P): ReactElement<Q> {
        // the an unknown as Q here is an example, but P and Q can be different.
        const componentProps: Q = props as Q;
        return <Component {...componentProps} ref={ref} />
    }
    const displayName =
        Component.displayName || Component.name || "AnonymousComponent";
    useWrapped.displayName = displayName;
    return useWrapped; // <-- basically removed the forward ref
}

// then just do the forwardRef on the final component as

export const Text = forwardRef(withStyledText(
  withI18n(
    withTextRole(
      withReplacedWithNativeFonts<TextProps, TextProps, RNText>(RNText)
    ),
    {
      _tIsChild: true,
    }
  )
));

</code>```

The above has improper typings I am trying to get the typings right as I ask this question.

Body:
I have an higher-order-component pattern that looks like this

/**
 * This is a simple HoC that is a noop that supports ref forwarding.  The ref fowarding logic is added
 * as [refs are not passed through](https://reactjs.org/docs/higher-order-components.html#refs-arent-passed-through)
 * HoCs by default.
 * @param Component component to wrap
 * @param options options for the HoC building
 * @typeParam P the exposed props of the higher order component (does not require Q props)
 * @typeParam Q the props for the wrapped component
 * @typeParam T type for ref attribute of the wrapped component
 * @typeParam O options for the HoC building
 * @returns A named exotic componentwith P props that accepts a ref
 */
function hoc
(Component: ComponentType<Q>, options?: O): NamedExoticComponent<PropsWithoutRef
 & RefAttributes<T>> {
    function useWrapped(props: P, ref: Ref<T>): ReactElement<Q> {
        // the an unknown as Q here is an example, but P and Q can be different.
        const componentProps: Q = props as Q;
        return <Component {...componentProps} ref={ref} />
    }
    const displayName =
        Component.displayName || Component.name || "AnonymousComponent";
    useWrapped.displayName = displayName;
    return forwardRef(useWrapped);
}

I use the technique with o issues as follows:

export const Text = withStyledText(
  withI18n(
    withTextRole(
      withReplacedWithNativeFonts<TextProps, TextProps, RNText>(RNText)
    ),
    {
      _tIsChild: true,
    }
  )
);
export const TextInput = withStyledText(
  withI18n(
    withTextRole(
      withReplacedWithNativeFonts<TextInputProps, TextInputProps, RNTextInput>(
        RNTextInput
      )
    ),
    {
      localizedMap: {
        _a: "accessibilityLabel",
        _p: "placeholder",
        _rkl: "returnKeyLabel",
      },
    }
  )
);

So the usage isn't really consistent.

On the debugger I see forwardRef on every higher-order component wrapping.  I really need to implement forwardRef on every level or should I just remove the forwardRef and just wrap it all up on top in the end?

Something like

function hoc
(Component: ComponentType<Q>, options?: O): NamedExoticComponent<PropsWithoutRef
 & RefAttributes<T>> {
    function useWrapped(props: P): ReactElement<Q> {
        // the an unknown as Q here is an example, but P and Q can be different.
        const componentProps: Q = props as Q;
        return <Component {...componentProps} ref={ref} />
    }
    const displayName =
        Component.displayName || Component.name || "AnonymousComponent";
    useWrapped.displayName = displayName;
    return useWrapped; // <-- basically removed the forward ref
}

// then just do the forwardRef on the final component as

export const Text = forwardRef(withStyledText(
  withI18n(
    withTextRole(
      withReplacedWithNativeFonts<TextProps, TextProps, RNText>(RNText)
    ),
    {
      _tIsChild: true,
    }
  )
));

The above has improper typings I am trying to get the typings right as I ask this question.


问:
Why does SpnegoProvider throw StringOutOfIndexException, if status code of the response is 401?
I have developed REST API with JAX-RS. The web.xml is configured with SpnegoHttpFilter for  the authentication purpose. The REST API works perfectly with any status code except 401. If  my API returns javax.ws.rs.core.Response with status code 401, the SpnegoHttpFilter throws StringIndexOutOfBoundsException.

Here is the stacktrace snippet of Spnego error:

```<code>Exception handling request to /myapi/articles: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1931)
at net.sourceforge.spnego.SpnegoProvider.getAuthScheme(SpnegoProvider.java:220)
at net.sourceforge.spnego.SpnegoProvider.negotiate(SpnegoProvider.java:111)
at net.sourceforge.spnego.SpnegoAuthenticator.authenticate(SpnegoAuthenticator.java:315)
at net.sourceforge.spnego.SpnegoHttpFilter.doFilter(SpnegoHttpFilter.java:283)
....
</code>```

I have looked the code of SpnegoProvider class in spnego-r9.jar at the line 220, public static SpnegoAuthScheme getAuthScheme(final String header) method.

After doing some trials and errors, I have found that if I put "WWW-Authenticate" header and return response with 401 status code, SpnegoProvider does not throw StringIndexOutOfBoundsException anymore. Everything works just fine.

For example:

```<code>Response response = Response.status(Status.UNAUTHORIZED)
                            .header("WWW-Authenticate", "")
                            .type(MediaType.APPLICATION_JSON)
                            .build();
</code>```

My questions,

Is it bug in the SpnegoProvider?

Is there any best way to mitigate this issue?

Body:
I have developed REST API with JAX-RS. The web.xml is configured with SpnegoHttpFilter for  the authentication purpose. The REST API works perfectly with any status code except 401. If  my API returns javax.ws.rs.core.Response with status code 401, the SpnegoHttpFilter throws StringIndexOutOfBoundsException.

Here is the stacktrace snippet of Spnego error:

Exception handling request to /myapi/articles: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1931)
at net.sourceforge.spnego.SpnegoProvider.getAuthScheme(SpnegoProvider.java:220)
at net.sourceforge.spnego.SpnegoProvider.negotiate(SpnegoProvider.java:111)
at net.sourceforge.spnego.SpnegoAuthenticator.authenticate(SpnegoAuthenticator.java:315)
at net.sourceforge.spnego.SpnegoHttpFilter.doFilter(SpnegoHttpFilter.java:283)
....

I have looked the code of SpnegoProvider class in spnego-r9.jar at the line 220, public static SpnegoAuthScheme getAuthScheme(final String header) method.

After doing some trials and errors, I have found that if I put "WWW-Authenticate" header and return response with 401 status code, SpnegoProvider does not throw StringIndexOutOfBoundsException anymore. Everything works just fine.

For example:

Response response = Response.status(Status.UNAUTHORIZED)
                            .header("WWW-Authenticate", "")
                            .type(MediaType.APPLICATION_JSON)
                            .build();

My questions,

Is it bug in the SpnegoProvider?

Is there any best way to mitigate this issue?


问:
How to restrict the scrolling of RecyclerView while the BottomSheet is expanding?
I am using Recyclerview with CoordinatorLayout but when I
expand the BottomSheet upward more often the Recyclerview starts scrolling at half-expanded BottomSheet.

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="16dp"
    android:fitsSystemWindows="true"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/wrapper"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:layout_marginHorizontal="@dimen/margin_extra_large"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/icClose"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_marginTop="@dimen/margin_extra_large"
            android:contentDescription="@null"
            android:src="@drawable/ic_close_white_24dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/margin_extra_large"
            android:text="Test"
            android:textAlignment="center"
            android:textColor="@color/textColorPrimary"
            android:textSize="14sp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/icClose" />

    </androidx.constraintlayout.widget.ConstraintLayout>

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/sectionsRecyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="100dp"
        android:layout_marginHorizontal="@dimen/margin_extra_large"
        app:layout_anchor="@id/wrapper"
        app:layout_anchorGravity="bottom"
        android:layout_gravity="bottom"
        />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
```

But we want when the BottomSheet is expanding, the Recyclerview should scroll only on Top when the BotttomSheet is fully Expanded. How can I implement this? Any Help is Appreciated!! Thanks.

Body:
I am using Recyclerview with CoordinatorLayout but when I
expand the BottomSheet upward more often the Recyclerview starts scrolling at half-expanded BottomSheet.

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="16dp"
    android:fitsSystemWindows="true"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/wrapper"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:layout_marginHorizontal="@dimen/margin_extra_large"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/icClose"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_marginTop="@dimen/margin_extra_large"
            android:contentDescription="@null"
            android:src="@drawable/ic_close_white_24dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/margin_extra_large"
            android:text="Test"
            android:textAlignment="center"
            android:textColor="@color/textColorPrimary"
            android:textSize="14sp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/icClose" />

    </androidx.constraintlayout.widget.ConstraintLayout>

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/sectionsRecyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="100dp"
        android:layout_marginHorizontal="@dimen/margin_extra_large"
        app:layout_anchor="@id/wrapper"
        app:layout_anchorGravity="bottom"
        android:layout_gravity="bottom"
        />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

But we want when the BottomSheet is expanding, the Recyclerview should scroll only on Top when the BotttomSheet is fully Expanded. How can I implement this? Any Help is Appreciated!! Thanks.


问:
Error while importing table from mysql to hdfs using sqoop
i am running this import command to import E_INFO table from MySQL databases to HDFS using sqoop. the job is failing with below given error.

sqoop import --connect jdbc:mysql://localhost/HADOOP_BANK_DATA_POC --username root --password xxxxxxx --table E_INFO

however a blank file is getting created without any records in hdfs as E_INFO.
your help here is highly appreciated.

```<code>h-user@h-primary:~/sqoop-1.4.7/bin$ sqoop import --connect jdbc:mysql://localhost/HADOOP_BANK_DATA_POC --username root --password xxxxxxx --table E_INFO
Warning: /home/h-user/sqoop-1.4.7/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /home/h-user/sqoop-1.4.7/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /home/h-user/sqoop-1.4.7/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /home/h-user/sqoop-1.4.7/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
/usr/local/hadoop/libexec/hadoop-functions.sh: line 2366: HADOOP_ORG.APACHE.SQOOP.SQOOP_USER: invalid variable name
/usr/local/hadoop/libexec/hadoop-functions.sh: line 2461: HADOOP_ORG.APACHE.SQOOP.SQOOP_OPTS: invalid variable name
2022-12-24 21:33:59,888 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
2022-12-24 21:34:00,034 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
2022-12-24 21:34:00,355 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
2022-12-24 21:34:00,356 INFO tool.CodeGenTool: Beginning code generation
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2022-12-24 21:34:02,279 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `E_INFO` AS t LIMIT 1
2022-12-24 21:34:02,678 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `E_INFO` AS t LIMIT 1
2022-12-24 21:34:02,693 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/local/hadoop
Note: /tmp/sqoop-h-user/compile/e0e749532f0eaa6daaca522c9759658a/E_INFO.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2022-12-24 21:34:07,748 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-h-user/compile/e0e749532f0eaa6daaca522c9759658a/E_INFO.jar
2022-12-24 21:34:07,798 WARN manager.MySQLManager: It looks like you are importing from mysql.
2022-12-24 21:34:07,798 WARN manager.MySQLManager: This transfer can be faster! Use the --direct
2022-12-24 21:34:07,798 WARN manager.MySQLManager: option to exercise a MySQL-specific fast path.
2022-12-24 21:34:07,798 INFO manager.MySQLManager: Setting zero DATETIME behavior to convertToNull (mysql)
2022-12-24 21:34:07,830 INFO mapreduce.ImportJobBase: Beginning import of E_INFO
2022-12-24 21:34:07,833 INFO Configuration.deprecation: mapred.job.tracker is deprecated. Instead, use mapreduce.jobtracker.address
2022-12-24 21:34:08,191 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar
2022-12-24 21:34:09,386 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
2022-12-24 21:34:09,626 INFO impl.MetricsConfig: Loaded properties from hadoop-metrics2.properties
2022-12-24 21:34:10,080 INFO impl.MetricsSystemImpl: Scheduled Metric snapshot period at 10 second(s).
2022-12-24 21:34:10,080 INFO impl.MetricsSystemImpl: JobTracker metrics system started
2022-12-24 21:34:10,722 INFO db.DBInputFormat: Using read commited transaction isolation
2022-12-24 21:34:10,793 INFO mapreduce.JobSubmitter: number of splits:1
2022-12-24 21:34:11,333 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_local377089840_0001
2022-12-24 21:34:11,334 INFO mapreduce.JobSubmitter: Executing with tokens: []
2022-12-24 21:34:12,059 INFO mapred.LocalDistributedCacheManager: Creating symlink: /tmp/hadoop-h-user/mapred/local/job_local377089840_0001_7cb16b63-36d5-4781-94e7-4bd839e2ca49/libjars <- /home/h-user/sqoop-1.4.7/bin/libjars/*
2022-12-24 21:34:12,098 WARN fs.FileUtil: Command 'ln -s /tmp/hadoop-h-user/mapred/local/job_local377089840_0001_7cb16b63-36d5-4781-94e7-4bd839e2ca49/libjars /home/h-user/sqoop-1.4.7/bin/libjars/*' failed 1 with: ln: failed to create symbolic link '/home/h-user/sqoop-1.4.7/bin/libjars/*': No such file or directory

2022-12-24 21:34:12,098 WARN mapred.LocalDistributedCacheManager: Failed to create symlink: /tmp/hadoop-h-user/mapred/local/job_local377089840_0001_7cb16b63-36d5-4781-94e7-4bd839e2ca49/libjars <- /home/h-user/sqoop-1.4.7/bin/libjars/*
2022-12-24 21:34:12,099 INFO mapred.LocalDistributedCacheManager: Localized file:/tmp/hadoop/mapred/staging/h-user377089840/.staging/job_local377089840_0001/libjars as file:/tmp/hadoop-h-user/mapred/local/job_local377089840_0001_7cb16b63-36d5-4781-94e7-4bd839e2ca49/libjars
2022-12-24 21:34:12,256 INFO mapreduce.Job: The url to track the job: http://localhost:8080/
2022-12-24 21:34:12,261 INFO mapred.LocalJobRunner: OutputCommitter set in config null
2022-12-24 21:34:12,264 INFO mapreduce.Job: Running job: job_local377089840_0001
2022-12-24 21:34:12,352 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 2
2022-12-24 21:34:12,353 INFO output.FileOutputCommitter: FileOutputCommitter skip cleanup _temporary folders under output directory:false, ignore cleanup failures: false
2022-12-24 21:34:12,362 INFO mapred.LocalJobRunner: OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
2022-12-24 21:34:12,743 INFO mapred.LocalJobRunner: Waiting for map tasks
2022-12-24 21:34:12,745 INFO mapred.LocalJobRunner: Starting task: attempt_local377089840_0001_m_000000_0
2022-12-24 21:34:12,831 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 2
2022-12-24 21:34:12,841 INFO output.FileOutputCommitter: FileOutputCommitter skip cleanup _temporary folders under output directory:false, ignore cleanup failures: false
2022-12-24 21:34:12,918 INFO mapred.Task:  Using ResourceCalculatorProcessTree : [ ]
2022-12-24 21:34:13,007 INFO db.DBInputFormat: Using read commited transaction isolation
2022-12-24 21:34:13,012 INFO mapred.MapTask: Processing split: 1=1 AND 1=1
2022-12-24 21:34:13,025 INFO mapred.LocalJobRunner: map task executor complete.
2022-12-24 21:34:13,134 WARN mapred.LocalJobRunner: job_local377089840_0001
java.lang.Exception: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class E_INFO not found
    at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:492)
    at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:552)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class E_INFO not found
    at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2638)
    at org.apache.sqoop.mapreduce.db.DBConfiguration.getInputClass(DBConfiguration.java:403)
    at org.apache.sqoop.mapreduce.db.DataDrivenDBInputFormat.createDBRecordReader(DataDrivenDBInputFormat.java:270)
    at org.apache.sqoop.mapreduce.db.DBInputFormat.createRecordReader(DBInputFormat.java:266)
    at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.<init>(MapTask.java:527)
    at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:770)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:347)
    at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:271)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.ClassNotFoundException: Class E_INFO not found
    at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2542)
    at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2636)
    ... 12 more
2022-12-24 21:34:13,345 INFO mapreduce.Job: Job job_local377089840_0001 running in uber mode : false
2022-12-24 21:34:13,351 INFO mapreduce.Job:  map 0% reduce 0%
2022-12-24 21:34:13,354 INFO mapreduce.Job: Job job_local377089840_0001 failed with state FAILED due to: NA
2022-12-24 21:34:13,389 INFO mapreduce.Job: Counters: 0
2022-12-24 21:34:13,396 WARN mapreduce.Counters: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSystemCounter instead
2022-12-24 21:34:13,402 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 3.998 seconds (0 bytes/sec)
2022-12-24 21:34:13,404 WARN mapreduce.Counters: Group org.apache.hadoop.mapred.Task$Counter is deprecated. Use org.apache.hadoop.mapreduce.TaskCounter instead
2022-12-24 21:34:13,404 INFO mapreduce.ImportJobBase: Retrieved 0 records.
2022-12-24 21:34:13,404 ERROR tool.ImportTool: Import failed: Import job failed!

</code>```

Body:
i am running this import command to import E_INFO table from MySQL databases to HDFS using sqoop. the job is failing with below given error.

sqoop import --connect jdbc:mysql://localhost/HADOOP_BANK_DATA_POC --username root --password xxxxxxx --table E_INFO

however a blank file is getting created without any records in hdfs as E_INFO.
your help here is highly appreciated.

h-user@h-primary:~/sqoop-1.4.7/bin$ sqoop import --connect jdbc:mysql://localhost/HADOOP_BANK_DATA_POC --username root --password xxxxxxx --table E_INFO
Warning: /home/h-user/sqoop-1.4.7/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /home/h-user/sqoop-1.4.7/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /home/h-user/sqoop-1.4.7/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /home/h-user/sqoop-1.4.7/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
/usr/local/hadoop/libexec/hadoop-functions.sh: line 2366: HADOOP_ORG.APACHE.SQOOP.SQOOP_USER: invalid variable name
/usr/local/hadoop/libexec/hadoop-functions.sh: line 2461: HADOOP_ORG.APACHE.SQOOP.SQOOP_OPTS: invalid variable name
2022-12-24 21:33:59,888 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
2022-12-24 21:34:00,034 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
2022-12-24 21:34:00,355 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
2022-12-24 21:34:00,356 INFO tool.CodeGenTool: Beginning code generation
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2022-12-24 21:34:02,279 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `E_INFO` AS t LIMIT 1
2022-12-24 21:34:02,678 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `E_INFO` AS t LIMIT 1
2022-12-24 21:34:02,693 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/local/hadoop
Note: /tmp/sqoop-h-user/compile/e0e749532f0eaa6daaca522c9759658a/E_INFO.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2022-12-24 21:34:07,748 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-h-user/compile/e0e749532f0eaa6daaca522c9759658a/E_INFO.jar
2022-12-24 21:34:07,798 WARN manager.MySQLManager: It looks like you are importing from mysql.
2022-12-24 21:34:07,798 WARN manager.MySQLManager: This transfer can be faster! Use the --direct
2022-12-24 21:34:07,798 WARN manager.MySQLManager: option to exercise a MySQL-specific fast path.
2022-12-24 21:34:07,798 INFO manager.MySQLManager: Setting zero DATETIME behavior to convertToNull (mysql)
2022-12-24 21:34:07,830 INFO mapreduce.ImportJobBase: Beginning import of E_INFO
2022-12-24 21:34:07,833 INFO Configuration.deprecation: mapred.job.tracker is deprecated. Instead, use mapreduce.jobtracker.address
2022-12-24 21:34:08,191 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar
2022-12-24 21:34:09,386 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
2022-12-24 21:34:09,626 INFO impl.MetricsConfig: Loaded properties from hadoop-metrics2.properties
2022-12-24 21:34:10,080 INFO impl.MetricsSystemImpl: Scheduled Metric snapshot period at 10 second(s).
2022-12-24 21:34:10,080 INFO impl.MetricsSystemImpl: JobTracker metrics system started
2022-12-24 21:34:10,722 INFO db.DBInputFormat: Using read commited transaction isolation
2022-12-24 21:34:10,793 INFO mapreduce.JobSubmitter: number of splits:1
2022-12-24 21:34:11,333 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_local377089840_0001
2022-12-24 21:34:11,334 INFO mapreduce.JobSubmitter: Executing with tokens: []
2022-12-24 21:34:12,059 INFO mapred.LocalDistributedCacheManager: Creating symlink: /tmp/hadoop-h-user/mapred/local/job_local377089840_0001_7cb16b63-36d5-4781-94e7-4bd839e2ca49/libjars <- /home/h-user/sqoop-1.4.7/bin/libjars/*
2022-12-24 21:34:12,098 WARN fs.FileUtil: Command 'ln -s /tmp/hadoop-h-user/mapred/local/job_local377089840_0001_7cb16b63-36d5-4781-94e7-4bd839e2ca49/libjars /home/h-user/sqoop-1.4.7/bin/libjars/*' failed 1 with: ln: failed to create symbolic link '/home/h-user/sqoop-1.4.7/bin/libjars/*': No such file or directory

2022-12-24 21:34:12,098 WARN mapred.LocalDistributedCacheManager: Failed to create symlink: /tmp/hadoop-h-user/mapred/local/job_local377089840_0001_7cb16b63-36d5-4781-94e7-4bd839e2ca49/libjars <- /home/h-user/sqoop-1.4.7/bin/libjars/*
2022-12-24 21:34:12,099 INFO mapred.LocalDistributedCacheManager: Localized file:/tmp/hadoop/mapred/staging/h-user377089840/.staging/job_local377089840_0001/libjars as file:/tmp/hadoop-h-user/mapred/local/job_local377089840_0001_7cb16b63-36d5-4781-94e7-4bd839e2ca49/libjars
2022-12-24 21:34:12,256 INFO mapreduce.Job: The url to track the job: http://localhost:8080/
2022-12-24 21:34:12,261 INFO mapred.LocalJobRunner: OutputCommitter set in config null
2022-12-24 21:34:12,264 INFO mapreduce.Job: Running job: job_local377089840_0001
2022-12-24 21:34:12,352 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 2
2022-12-24 21:34:12,353 INFO output.FileOutputCommitter: FileOutputCommitter skip cleanup _temporary folders under output directory:false, ignore cleanup failures: false
2022-12-24 21:34:12,362 INFO mapred.LocalJobRunner: OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
2022-12-24 21:34:12,743 INFO mapred.LocalJobRunner: Waiting for map tasks
2022-12-24 21:34:12,745 INFO mapred.LocalJobRunner: Starting task: attempt_local377089840_0001_m_000000_0
2022-12-24 21:34:12,831 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 2
2022-12-24 21:34:12,841 INFO output.FileOutputCommitter: FileOutputCommitter skip cleanup _temporary folders under output directory:false, ignore cleanup failures: false
2022-12-24 21:34:12,918 INFO mapred.Task:  Using ResourceCalculatorProcessTree : [ ]
2022-12-24 21:34:13,007 INFO db.DBInputFormat: Using read commited transaction isolation
2022-12-24 21:34:13,012 INFO mapred.MapTask: Processing split: 1=1 AND 1=1
2022-12-24 21:34:13,025 INFO mapred.LocalJobRunner: map task executor complete.
2022-12-24 21:34:13,134 WARN mapred.LocalJobRunner: job_local377089840_0001
java.lang.Exception: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class E_INFO not found
    at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:492)
    at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:552)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class E_INFO not found
    at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2638)
    at org.apache.sqoop.mapreduce.db.DBConfiguration.getInputClass(DBConfiguration.java:403)
    at org.apache.sqoop.mapreduce.db.DataDrivenDBInputFormat.createDBRecordReader(DataDrivenDBInputFormat.java:270)
    at org.apache.sqoop.mapreduce.db.DBInputFormat.createRecordReader(DBInputFormat.java:266)
    at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.<init>(MapTask.java:527)
    at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:770)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:347)
    at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:271)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.ClassNotFoundException: Class E_INFO not found
    at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2542)
    at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2636)
    ... 12 more
2022-12-24 21:34:13,345 INFO mapreduce.Job: Job job_local377089840_0001 running in uber mode : false
2022-12-24 21:34:13,351 INFO mapreduce.Job:  map 0% reduce 0%
2022-12-24 21:34:13,354 INFO mapreduce.Job: Job job_local377089840_0001 failed with state FAILED due to: NA
2022-12-24 21:34:13,389 INFO mapreduce.Job: Counters: 0
2022-12-24 21:34:13,396 WARN mapreduce.Counters: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSystemCounter instead
2022-12-24 21:34:13,402 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 3.998 seconds (0 bytes/sec)
2022-12-24 21:34:13,404 WARN mapreduce.Counters: Group org.apache.hadoop.mapred.Task$Counter is deprecated. Use org.apache.hadoop.mapreduce.TaskCounter instead
2022-12-24 21:34:13,404 INFO mapreduce.ImportJobBase: Retrieved 0 records.
2022-12-24 21:34:13,404 ERROR tool.ImportTool: Import failed: Import job failed!


问:
In owl carousel 2, the slider changes when you slide the mouse over the pictures to the right and left?
In owl carousel 2, when I hover the mouse over the images, I want them to change, here is my code:

```<code> $(document).ready(function() {
   var owl = $('.multiple-items{$P.ID}').owlCarousel({
      loop: false,
      nav: false,
      items: 1,
      animateOut: 'fadeOut',
      animateIn:  'fadeIn',
      lazyLoad: true,
      smartSpeed:1000,
    });

 });
</code>```

I tried using the code below but it only works on dots:

```<code> $(".owl-dot").hover(function() {
   $(this).trigger("click");
 });
</code>```

css:
and close links

```<code>.owl-dot{
    position: relative;
    padding: 0;
    height: 3px;
    margin: 0;
    float: left;
}
.owl-dot:before{
    content: "";
    position: absolute;
    top: -168px;
    height: 168px;
    width: 100%;
    left: 0;
    z-index: 0;
}
</code>```

Body:
In owl carousel 2, when I hover the mouse over the images, I want them to change, here is my code:

 $(document).ready(function() {
   var owl = $('.multiple-items{$P.ID}').owlCarousel({
      loop: false,
      nav: false,
      items: 1,
      animateOut: 'fadeOut',
      animateIn:  'fadeIn',
      lazyLoad: true,
      smartSpeed:1000,
    });

 });

I tried using the code below but it only works on dots:

 $(".owl-dot").hover(function() {
   $(this).trigger("click");
 });

css:
and close links

.owl-dot{
    position: relative;
    padding: 0;
    height: 3px;
    margin: 0;
    float: left;
}
.owl-dot:before{
    content: "";
    position: absolute;
    top: -168px;
    height: 168px;
    width: 100%;
    left: 0;
    z-index: 0;
}


问:
Contour plot of multiple lineplots in matplolib
I have a set of 125 x and y data (Xray absorption spectroscopy data ie energy vs intensity) and I would like to reproduce a plot similar to this one : [contour plot of xanes spectras]
(https://i.stack.imgur.com/0Kymp.png)
The spectras were taken as a function of time and my goal is to plot them in a 2d contour plot with the energy as x, and the time (or maybe just the index of the spectra) as the y. I would like the z axis to represent the intensity of the spectra with different colors so that changes in time are easily seen.

My data currently look like this, when I plot them all in the same graph with a viridis color map.line plot of the spectras

I have tried to work with the contour function of matplotlib and got this result :
attempt of a contour plot

I used the following code :

```<code>import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

df = pd.read_excel('data.xlsx')
energy = df['energy']
df.index = energy
df = df.iloc[:,2:]
df = df.transpose()
X = energy
Y = range(len(df.index))

fig, ax = plt.subplots()
ax.contourf(X,Y,df)
plt.show()
</code>```

If you have any idea, I would be grateful. I am in fact not sure that the contour function is the most apropriate for what I want, and I am open to any suggestion.
Thanks,
Yoloco

Body:
I have a set of 125 x and y data (Xray absorption spectroscopy data ie energy vs intensity) and I would like to reproduce a plot similar to this one : [contour plot of xanes spectras]
(https://i.stack.imgur.com/0Kymp.png)
The spectras were taken as a function of time and my goal is to plot them in a 2d contour plot with the energy as x, and the time (or maybe just the index of the spectra) as the y. I would like the z axis to represent the intensity of the spectra with different colors so that changes in time are easily seen.

My data currently look like this, when I plot them all in the same graph with a viridis color map.line plot of the spectras

I have tried to work with the contour function of matplotlib and got this result :
attempt of a contour plot

I used the following code :

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

df = pd.read_excel('data.xlsx')
energy = df['energy']
df.index = energy
df = df.iloc[:,2:]
df = df.transpose()
X = energy
Y = range(len(df.index))

fig, ax = plt.subplots()
ax.contourf(X,Y,df)
plt.show()

If you have any idea, I would be grateful. I am in fact not sure that the contour function is the most apropriate for what I want, and I am open to any suggestion.
Thanks,
Yoloco


问:
How to use a float as an env var in cargo/rust?
Like the title suggests, how can I create an env variable in cargo that is of type float?

I have a created .cargo/config.toml file and would like to add all the game related env variables like so:

```<code>[env]
test = "testtingggg"
yo = "yoyoyoyoyoyo"
game_zero_level = "hello"
game_zero_multiplier = 0.1
# game_one_level = 1
# game_one_multiplier = 1.0
# game_two_level = 2
# game_two_multiplier = 2.5
# game_three_level = 3
# game_three_multiplier = 5.0
# game_four_level = 3

</code>```
```<code>#[derive(Serialize, Deserialize, Debug)]
pub struct Config {
    pub level_zero: LevelZero,
    pub level_one: LevelOne,
    pub level_two: LevelTwo,
    pub level_three: LevelThree,
    pub level_four: LevelFour,

}
impl Config {
    pub fn new() -> Self {

        // Get env variables
        let temp = option_env!("game_zero_level").unwrap();
        msg!("simple env read for first game...");
        msg!("{}", temp);

        // load them into struct
        // template for now
        Config {
            level_zero: LevelZero { level: 0, multiplier: 1.0 },
            level_one: LevelOne { level: 1, multiplier: 1.0 },
            level_two: LevelTwo { level: 2, multiplier: 1.0 },
            level_three: LevelThree { level: 3, multiplier: 1.0 },
            level_four: LevelFour { level: 4, multiplier: 1.0 },
        }
    }
}

</code>```

Code

However, I got an error:

```<code>2022-12-24T18:22:59.802122509Z ERROR cargo_build_sbf] Failed to obtain packag
e metadata: `cargo metadata` exited with an error: error: could not load Cargo
 configuration

    Caused by:
      failed to load TOML configuration from `/home/tai/Code/solana/techniques
/env-vars3/programs/env-vars3/.cargo/config.toml`

    Caused by:
      failed to parse key `env`

    Caused by:
      failed to parse key `game_zero_multiplier`

    Caused by:
      found TOML configuration value of unknown type `float`
</code>```

error

Any suggestions would be soo appreciated! Thanks

Body:
Like the title suggests, how can I create an env variable in cargo that is of type float?

I have a created .cargo/config.toml file and would like to add all the game related env variables like so:

[env]
test = "testtingggg"
yo = "yoyoyoyoyoyo"
game_zero_level = "hello"
game_zero_multiplier = 0.1
# game_one_level = 1
# game_one_multiplier = 1.0
# game_two_level = 2
# game_two_multiplier = 2.5
# game_three_level = 3
# game_three_multiplier = 5.0
# game_four_level = 3

#[derive(Serialize, Deserialize, Debug)]
pub struct Config {
    pub level_zero: LevelZero,
    pub level_one: LevelOne,
    pub level_two: LevelTwo,
    pub level_three: LevelThree,
    pub level_four: LevelFour,

}
impl Config {
    pub fn new() -> Self {

        // Get env variables
        let temp = option_env!("game_zero_level").unwrap();
        msg!("simple env read for first game...");
        msg!("{}", temp);

        // load them into struct
        // template for now
        Config {
            level_zero: LevelZero { level: 0, multiplier: 1.0 },
            level_one: LevelOne { level: 1, multiplier: 1.0 },
            level_two: LevelTwo { level: 2, multiplier: 1.0 },
            level_three: LevelThree { level: 3, multiplier: 1.0 },
            level_four: LevelFour { level: 4, multiplier: 1.0 },
        }
    }
}

Code

However, I got an error:

2022-12-24T18:22:59.802122509Z ERROR cargo_build_sbf] Failed to obtain packag
e metadata: `cargo metadata` exited with an error: error: could not load Cargo
 configuration

    Caused by:
      failed to load TOML configuration from `/home/tai/Code/solana/techniques
/env-vars3/programs/env-vars3/.cargo/config.toml`

    Caused by:
      failed to parse key `env`

    Caused by:
      failed to parse key `game_zero_multiplier`

    Caused by:
      found TOML configuration value of unknown type `float`

error

Any suggestions would be soo appreciated! Thanks


问:
Reading excel file android studio Java
Happy holidays!

Apology if my english does not make sense.

I'm trying to write app, that takes excel file from downloads folder, searches for certain keywords, finds and counts the occurrences. And then it displays keyword and amount of occurrences.

I have been struggling with this problem for 4 weeks, I'm building it to make my work easier, i know very little about programming.

Thanks in advance!

```<code>public class MainActivity extends AppCompatActivity {

    // Initialize variable
    Button btSelect;
    TextView tvUri;
    TextView tvPath;
    ActivityResultLauncher<Intent> resultLauncher;
    String nimi;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // assign variable
        btSelect = findViewById(R.id.bt_select);
        tvUri = findViewById(R.id.tv_uri);
        tvPath = findViewById(R.id.tv_path);

        // Initialize result launcher
        resultLauncher = registerForActivityResult(
                new ActivityResultContracts
                        .StartActivityForResult(),
                new ActivityResultCallback<ActivityResult>() {
                    @Override
                    public void onActivityResult(
                            ActivityResult result)
                    {
                        // Initialize result data
                        Intent data = result.getData();

                        // check condition
                        if (data != null) {
                            // When data is not equal to empty
                            // Get PDf uri
                            Uri sUri = data.getData();
                            // set Uri on text view
                            tvUri.setText(Html.fromHtml(
                                    "<big><b>PDF Uri</b></big><br>"
                                            + sUri));

                            // Get PDF path
                            String sPath = sUri.getPath();
                            // Set path on text view
                            tvPath.setText(Html.fromHtml(
                                    "<big><b>PDF Path</b></big><br>"
                                            + sPath));
                            nimi = String.valueOf(sUri);
                            try {
                                FetchFromFile();
                            } catch (IOException e) {
                                e.printStackTrace();
                            }

                        }
                    }
                });

        // Set click listener on button
        btSelect.setOnClickListener(
                new View.OnClickListener() {
                    @Override public void onClick(View v)
                    {
                        // check condition
                        if (ActivityCompat.checkSelfPermission(
                                MainActivity.this,
                                Manifest.permission
                                        .READ_EXTERNAL_STORAGE)
                                != PackageManager
                                .PERMISSION_GRANTED) {
                            // When permission is not granted
                            // Result permission
                            ActivityCompat.requestPermissions(
                                    MainActivity.this,
                                    new String[] {
                                            Manifest.permission
                                                    .READ_EXTERNAL_STORAGE },
                                    1);
                        }
                        else {
                            // When permission is granted
                            // Create method
                            selectFile();
                        }
                    }
                });
    }

    private void selectFile()
    {
        // Initialize intent
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        // set type
        intent.setType("*/*");
        // Launch intent
        resultLauncher.launch(intent);
    }

    @Override
    public void onRequestPermissionsResult(
            int requestCode, @NonNull String[] permissions,
            @NonNull int[] grantResults)
    {
        super.onRequestPermissionsResult(
                requestCode, permissions, grantResults);

        // check condition
        if (requestCode == 1 && grantResults.length > 0
                && grantResults[0]
                == PackageManager.PERMISSION_GRANTED) {
            // When permission is granted
            // Call method
            selectFile();
        }
        else {
            // When permission is denied
            // Display toast
            Toast.makeText(getApplicationContext(), "Permission Denied", Toast.LENGTH_SHORT).show();
        }
    }

</code>```

So in this function "FetchFromFile()" if i try to TOAST out "CELL" but it does not find the content and it does not even get pass the first "TOAST".

```<code>    public void FetchFromFile() throws IOException {

        File file = new File(nimi);

        FileInputStream fileInputStream;
        Toast.makeText(getApplicationContext(), "Prints this TOAST", Toast.LENGTH_SHORT).show();
        fileInputStream = new FileInputStream(file);
        Toast.makeText(getApplicationContext(), "Does not print this TOAST", Toast.LENGTH_SHORT).show();
        XSSFWorkbook workbook = new XSSFWorkbook(fileInputStream);

        XSSFSheet sheet = workbook.getSheetAt(0);

        XSSFRow row = sheet.getRow(1);

        XSSFCell cell = row.getCell(1);

    }
}

</code>```

I have already tried i guess all those solution in stackoverflow but it seems that i am still doing something wrong because it is not working.

Here are the Uri and Path that the app find about selected file

Title: Reading excel file android studio Java

Body:
Happy holidays!

Apology if my english does not make sense.

I'm trying to write app, that takes excel file from downloads folder, searches for certain keywords, finds and counts the occurrences. And then it displays keyword and amount of occurrences.

I have been struggling with this problem for 4 weeks, I'm building it to make my work easier, i know very little about programming.

Thanks in advance!

public class MainActivity extends AppCompatActivity {

    // Initialize variable
    Button btSelect;
    TextView tvUri;
    TextView tvPath;
    ActivityResultLauncher<Intent> resultLauncher;
    String nimi;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // assign variable
        btSelect = findViewById(R.id.bt_select);
        tvUri = findViewById(R.id.tv_uri);
        tvPath = findViewById(R.id.tv_path);

        // Initialize result launcher
        resultLauncher = registerForActivityResult(
                new ActivityResultContracts
                        .StartActivityForResult(),
                new ActivityResultCallback<ActivityResult>() {
                    @Override
                    public void onActivityResult(
                            ActivityResult result)
                    {
                        // Initialize result data
                        Intent data = result.getData();

                        // check condition
                        if (data != null) {
                            // When data is not equal to empty
                            // Get PDf uri
                            Uri sUri = data.getData();
                            // set Uri on text view
                            tvUri.setText(Html.fromHtml(
                                    "<big>PDF Uri</big>
"
                                            + sUri));

                            // Get PDF path
                            String sPath = sUri.getPath();
                            // Set path on text view
                            tvPath.setText(Html.fromHtml(
                                    "<big>PDF Path</big>
"
                                            + sPath));
                            nimi = String.valueOf(sUri);
                            try {
                                FetchFromFile();
                            } catch (IOException e) {
                                e.printStackTrace();
                            }

                        }
                    }
                });

        // Set click listener on button
        btSelect.setOnClickListener(
                new View.OnClickListener() {
                    @Override public void onClick(View v)
                    {
                        // check condition
                        if (ActivityCompat.checkSelfPermission(
                                MainActivity.this,
                                Manifest.permission
                                        .READ_EXTERNAL_STORAGE)
                                != PackageManager
                                .PERMISSION_GRANTED) {
                            // When permission is not granted
                            // Result permission
                            ActivityCompat.requestPermissions(
                                    MainActivity.this,
                                    new String[] {
                                            Manifest.permission
                                                    .READ_EXTERNAL_STORAGE },
                                    1);
                        }
                        else {
                            // When permission is granted
                            // Create method
                            selectFile();
                        }
                    }
                });
    }

    private void selectFile()
    {
        // Initialize intent
        Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        // set type
        intent.setType("*/*");
        // Launch intent
        resultLauncher.launch(intent);
    }

    @Override
    public void onRequestPermissionsResult(
            int requestCode, @NonNull String[] permissions,
            @NonNull int[] grantResults)
    {
        super.onRequestPermissionsResult(
                requestCode, permissions, grantResults);

        // check condition
        if (requestCode == 1 && grantResults.length > 0
                && grantResults[0]
                == PackageManager.PERMISSION_GRANTED) {
            // When permission is granted
            // Call method
            selectFile();
        }
        else {
            // When permission is denied
            // Display toast
            Toast.makeText(getApplicationContext(), "Permission Denied", Toast.LENGTH_SHORT).show();
        }
    }

So in this function "FetchFromFile()" if i try to TOAST out "CELL" but it does not find the content and it does not even get pass the first "TOAST".

    public void FetchFromFile() throws IOException {

        File file = new File(nimi);

        FileInputStream fileInputStream;
        Toast.makeText(getApplicationContext(), "Prints this TOAST", Toast.LENGTH_SHORT).show();
        fileInputStream = new FileInputStream(file);
        Toast.makeText(getApplicationContext(), "Does not print this TOAST", Toast.LENGTH_SHORT).show();
        XSSFWorkbook workbook = new XSSFWorkbook(fileInputStream);

        XSSFSheet sheet = workbook.getSheetAt(0);

        XSSFRow row = sheet.getRow(1);

        XSSFCell cell = row.getCell(1);

    }
}

I have already tried i guess all those solution in stackoverflow but it seems that i am still doing something wrong because it is not working.

Here are the Uri and Path that the app find about selected file


问:
Error in Connecting the MongoDB server with Node app MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
I am working on a MERN project and Earlier my mongo server was working fine, but now that I have restarted my app it is giving me error i.e is
`

```<code>MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
    at NativeConnection.Connection.openUri (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/connection.js:824:32)
    at /Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/index.js:381:10
    at /Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5
    at new Promise (<anonymous>)
    at promiseOrCallback (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)
    at Mongoose._promiseOrCallback (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/index.js:1234:10)
    at Mongoose.connect (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/index.js:380:20)
    at connectDataBase (/Users/vaibhav/Desktop/Development/MERN PROJECT/backend/config/dataBase.js:7:10)
    at Object.<anonymous> (/Users/vaibhav/Desktop/Development/MERN PROJECT/backend/server.js:17:1)
    at Module._compile (node:internal/modules/cjs/loader:1126:14) {
  reason: TopologyDescription {
    type: 'Unknown',
    servers: Map(1) { 'localhost:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: null,
    maxElectionId: null,
    maxSetVersion: null,
    commonWireVersion: 0,
    logicalSessionTimeoutMinutes: null
  },
  code: undefined
}

</code>```

My confige.env file looks like this

```<code>PORT = 4000
DB_URI = "mongodb://localhost:27017/Ecommerce"

JWT_SECRET=JBRON098SROINRIOUHOHSDOKFN948HIFRCN
JWT_EXPIRE=5d

COOKIE_EXPIRE = 5
</code>```

My app.js file looks like this

```<code>const app = require('./app')

const dotenv = require('dotenv')
const connectDataBase = require("./config/dataBase")

//Handling uncaught exception
process.on("uncaughtException", (err) => {
    console.log(`Error: , ${err.message}`);
    console.log(`Shutting down server due to unhandled promise rejection`);
    process.exit(1);
})

//config file
dotenv.config({path:"backend/config/config.env"});

//Calling the function to connect the database
connectDataBase();

const server = app.listen(process.env.PORT, ()=>{
    console.log(`The server has started at http://localhost/${process.env.PORT}`);
})

</code>```

I have also tried connecting with compass but it is still not working. I used a MacBook air m2 with macOS Ventura 13.0.1

I wanted to connect to the server using the app only but it is giving me the error

`

```<code>MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
    at NativeConnection.Connection.openUri (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/connection.js:824:32)
    at /Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/index.js:381:10
    at /Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5
    at new Promise (<anonymous>)
    at promiseOrCallback (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)
    at Mongoose._promiseOrCallback (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/index.js:1234:10)
    at Mongoose.connect (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/index.js:380:20)
    at connectDataBase (/Users/vaibhav/Desktop/Development/MERN PROJECT/backend/config/dataBase.js:7:10)
    at Object.<anonymous> (/Users/vaibhav/Desktop/Development/MERN PROJECT/backend/server.js:17:1)
    at Module._compile (node:internal/modules/cjs/loader:1126:14) {
  reason: TopologyDescription {
    type: 'Unknown',
    servers: Map(1) { 'localhost:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: null,
    maxElectionId: null,
    maxSetVersion: null,
    commonWireVersion: 0,
    logicalSessionTimeoutMinutes: null
  },
  code: undefined
}

</code>```

`

Body:
I am working on a MERN project and Earlier my mongo server was working fine, but now that I have restarted my app it is giving me error i.e is
`

MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
    at NativeConnection.Connection.openUri (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/connection.js:824:32)
    at /Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/index.js:381:10
    at /Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5
    at new Promise (<anonymous>)
    at promiseOrCallback (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)
    at Mongoose._promiseOrCallback (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/index.js:1234:10)
    at Mongoose.connect (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/index.js:380:20)
    at connectDataBase (/Users/vaibhav/Desktop/Development/MERN PROJECT/backend/config/dataBase.js:7:10)
    at Object.<anonymous> (/Users/vaibhav/Desktop/Development/MERN PROJECT/backend/server.js:17:1)
    at Module._compile (node:internal/modules/cjs/loader:1126:14) {
  reason: TopologyDescription {
    type: 'Unknown',
    servers: Map(1) { 'localhost:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: null,
    maxElectionId: null,
    maxSetVersion: null,
    commonWireVersion: 0,
    logicalSessionTimeoutMinutes: null
  },
  code: undefined
}

My confige.env file looks like this

PORT = 4000
DB_URI = "mongodb://localhost:27017/Ecommerce"

JWT_SECRET=JBRON098SROINRIOUHOHSDOKFN948HIFRCN
JWT_EXPIRE=5d

COOKIE_EXPIRE = 5

My app.js file looks like this

const app = require('./app')

const dotenv = require('dotenv')
const connectDataBase = require("./config/dataBase")

//Handling uncaught exception
process.on("uncaughtException", (err) => {
    console.log(`Error: , ${err.message}`);
    console.log(`Shutting down server due to unhandled promise rejection`);
    process.exit(1);
})

//config file
dotenv.config({path:"backend/config/config.env"});

//Calling the function to connect the database
connectDataBase();

const server = app.listen(process.env.PORT, ()=>{
    console.log(`The server has started at http://localhost/${process.env.PORT}`);
})

I have also tried connecting with compass but it is still not working. I used a MacBook air m2 with macOS Ventura 13.0.1

I wanted to connect to the server using the app only but it is giving me the error

`

MongooseServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017
    at NativeConnection.Connection.openUri (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/connection.js:824:32)
    at /Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/index.js:381:10
    at /Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5
    at new Promise (<anonymous>)
    at promiseOrCallback (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)
    at Mongoose._promiseOrCallback (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/index.js:1234:10)
    at Mongoose.connect (/Users/vaibhav/Desktop/Development/MERN PROJECT/node_modules/mongoose/lib/index.js:380:20)
    at connectDataBase (/Users/vaibhav/Desktop/Development/MERN PROJECT/backend/config/dataBase.js:7:10)
    at Object.<anonymous> (/Users/vaibhav/Desktop/Development/MERN PROJECT/backend/server.js:17:1)
    at Module._compile (node:internal/modules/cjs/loader:1126:14) {
  reason: TopologyDescription {
    type: 'Unknown',
    servers: Map(1) { 'localhost:27017' => [ServerDescription] },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: null,
    maxElectionId: null,
    maxSetVersion: null,
    commonWireVersion: 0,
    logicalSessionTimeoutMinutes: null
  },
  code: undefined
}

`


问:
(Godot) how to create a 2d shadow with a sprite + blending mode?
I have a node 2d for my player object. It has a sprite child with the player sprite.
I want to redraw the same sprite but black + with some blending mode so that it affects the background.
Below is an example I made using Photoshop of what I want the shadow to look like. its using a softlight blending mode.
I have already looked into gdShaders but Im very new with that topic. Is there a resource where I can learn how I can accomplish this shadow effect with gdShader? I appreciate it thanks.


问:
SBT remote caching weird invalidation
meta info

```<code>sbt=1.8.0 jdk=Amazon.com Inc. Java 1.8.0_342
</code>```

I created a simple project using sbt new ... with the following directory structure

```<code>.
├── main
│   └── scala
│       └── example
│           ├── A.scala
│           ├── B.scala
│           ├── C.scala
│           ├── D.scala
│           ├── E.scala
│           └── Hello.scala
└── test
    └── scala
        └── example
            └── HelloSpec.scala
</code>```

build.sbt looks like

```<code>import Dependencies._

ThisBuild / scalaVersion     := "2.13.8"
ThisBuild / version          := "0.1.0-SNAPSHOT"
ThisBuild / organization     := "com.example"
ThisBuild / organizationName := "example"

ThisBuild / pushRemoteCacheTo := Some(MavenCache("local-cache", file("/tmp/cache")))
ThisBuild / logLevel := Level.Debug
ThisBuild / incOptions := incOptions.value.withApiDebug(true).withRelationsDebug(true)

lazy val root = (project in file("."))
  .settings(
    name := "helloworldsbt",
    libraryDependencies += scalaTest % Test
  )
</code>```

I then performed a

```<code>sbt  "; compile; pushRemoteCache;"
</code>```

The cache now looks like

```<code>[19:26:51] ➜  helloworldsbt cd  /tmp/cache/com/example/helloworldsbt_2.13
[19:27:59] ➜  helloworldsbt_2.13 tree
.
├── 0.0.0-55c7c2b9b2d9068c
│   ├── helloworldsbt_2.13-0.0.0-55c7c2b9b2d9068c-cached-test.jar
│   ├── helloworldsbt_2.13-0.0.0-55c7c2b9b2d9068c-cached-test.jar.md5
│   └── helloworldsbt_2.13-0.0.0-55c7c2b9b2d9068c-cached-test.jar.sha1
└── 0.0.0-f0c3847d849b0a58
    ├── helloworldsbt_2.13-0.0.0-f0c3847d849b0a58-cached-compile.jar
    ├── helloworldsbt_2.13-0.0.0-f0c3847d849b0a58-cached-compile.jar.md5
    └── helloworldsbt_2.13-0.0.0-f0c3847d849b0a58-cached-compile.jar.sha1
</code>```

I then copied my project to some other subfolder ( with same name ) and updated just one file in the project

But on performing

```<code>sbt  "pullRemoteCache; compile;"
</code>```

I get a full compilation

```<code>[info] welcome to sbt 1.8.0 (Amazon.com Inc. Java 1.8.0_342)
[info] loading project definition from /Users/faiz.halde/p/helloworldsbt/project
[info] loading settings for project root from build.sbt ...
[info] set current project to helloworldsbt (in build file:/Users/faiz.halde/p/helloworldsbt/)
[debug] not up to date. inChanged = true, force = false
[debug] Updating ...
[debug] Done updating
[debug] Other repositories:
[debug] Default repositories:
[debug] Using inline dependencies specified in Scala.
[debug]         tried file:/tmp/cache/com/example/helloworldsbt_2.13/0.0.0-a920b6ad175a9a8a/helloworldsbt_2.13-0.0.0-a920b6ad175a9a8a-cached-compile.jar
[info] remote cache artifact not found for com.example:helloworldsbt:0.0.0-a920b6ad175a9a8a Some(cached-compile)
[debug] failed to download Vector(com.example#helloworldsbt_2.13;0.0.0-a920b6ad175a9a8a!helloworldsbt_2.13.jar): local-cache
[debug] Using inline dependencies specified in Scala.
[debug]     [NOT REQUIRED] com.example#helloworldsbt_2.13;0.0.0-55c7c2b9b2d9068c!helloworldsbt_2.13.jar
[info] remote cache artifact extracted for com.example:helloworldsbt:0.0.0-55c7c2b9b2d9068c Some(cached-test)
[success] Total time: 1 s, completed Dec 24, 2022 7:30:36 PM
[debug] [zinc] IncrementalCompile -----------
[debug] IncrementalCompile.incrementalCompile
[debug] previous = Stamps for: 0 products, 0 sources, 0 libraries
[debug] current source = Set(${BASE}/src/main/scala/example/D.scala, ${BASE}/src/main/scala/example/C.scala, ${BASE}/src/main/scala/example/B.scala, ${BASE}/src/main/scala/example/E.scala, ${BASE}/src/main/scala/example/Hello.scala, ${BASE}/src/main/scala/example/A.scala)
[debug] > initialChanges = InitialChanges(Changes(added = Set(${BASE}/src/main/scala/example/C.scala, ${BASE}/src/main/scala/example/E.scala, ${BASE}/src/main/scala/example/Hello.scala, ${BASE}/src/main/scala/example/D.scala, ${BASE}/src/main/scala/example/A.scala, ${BASE}/src/main/scala/example/B.scala), removed = Set(), changed = Set(), unmodified = ...),Set(),Set(),API Changes: Set())
[debug] Full compilation, no sources in previous analysis.
[debug] all 6 sources are invalidated
[debug] Created transactional ClassFileManager with tempDir = /Users/faiz.halde/p/helloworldsbt/target/scala-2.13/classes.bak
[debug] [inv] Invalidate package objects by inheritance only...
[debug] Initial set of included nodes:
[debug] [inv] Package object invalidations:
[debug] Recompiling all sources: number of invalidated sources > 50.0 percent of all sources
[debug] About to delete class files:
[debug] We backup class files:
[debug] [inv] ********* Pruned:
[debug] [inv] Relations:
[debug] [inv]   products: Relation [ ]
[debug] [inv]   library deps: Relation [ ]
[debug] [inv]   library class names: Relation [ ]
[debug] [inv]   internalDependencies:
[debug] [inv]   externalDependencies:
[debug] [inv]   class names: Relation [ ]
[debug] [inv]   used names: UsedNames [ ]
[debug] [inv]   product class names: Relation [ ]
[debug] [inv] *********
[debug] compilation cycle 1
[info] compiling 6 Scala sources to /Users/faiz.halde/p/helloworldsbt/target/scala-2.13/classes ...
</code>```

Have I misunderstood the usage of remote caching?

```<code>Full compilation, no sources in previous analysis
</code>```

Why isn't my remote cache not containing sources?

Title: SBT remote caching weird invalidation

Body:
meta info

sbt=1.8.0 jdk=Amazon.com Inc. Java 1.8.0_342

I created a simple project using sbt new ... with the following directory structure

.
├── main
│   └── scala
│       └── example
│           ├── A.scala
│           ├── B.scala
│           ├── C.scala
│           ├── D.scala
│           ├── E.scala
│           └── Hello.scala
└── test
    └── scala
        └── example
            └── HelloSpec.scala

build.sbt looks like

import Dependencies._

ThisBuild / scalaVersion     := "2.13.8"
ThisBuild / version          := "0.1.0-SNAPSHOT"
ThisBuild / organization     := "com.example"
ThisBuild / organizationName := "example"

ThisBuild / pushRemoteCacheTo := Some(MavenCache("local-cache", file("/tmp/cache")))
ThisBuild / logLevel := Level.Debug
ThisBuild / incOptions := incOptions.value.withApiDebug(true).withRelationsDebug(true)

lazy val root = (project in file("."))
  .settings(
    name := "helloworldsbt",
    libraryDependencies += scalaTest % Test
  )

I then performed a

sbt  "; compile; pushRemoteCache;"

The cache now looks like

[19:26:51] ➜  helloworldsbt cd  /tmp/cache/com/example/helloworldsbt_2.13
[19:27:59] ➜  helloworldsbt_2.13 tree
.
├── 0.0.0-55c7c2b9b2d9068c
│   ├── helloworldsbt_2.13-0.0.0-55c7c2b9b2d9068c-cached-test.jar
│   ├── helloworldsbt_2.13-0.0.0-55c7c2b9b2d9068c-cached-test.jar.md5
│   └── helloworldsbt_2.13-0.0.0-55c7c2b9b2d9068c-cached-test.jar.sha1
└── 0.0.0-f0c3847d849b0a58
    ├── helloworldsbt_2.13-0.0.0-f0c3847d849b0a58-cached-compile.jar
    ├── helloworldsbt_2.13-0.0.0-f0c3847d849b0a58-cached-compile.jar.md5
    └── helloworldsbt_2.13-0.0.0-f0c3847d849b0a58-cached-compile.jar.sha1

I then copied my project to some other subfolder ( with same name ) and updated just one file in the project

But on performing

sbt  "pullRemoteCache; compile;"

I get a full compilation

[info] welcome to sbt 1.8.0 (Amazon.com Inc. Java 1.8.0_342)
[info] loading project definition from /Users/faiz.halde/p/helloworldsbt/project
[info] loading settings for project root from build.sbt ...
[info] set current project to helloworldsbt (in build file:/Users/faiz.halde/p/helloworldsbt/)
[debug] not up to date. inChanged = true, force = false
[debug] Updating ...
[debug] Done updating
[debug] Other repositories:
[debug] Default repositories:
[debug] Using inline dependencies specified in Scala.
[debug]         tried file:/tmp/cache/com/example/helloworldsbt_2.13/0.0.0-a920b6ad175a9a8a/helloworldsbt_2.13-0.0.0-a920b6ad175a9a8a-cached-compile.jar
[info] remote cache artifact not found for com.example:helloworldsbt:0.0.0-a920b6ad175a9a8a Some(cached-compile)
[debug] failed to download Vector(com.example#helloworldsbt_2.13;0.0.0-a920b6ad175a9a8a!helloworldsbt_2.13.jar): local-cache
[debug] Using inline dependencies specified in Scala.
[debug]     [NOT REQUIRED] com.example#helloworldsbt_2.13;0.0.0-55c7c2b9b2d9068c!helloworldsbt_2.13.jar
[info] remote cache artifact extracted for com.example:helloworldsbt:0.0.0-55c7c2b9b2d9068c Some(cached-test)
[success] Total time: 1 s, completed Dec 24, 2022 7:30:36 PM
[debug] [zinc] IncrementalCompile -----------
[debug] IncrementalCompile.incrementalCompile
[debug] previous = Stamps for: 0 products, 0 sources, 0 libraries
[debug] current source = Set(${BASE}/src/main/scala/example/D.scala, ${BASE}/src/main/scala/example/C.scala, ${BASE}/src/main/scala/example/B.scala, ${BASE}/src/main/scala/example/E.scala, ${BASE}/src/main/scala/example/Hello.scala, ${BASE}/src/main/scala/example/A.scala)
[debug] > initialChanges = InitialChanges(Changes(added = Set(${BASE}/src/main/scala/example/C.scala, ${BASE}/src/main/scala/example/E.scala, ${BASE}/src/main/scala/example/Hello.scala, ${BASE}/src/main/scala/example/D.scala, ${BASE}/src/main/scala/example/A.scala, ${BASE}/src/main/scala/example/B.scala), removed = Set(), changed = Set(), unmodified = ...),Set(),Set(),API Changes: Set())
[debug] Full compilation, no sources in previous analysis.
[debug] all 6 sources are invalidated
[debug] Created transactional ClassFileManager with tempDir = /Users/faiz.halde/p/helloworldsbt/target/scala-2.13/classes.bak
[debug] [inv] Invalidate package objects by inheritance only...
[debug] Initial set of included nodes:
[debug] [inv] Package object invalidations:
[debug] Recompiling all sources: number of invalidated sources > 50.0 percent of all sources
[debug] About to delete class files:
[debug] We backup class files:
[debug] [inv] ********* Pruned:
[debug] [inv] Relations:
[debug] [inv]   products: Relation [ ]
[debug] [inv]   library deps: Relation [ ]
[debug] [inv]   library class names: Relation [ ]
[debug] [inv]   internalDependencies:
[debug] [inv]   externalDependencies:
[debug] [inv]   class names: Relation [ ]
[debug] [inv]   used names: UsedNames [ ]
[debug] [inv]   product class names: Relation [ ]
[debug] [inv] *********
[debug] compilation cycle 1
[info] compiling 6 Scala sources to /Users/faiz.halde/p/helloworldsbt/target/scala-2.13/classes ...

Have I misunderstood the usage of remote caching?

Full compilation, no sources in previous analysis

Why isn't my remote cache not containing sources?


问:
Using scipy's solve_ivp with event
I reproduced the issue I have with my more complex code with the following example:

```<code>import numpy as np
from scipy.integrate import solve_ivp

def funct(t, y):
    return np.sqrt(100-y)

def event(t, y):
    return y-100

event.terminal = True
sol = solve_ivp(funct, [0, 50], np.array([0]), events=event, rtol=1e-9, atol=1e-12)
</code>```

As you can see, the integration should stop when y = 100. For this reason, I created an event in order to detect that and stop the integration.
However, the function is being computed with values y > 100 because I get the warning:

```<code>RuntimeWarning: invalid value encountered in sqrt return np.sqrt(100-y)
</code>```

I guess this happens because according to Scipy documentation

```<code>The solver will find an accurate value of t at which event(t, y(t)) = 0 using a root-finding algorithm.
</code>```

Is there a way to avoid this from happening?

Title: Using scipy's solve_ivp with event

Body:
I reproduced the issue I have with my more complex code with the following example:

import numpy as np
from scipy.integrate import solve_ivp

def funct(t, y):
    return np.sqrt(100-y)

def event(t, y):
    return y-100

event.terminal = True
sol = solve_ivp(funct, [0, 50], np.array([0]), events=event, rtol=1e-9, atol=1e-12)

As you can see, the integration should stop when y = 100. For this reason, I created an event in order to detect that and stop the integration.
However, the function is being computed with values y > 100 because I get the warning:

RuntimeWarning: invalid value encountered in sqrt return np.sqrt(100-y)

I guess this happens because according to Scipy documentation

The solver will find an accurate value of t at which event(t, y(t)) = 0 using a root-finding algorithm.

Is there a way to avoid this from happening?


问:
Attempting to create a new tauri app causes permissions error
I am new to working with tauri, and when I run cargo create-tauri-app it runs the 'setup' and askes for app name, package manager (cargo) and UI template.  After choosing the final option, it says permission denied.  I tried running the command with sudo but then it says no such subcommand: 'create-tauri-app'.


问:
SwiftUI how to align the navigation bar title on center when user taps on a navigation link?
I have a TabView in a struct. I add a NavigationView and a NavigationLink. When the view shows up the navigation bar is centered. When i tap on the navigation link the text is on the leading side. How can i make the navigation bar text align to center after i tap the navigation link in iOS 16 and above? I have searched stackoverflow and nothing seems to work in iOS 16 with this specific implementation i am posting below. Any help appreciated.</p>
```<code>import Foundation
import SwiftUI

public struct TabViewTest: View {

 @State var selectedTab: Int = 0

    public var body: some View {

        TabView (selection: $selectedTab) {
            NavigationView {
                NavigationLink(destination: Text("destination"))
                {
                    FeedView(selectedTab: $selectedTab)
                        .navigationBarTitle("Feed", displayMode: .inline)
                        .toolbar {
                            ToolbarItemGroup {
                                Image(systemName :"magnifyingglass.circle")
                                    .onTapGesture {
                                        selectedTab = 1
                                }
                        }
                    }
                }
            }

            .tabItem {
                Text("Feed")
                    .foregroundColor(.white)
            }
            .tag(0)

}
}

struct ProfileView: View {
    @Binding var selectedTab: Int

    var body: some View {
        ZStack {
            Color.white.ignoresSafeArea()
            VStack {
                Text("Nav link test tap anywhere")
                    .font(.largeTitle)
                    .foregroundColor(.white)
            }
        }
    }
}
</code>```

Body:
I have a TabView in a struct. I add a NavigationView and a NavigationLink. When the view shows up the navigation bar is centered. When i tap on the navigation link the text is on the leading side. How can i make the navigation bar text align to center after i tap the navigation link in iOS 16 and above? I have searched stackoverflow and nothing seems to work in iOS 16 with this specific implementation i am posting below. Any help appreciated.

import Foundation
import SwiftUI

public struct TabViewTest: View {

 @State var selectedTab: Int = 0

    public var body: some View {

        TabView (selection: $selectedTab) {
            NavigationView {
                NavigationLink(destination: Text("destination"))
                {
                    FeedView(selectedTab: $selectedTab)
                        .navigationBarTitle("Feed", displayMode: .inline)
                        .toolbar {
                            ToolbarItemGroup {
                                Image(systemName :"magnifyingglass.circle")
                                    .onTapGesture {
                                        selectedTab = 1
                                }
                        }
                    }
                }
            }

            .tabItem {
                Text("Feed")
                    .foregroundColor(.white)
            }
            .tag(0)

}
}

struct ProfileView: View {
    @Binding var selectedTab: Int

    var body: some View {
        ZStack {
            Color.white.ignoresSafeArea()
            VStack {
                Text("Nav link test tap anywhere")
                    .font(.largeTitle)
                    .foregroundColor(.white)
            }
        }
    }
}


问:
React Routing with Authentication and Firebase User Contexts is not working
I have a problem with react context and react router. I have implemented following  auth context:

```<code>import { useState, createContext, useContext, useEffect } from "react";
import { app} from "../firebase/config";
import { onAuthStateChanged } from "@firebase/auth";
import { getAuth } from "@firebase/auth";
import { Navigate
 } from "react-router-dom";

export const FirebaseContext = createContext({
  user: null,
  isLoggedIn: false,
  token: "",
});

export function FirebaseAuthProvider({ children }) {
  const [user, setUser] = useState(null);
  const [token, setToken] = useState(null);
  console.log("In context");

  useEffect(() => {
    console.log("Before auth")
    const auth = getAuth(app);
    console.log("In use effect");
    auth.onAuthStateChanged(async (user) => {
      if (user) {
        console.log("User", user);
        setUser(user);
        const token = await user.getIdToken();
        setToken(token);
        console.log("Token", token)
      } else {
       return <Navigate to="/login" />
      }
    });
    console.log("End of useEffect");
  }, []);
  const contextValue = {
    user: user,
    isLoggedIn: !!token,
    token: token,
  };
  return (
    <FirebaseContext.Provider value={{contextValue}}>
      {children}
    </FirebaseContext.Provider>
  );
}
</code>```

And this is my app.js:

```<code>import "./App.css";
import { FirebaseAuthProvider, FirebaseContext } from "./context/firebaseContext";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import Layout from "./components/Layout/layout";
import HomePage from "./pages/homepage";
import NoPage from "./pages/404";
import SignInPage from "./pages/signin";
import ProtectedRoute from "./components/protectedRoute";

function App() {

  return (
    <FirebaseAuthProvider >
      <BrowserRouter>
        <Routes>
          <Route path="/" element={<Layout />}>
            <Route index element={<ProtectedRoute><HomePage /></ProtectedRoute>} />
            {/*       <Route path="blogs" element={<Blogs />} />*/}
            <Route path="signin" element={<SignInPage />} />
            <Route path="*" element={<NoPage />} />
          </Route>
        </Routes>
      </BrowserRouter>
    </FirebaseAuthProvider>
  );
}

export default App;
</code>```

Here is the protectedRoute.js:

```<code>import React, { useContext } from 'react'
import { FirebaseContext } from '../context/firebaseContext'
import { Navigate } from 'react-router-dom';
function ProtectedRoute({
  redirectPath = '/signin',
  children,
}) {

  const {user, isLoggedIn} = useContext(FirebaseContext);
  console.log("isLoged", isLoggedIn, user);
  if (!isLoggedIn){
    return  <Navigate to={redirectPath} replace />;
  }
  return children;
}

export default ProtectedRoute
</code>```

Here you can see the logs that are displayed:

The problem is that my function goes to Layout and ProtectedRoute components before useEffect hook in in React context, so it redirects the user to the signup page every time even if he already signed up.  Does anyone has an idea what I am doing wrong?

Body:
I have a problem with react context and react router. I have implemented following  auth context:

import { useState, createContext, useContext, useEffect } from "react";
import { app} from "../firebase/config";
import { onAuthStateChanged } from "@firebase/auth";
import { getAuth } from "@firebase/auth";
import { Navigate
 } from "react-router-dom";

export const FirebaseContext = createContext({
  user: null,
  isLoggedIn: false,
  token: "",
});

export function FirebaseAuthProvider({ children }) {
  const [user, setUser] = useState(null);
  const [token, setToken] = useState(null);
  console.log("In context");

  useEffect(() => {
    console.log("Before auth")
    const auth = getAuth(app);
    console.log("In use effect");
    auth.onAuthStateChanged(async (user) => {
      if (user) {
        console.log("User", user);
        setUser(user);
        const token = await user.getIdToken();
        setToken(token);
        console.log("Token", token)
      } else {
       return <Navigate to="/login" />
      }
    });
    console.log("End of useEffect");
  }, []);
  const contextValue = {
    user: user,
    isLoggedIn: !!token,
    token: token,
  };
  return (
    <FirebaseContext.Provider value={{contextValue}}>
      {children}
    </FirebaseContext.Provider>
  );
}

And this is my app.js:

import "./App.css";
import { FirebaseAuthProvider, FirebaseContext } from "./context/firebaseContext";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import Layout from "./components/Layout/layout";
import HomePage from "./pages/homepage";
import NoPage from "./pages/404";
import SignInPage from "./pages/signin";
import ProtectedRoute from "./components/protectedRoute";

function App() {

  return (
    <FirebaseAuthProvider >
      <BrowserRouter>
        <Routes>
          <Route path="/" element={<Layout />}>
            <Route index element={<ProtectedRoute><HomePage /></ProtectedRoute>} />
            {/*       <Route path="blogs" element={<Blogs />} />*/}
            <Route path="signin" element={<SignInPage />} />
            <Route path="*" element={<NoPage />} />
          </Route>
        </Routes>
      </BrowserRouter>
    </FirebaseAuthProvider>
  );
}

export default App;

Here is the protectedRoute.js:

import React, { useContext } from 'react'
import { FirebaseContext } from '../context/firebaseContext'
import { Navigate } from 'react-router-dom';
function ProtectedRoute({
  redirectPath = '/signin',
  children,
}) {

  const {user, isLoggedIn} = useContext(FirebaseContext);
  console.log("isLoged", isLoggedIn, user);
  if (!isLoggedIn){
    return  <Navigate to={redirectPath} replace />;
  }
  return children;
}

export default ProtectedRoute

Here you can see the logs that are displayed:

The problem is that my function goes to Layout and ProtectedRoute components before useEffect hook in in React context, so it redirects the user to the signup page every time even if he already signed up.  Does anyone has an idea what I am doing wrong?