问:
unity gradle build failed could not resolve launcher:classpath
When i want to build project in unity 2020.2.7 I see some error in building gradle as shown here:

```<code>Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':launcher'.
> Could not resolve all artifacts for configuration ':launcher:classpath'.
   > Could not find gradle.jar (com.android.tools.build:gradle:3.6.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.6.0/gradle-3.6.0.jar
   > Could not find builder.jar (com.android.tools.build:builder:3.6.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.6.0/builder-3.6
</code>```

I tick the custom build gradle template in player Setting and changed the
classpath com.android.tools.build:gradle:5.6.4 as I use the unity 2020.2.7 but it doesn't solve the problem.

Added the JAVA_HOME in Environment variable and I use jdk 1.8.291. Can anyone help me?

Body:
When i want to build project in unity 2020.2.7 I see some error in building gradle as shown here:

Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':launcher'.
> Could not resolve all artifacts for configuration ':launcher:classpath'.
   > Could not find gradle.jar (com.android.tools.build:gradle:3.6.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.6.0/gradle-3.6.0.jar
   > Could not find builder.jar (com.android.tools.build:builder:3.6.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.6.0/builder-3.6

I tick the custom build gradle template in player Setting and changed the
classpath com.android.tools.build:gradle:5.6.4 as I use the unity 2020.2.7 but it doesn't solve the problem.

Added the JAVA_HOME in Environment variable and I use jdk 1.8.291. Can anyone help me?


来源: stackexchange

问:
In Salesforce Classic using url hack button field is not prepopulating if its not added on Page layout, If its present on page layout its populating
{!IF($User.UIThemeDisplayed="Theme4d",
URLFOR('/lightning/o/Opportunity/new?defaultFieldValues=AccountId='+Account.Managed_by_Sales_LocationId__c+',BSL_Account_Id__c='+Account.Id+'&recordTypeId=012D00000002rUgIAI&nooverride=true&backgroundContext=/lightning/r/Account/'+Account.Id+'/view'),
URLFOR('/006/e?retURL='+Account.Id+'&recordTypeId=012D00000002rUgIAI&opp4='+Account.Managed_by_Sales_Location__c+'&opp4_lkid='+Account.Managed_by_Sales_LocationId__c+'&00N1x00000WsuhP='+Account.Id+' ')
)}</p>

ContentLicense: CC BY-SA 4.0


问:
How to collect the values of input fields that contain numbers through a table containing dynamic input fields
I have a table that contains a number of input fields that are generated dynamically, I have 2 important input fields of numeric type or of a type that contains numbers only, and I want to collect the values of these two fields through each value that is entered, taking into account that the sum is done automatically in every operation Generate a new dynamic row in the table, and include the output every process generating new rows. Calculate the value automatically and print the result in the input fields below the table.

As in the picture, I want the sum of the fields that contain numbers and print the result in the input fields below the table (the sum of the first input field whose result is printed in the first box and the second in the second input field)
`

```<code><h6>إضافة بيانات الحسابات</h6>
                    <div class="table-responsive">
                    <table style="text-align:center;" id="dynamicAddRemove">
                      <tr style="background-color:#007398;color:white;text-align:center;">
                        <th class="wd-15p fontColor">الحساب</th>
                        <th class="wd-15p fontColor">مدين</th>
                        <th class="wd-15p fontColor">دائن</th>
                        <th class="wd-15p fontColor">وصف</th>
                        <th class="wd-10p fontColor"></th>
                      </tr>
                      <tr>
                      <td class="td"><select class="form-control select_acount js-example-basic-single" name="account[]"required>
                            <option value="">--الحساب--</option>
                            <?php
                            $query = "select * from sah7atmain_acouts WHERE company like '".$multi."'";
                            $result = mysqli_query($con,$query);
                            $data = array();
                            if($result)
                            {
                              while($row = mysqli_fetch_assoc($result)){
                              $data[] = $row;
                            ?>
                            <?php echo '<option value="'.$row['acount_mounte'].'">'.$row['acount_name'].'</option>'?>;
                            <?php
                            }
                            } else{
                            }
                            ?>
                            </select>
                          </td>
                        <td class="td"><input type="number" name="debtor[]" id="fname"class="form-control debtor arabicNumbers" onkeydown="return event.keyCode !== 69" required></td>
                        <td class="td"><input type="number" name="creditor[]" id="james" class="form-control creditor arabicNumbers" onkeydown="return event.keyCode !== 69" required></td>
                        <td class="td"><input type="text"  name="description[]" class="form-control"  required></td>
                        <td> <input type="text" name="mount[]" class="form-control mount"   required> </td>
                        <td class="td2"><button type="button" name="add" id="add-btn" class="btn btn-success"><i class="fas fa-plus"></i></button></td>
                      </tr>
                    </table>
                    <hr>
                    <div class="input-group">
                    <span class="input-group-text" style="background-color:#1694CA;color:white;">المجموع</span>
                    <span class="input-group-text">مدين</span>
                  <input type="text" aria-label="First name" style="border:0;"class="form-control"  readonly onkeypress="return false;">
                  <span class="input-group-text">دائن</span>
                  <input type="text" aria-label="Last name" style="border:0;" class="form-control" onkeypress="return false;" readonly>
                  </div>
                  </div>
                    </div>
</code>```

```<code><script>
  var data = <?php echo json_encode($data); ?>;
      var product_dd = "";
          product_dd += '<select class="form-control select_acount" name="account[]"required>';
          product_dd += '<option value="">--الحساب--</option>';
      if(data.length > 0){
        for(let i = 0; i < data.length; i ++) {
          product_dd += `<option value="${data[i]['acount_mounte']}">${data[i]['acount_name']}</option>`;
        }
      }
         product_dd += "</select>";

      var i = 0;
      $("#add-btn").click(function() {
        ++i;

        $("#dynamicAddRemove").append('<tr><td class="td">'+product_dd+'</td> <td class="td"><input type="number" name="debtor[' + i + ']" id="fname"class="form-control debtor arabicNumbers" onkeydown="return event.keyCode !== 69" required></td> <td class="td"><input type="number" name="creditor[' + i + ']" id="james" class="form-control creditor arabicNumbers" onkeydown="return event.keyCode !== 69" required></td> <td class="td"><input type="text"  name="description[' + i + ']" class="form-control"  required></td> <td> <input type="text" name="mount[' + i + ']" class="form-control mount" required></td><td class="td2"><button type="button" name="add" class="btn btn-danger remove-tr"><i class="fas fa-trash" ></i></button></td></tr>');
      });
      $(document).on('click', '.remove-tr', function() {
        $(this).parents('tr').remove();
      });
</script>
</code>```

`

Body:
I have a table that contains a number of input fields that are generated dynamically, I have 2 important input fields of numeric type or of a type that contains numbers only, and I want to collect the values of these two fields through each value that is entered, taking into account that the sum is done automatically in every operation Generate a new dynamic row in the table, and include the output every process generating new rows. Calculate the value automatically and print the result in the input fields below the table.

As in the picture, I want the sum of the fields that contain numbers and print the result in the input fields below the table (the sum of the first input field whose result is printed in the first box and the second in the second input field)
`

إضافة بيانات الحسابات

                        الحساب
                        مدين
                        دائن
                        وصف

                      <select class="form-control select_acount js-example-basic-single" name="account[]"required>
                            <option value="">--الحساب--</option>
                            <?php
                            $query = "select * from sah7atmain_acouts WHERE company like '".$multi."'";
                            $result = mysqli_query($con,$query);
                            $data = array();
                            if($result)
                            {
                              while($row = mysqli_fetch_assoc($result)){
                              $data[] = $row;
                            ?>
                            <?php echo '<option value="'.$row['acount_mounte'].'">'.$row['acount_name'].'</option>'?>;
                            <?php
                            }
                            } else{
                            }
                            ?>
                            </select>

                        <input type="number" name="debtor[]" id="fname"class="form-control debtor arabicNumbers" onkeydown="return event.keyCode !== 69" required>
                        <input type="number" name="creditor[]" id="james" class="form-control creditor arabicNumbers" onkeydown="return event.keyCode !== 69" required>
                        <input type="text"  name="description[]" class="form-control"  required>
                         <input type="text" name="mount[]" class="form-control mount"   required>
                        <button type="button" name="add" id="add-btn" class="btn btn-success"></button>

                    المجموع
                    مدين
                  <input type="text" aria-label="First name" style="border:0;"class="form-control"  readonly onkeypress="return false;">
                  دائن
                  <input type="text" aria-label="Last name" style="border:0;" class="form-control" onkeypress="return false;" readonly>

`


问:
mongod.service - MongoDB Database Server - Main PID: 4565 (code=exited, status=48)
my question is similar like this

but all the answer of given here are not working for me ? My  etc/mongod.conf file like this and start the server

```<code>  bindIp: 127.0.0.1,<sameserverIP>,<anotherServerIp>
</code>```

If i run systemctl status mogod i got following response:

```<code>     mongod.service - MongoDB Database Server
     Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2022-12-27 14:12:42 +0545; 2min 36s ago
       Docs: https://docs.mongodb.org/manual
    Process: 5493 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=48)
   Main PID: 5493 (code=exited, status=48)
</code>```

and if i change my etc/mongod.conf file like this and restart server

```<code>  bindIp: 127.0.0.1,<sameserverIP>
</code>```

then the mongodb server will work fine here is the output of systemctl status mongod

```<code> mongod.service - MongoDB Database Server
     Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-12-27 13:47:45 +0545; 10s ago
       Docs: https://docs.mongodb.org/manual
   Main PID: 4608 (mongod)
     Memory: 211.8M
     CGroup: /system.slice/mongod.service
             └─4608 /usr/bin/mongod --config /etc/mongod.conf
</code>```

I tried checking journal also using this command journalctl -u mongod

```<code>Dec 27 14:12:42 178-79-149-108.ip.linodeusercontent.com systemd[1]: Started MongoDB Database Server.
Dec 27 14:12:42 178-79-149-108.ip.linodeusercontent.com systemd[1]: mongod.service: Main process exited, code=exited, status=48/n/a
Dec 27 14:12:42 178-79-149-108.ip.linodeusercontent.com systemd[1]: mongod.service: Failed with result 'exit-code'.
</code>```

This mongo server is installed in linode ubuntu 2020.04 lts from linode marketplace and mongodb version is 5.0.14. i want to give access to only 4 ipaddress in this mongodb can any one help me fix this issue?

Body:
my question is similar like this

but all the answer of given here are not working for me ? My  etc/mongod.conf file like this and start the server

  bindIp: 127.0.0.1,<sameserverIP>,<anotherServerIp>

If i run systemctl status mogod i got following response:

     mongod.service - MongoDB Database Server
     Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2022-12-27 14:12:42 +0545; 2min 36s ago
       Docs: https://docs.mongodb.org/manual
    Process: 5493 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=48)
   Main PID: 5493 (code=exited, status=48)

and if i change my etc/mongod.conf file like this and restart server

  bindIp: 127.0.0.1,<sameserverIP>

then the mongodb server will work fine here is the output of systemctl status mongod

 mongod.service - MongoDB Database Server
     Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-12-27 13:47:45 +0545; 10s ago
       Docs: https://docs.mongodb.org/manual
   Main PID: 4608 (mongod)
     Memory: 211.8M
     CGroup: /system.slice/mongod.service
             └─4608 /usr/bin/mongod --config /etc/mongod.conf

I tried checking journal also using this command journalctl -u mongod

Dec 27 14:12:42 178-79-149-108.ip.linodeusercontent.com systemd[1]: Started MongoDB Database Server.
Dec 27 14:12:42 178-79-149-108.ip.linodeusercontent.com systemd[1]: mongod.service: Main process exited, code=exited, status=48/n/a
Dec 27 14:12:42 178-79-149-108.ip.linodeusercontent.com systemd[1]: mongod.service: Failed with result 'exit-code'.

This mongo server is installed in linode ubuntu 2020.04 lts from linode marketplace and mongodb version is 5.0.14. i want to give access to only 4 ipaddress in this mongodb can any one help me fix this issue?


问:
RStudio Server cannot connect to R ression | Docker, rocker/rstudio
I'm not an expert at docker and linux systems. I want to install a RStudio Server for my ubuntu machine.

When I run the following code on my terminal, rstudio server works on 8787 port. However, rstudio server shows me a login page.

docker run --rm -ti -p 8787:8787 rocker/rstudio

Default username is "rstudio" and after docker run, as you can see on the terminal it gives us a password for login page.

"The password is set to ohSooroh9ohg4Iet"

enter image description here

I enter my username as "rstudio" and password as "ohSooroh9ohg4Iet" correctly, but the server cannot connect to R ression. I couldn't find a solution for this problem.

enter image description here
enter image description here

Thanks for your help.


问:
Micronaut: JPA batch update operations is not working for postgresql
I'm trying to run batch operations in my Micronaut app.

Currently, I can run insert operations in batch (with reWriteBatchedInserts option activated) but the configuration is not working for updates.

Something special about my app is that I want to set the id manually.

This is my entity:

```<code>@Data
@Entity
@SuperBuilder
@NoArgsConstructor
@Table(name = "PRODUCT")
public class ArticleItem implements Cloneable, Serializable {
    @Id
    @Column
    private Long id;
</code>```

The service:

```<code>@Singleton
@Slf4j
public class ArticleServiceImpl implements ArticleService {

    @Transactional
    public List<GenericSingleResponse> internalSaveArticles(
            List<ArticleItem> articleItemList,
            Integer erp, String traceId, String json
            ) {
        articlePort.saveAll(insertList);
</code>```

The port:

```<code>@Singleton
public class ArticlePortImpl implements ArticlePort {

    private final EntityManager entityManager;

    @Transactional
    public void updateAll(List<ArticleItem> articleItemList) {
        articleItemList.forEach(f -> entityManager.merge(f));
    }

</code>```

The configuration:

```<code>datasources:
  default:
    url: jdbc:postgresql://localhost:5432/postgres?reWriteBatchedInserts=true

jpa:
  default:
    properties:
      hibernate:
        hbm2ddl:
          auto: none
        jdbc:
          batch_size: 100
          batch_versioned_data: true
        order_inserts: true
        order_updates: true
        batch_versioned_data: true
        show_sql: false
        id:
          optimizer:
            pooled:
              preferred: pooled-lo
</code>```

Body:
I'm trying to run batch operations in my Micronaut app.

Currently, I can run insert operations in batch (with reWriteBatchedInserts option activated) but the configuration is not working for updates.

Something special about my app is that I want to set the id manually.

This is my entity:

@Data
@Entity
@SuperBuilder
@NoArgsConstructor
@Table(name = "PRODUCT")
public class ArticleItem implements Cloneable, Serializable {
    @Id
    @Column
    private Long id;

The service:

@Singleton
@Slf4j
public class ArticleServiceImpl implements ArticleService {

    @Transactional
    public List<GenericSingleResponse> internalSaveArticles(
            List<ArticleItem> articleItemList,
            Integer erp, String traceId, String json
            ) {
        articlePort.saveAll(insertList);

The port:

@Singleton
public class ArticlePortImpl implements ArticlePort {

    private final EntityManager entityManager;

    @Transactional
    public void updateAll(List<ArticleItem> articleItemList) {
        articleItemList.forEach(f -> entityManager.merge(f));
    }

The configuration:

datasources:
  default:
    url: jdbc:postgresql://localhost:5432/postgres?reWriteBatchedInserts=true

jpa:
  default:
    properties:
      hibernate:
        hbm2ddl:
          auto: none
        jdbc:
          batch_size: 100
          batch_versioned_data: true
        order_inserts: true
        order_updates: true
        batch_versioned_data: true
        show_sql: false
        id:
          optimizer:
            pooled:
              preferred: pooled-lo


问:
Splitting gradle release tasks
In my jenkins pipeline, I want to split gradle release tasks in two separates stages, such way like this :

Part 1 : gradle release : all tasks except updateVersion, commitNewVersion

Other processing

Part 2 : gradle release:updateVersion, release:commitNewVersion

In want to have something like this, in my pipeline :

```<code>stage('release') {
 sh "./gradlew release -x release:updateVersion -x release:commitNewVersion"
}
stage('process') {
 ...
}
stage('init new version') {
 sh "./gradlew release:updateVersion  release:commitNewVersion"
}
</code>```

Is there a clean way to do that ?

Title: Splitting gradle release tasks

Body:
In my jenkins pipeline, I want to split gradle release tasks in two separates stages, such way like this :

Part 1 : gradle release : all tasks except updateVersion, commitNewVersion

Other processing

Part 2 : gradle release:updateVersion, release:commitNewVersion

In want to have something like this, in my pipeline :

stage('release') {
 sh "./gradlew release -x release:updateVersion -x release:commitNewVersion"
}
stage('process') {
 ...
}
stage('init new version') {
 sh "./gradlew release:updateVersion  release:commitNewVersion"
}

Is there a clean way to do that ?


问:
executing create plpgsql function in vscode runs properly only if selecting the all function definition lines
I'm using vscode version 1.74.2 with SQLTools extension v0.26.0 in order to work with a postgresql 15 database.

when i'm writing a plpgsql function, the editor marks in color the function besides the last line of END $$ LANGUAGE plpgsql.

SQLTools provides the shortcut called SQLTools Connection: Run current query

i can't use it because i get unterminated quoted string error.

as you can see in the following screenshot it marks only the 3 first lines when i go with the keyboard cursor over the function definition:

so when I try to execute the run current query shortcut i get the following error:

```<code>unterminated dollar-quoted string at or near "$$
BEGIN
 return query select 1::int;" at character 61
</code>```

of course if i manually mark all the 4 lines and then run the query it creates the function properly, but this is very annoying since this is an example and i deal with complex functions and to start marking all of them in order to execute them each time is a hassle.

any ideas how i can resolve this ?

Body:
I'm using vscode version 1.74.2 with SQLTools extension v0.26.0 in order to work with a postgresql 15 database.

when i'm writing a plpgsql function, the editor marks in color the function besides the last line of END $$ LANGUAGE plpgsql.

SQLTools provides the shortcut called SQLTools Connection: Run current query

i can't use it because i get unterminated quoted string error.

as you can see in the following screenshot it marks only the 3 first lines when i go with the keyboard cursor over the function definition:

so when I try to execute the run current query shortcut i get the following error:

unterminated dollar-quoted string at or near "$$
BEGIN
 return query select 1::int;" at character 61

of course if i manually mark all the 4 lines and then run the query it creates the function properly, but this is very annoying since this is an example and i deal with complex functions and to start marking all of them in order to execute them each time is a hassle.

any ideas how i can resolve this ?


问:
How to hide splash screen once images are loaded
I am using expo and want to show the splash screen until images are all loaded. I am loading images from a url.

What is supposed to happen is when onLoad is called, numberOfImagesLoaded increases by 1, and useAppIsReady is run again. Then there is a check

const imagesAreLoaded = numberOfImagesLoaded > 2;.

When numberOfImagesLoaded > 2, appIsReady is true, then onLayoutRootView gets called and the  splash screen gets hidden.

However, I am not sure why when onLoad is called, numberOfImagesLoaded in useAppIsReady does not seem to increase.

App.js

```<code>import { StatusBar } from "expo-status-bar";
import { Image, StyleSheet, Text, View } from "react-native";
import { useFonts } from "expo-font";
import * as SplashScreen from "expo-splash-screen";
import React, { useCallback, useState } from "react";
import useAppIsReady from "./useAppIsReady";
import data from "./data";

SplashScreen.preventAutoHideAsync();

export default function App() {
  const [numberOfImagesLoaded, setNumberOfImagesLoaded] = useState(0);

  const appIsReady = useAppIsReady(numberOfImagesLoaded);

  const onLayoutRootView = useCallback(async () => {
    if (appIsReady) {
      await SplashScreen.hideAsync();
    }
  }, [appIsReady]);

  if (!appIsReady) {
    return null;
  }

  return (
    <View onLayout={onLayoutRootView} style={styles.container}>
      <Text>Open up App.js to start working on your app!</Text>
      <Images setNumberOfImagesLoaded={setNumberOfImagesLoaded} />
      <StatusBar style="auto" />
    </View>
  );
}
const Images = ({ setNumberOfImagesLoaded }) => {
  return (
    <>
      {data.map(({ imgSrc }) => {
        return (
          <MyImage
            key={imgSrc}
            imgSrc={imgSrc}
            setNumberOfImagesLoaded={setNumberOfImagesLoaded}
          />
        );
      })}
    </>
  );
};

const MyImage = ({ imgSrc, setNumberOfImagesLoaded }) => {
  const onLoad = () => {
    setNumberOfImagesLoaded((prev) => prev + 1);
  };
  return (
    <Image source={{ uri: imgSrc }} style={styles.image} onLoad={onLoad} />
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center",
  },
  image: {
    flex: 1,
    width: "100%",
  },
});
</code>```

useAppIsReady.js

```<code>import { useFonts } from "expo-font";
import * as SplashScreen from "expo-splash-screen";
import React, { useState, useCallback } from "react";

const useAppIsReady = (numberOfImagesLoaded) => {
  const [appIsReady, setAppIsReady] = useState(false);

  // Load fonts

  const baseAssetsPath = "./assets/fonts";

  const fonts_by_path = {
    "DMSans-Regular": require(`${baseAssetsPath}/DMSans-Regular.ttf`),
    "DMSans-Bold": require(`${baseAssetsPath}/DMSans-Bold.ttf`),
    "DMSans-BoldItalic": require(`${baseAssetsPath}/DMSans-BoldItalic.ttf`),
    "DMSans-Medium": require(`${baseAssetsPath}/DMSans-Medium.ttf`),
    "DMSans-MediumItalic": require(`${baseAssetsPath}/DMSans-MediumItalic.ttf`),
    "DMSans-Italic": require(`${baseAssetsPath}/DMSans-Italic.ttf`),
  };

  const [fontsLoaded] = useFonts(fonts_by_path);

  // Load images

  console.log(numberOfImagesLoaded);

  const imagesAreLoaded = numberOfImagesLoaded > 2;

  // const imagesAreLoaded = true;

  if (fontsLoaded && imagesAreLoaded && !appIsReady) {
    setAppIsReady(true);
  }

  return appIsReady;
};

export default useAppIsReady;
</code>```

Here is a link to the repo
https://github.com/Bijig0/loading-imgs-testing

Body:
I am using expo and want to show the splash screen until images are all loaded. I am loading images from a url.

What is supposed to happen is when onLoad is called, numberOfImagesLoaded increases by 1, and useAppIsReady is run again. Then there is a check

const imagesAreLoaded = numberOfImagesLoaded > 2;.

When numberOfImagesLoaded > 2, appIsReady is true, then onLayoutRootView gets called and the  splash screen gets hidden.

However, I am not sure why when onLoad is called, numberOfImagesLoaded in useAppIsReady does not seem to increase.

App.js

import { StatusBar } from "expo-status-bar";
import { Image, StyleSheet, Text, View } from "react-native";
import { useFonts } from "expo-font";
import * as SplashScreen from "expo-splash-screen";
import React, { useCallback, useState } from "react";
import useAppIsReady from "./useAppIsReady";
import data from "./data";

SplashScreen.preventAutoHideAsync();

export default function App() {
  const [numberOfImagesLoaded, setNumberOfImagesLoaded] = useState(0);

  const appIsReady = useAppIsReady(numberOfImagesLoaded);

  const onLayoutRootView = useCallback(async () => {
    if (appIsReady) {
      await SplashScreen.hideAsync();
    }
  }, [appIsReady]);

  if (!appIsReady) {
    return null;
  }

  return (
    <View onLayout={onLayoutRootView} style={styles.container}>
      <Text>Open up App.js to start working on your app!</Text>
      <Images setNumberOfImagesLoaded={setNumberOfImagesLoaded} />
      <StatusBar style="auto" />
    </View>
  );
}
const Images = ({ setNumberOfImagesLoaded }) => {
  return (
    <>
      {data.map(({ imgSrc }) => {
        return (
          <MyImage
            key={imgSrc}
            imgSrc={imgSrc}
            setNumberOfImagesLoaded={setNumberOfImagesLoaded}
          />
        );
      })}
    </>
  );
};

const MyImage = ({ imgSrc, setNumberOfImagesLoaded }) => {
  const onLoad = () => {
    setNumberOfImagesLoaded((prev) => prev + 1);
  };
  return (
    <Image source={{ uri: imgSrc }} style={styles.image} onLoad={onLoad} />
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center",
  },
  image: {
    flex: 1,
    width: "100%",
  },
});

useAppIsReady.js

import { useFonts } from "expo-font";
import * as SplashScreen from "expo-splash-screen";
import React, { useState, useCallback } from "react";

const useAppIsReady = (numberOfImagesLoaded) => {
  const [appIsReady, setAppIsReady] = useState(false);

  // Load fonts

  const baseAssetsPath = "./assets/fonts";

  const fonts_by_path = {
    "DMSans-Regular": require(`${baseAssetsPath}/DMSans-Regular.ttf`),
    "DMSans-Bold": require(`${baseAssetsPath}/DMSans-Bold.ttf`),
    "DMSans-BoldItalic": require(`${baseAssetsPath}/DMSans-BoldItalic.ttf`),
    "DMSans-Medium": require(`${baseAssetsPath}/DMSans-Medium.ttf`),
    "DMSans-MediumItalic": require(`${baseAssetsPath}/DMSans-MediumItalic.ttf`),
    "DMSans-Italic": require(`${baseAssetsPath}/DMSans-Italic.ttf`),
  };

  const [fontsLoaded] = useFonts(fonts_by_path);

  // Load images

  console.log(numberOfImagesLoaded);

  const imagesAreLoaded = numberOfImagesLoaded > 2;

  // const imagesAreLoaded = true;

  if (fontsLoaded && imagesAreLoaded && !appIsReady) {
    setAppIsReady(true);
  }

  return appIsReady;
};

export default useAppIsReady;

Here is a link to the repo
https://github.com/Bijig0/loading-imgs-testing


问:
Inertia.js and scroll management of scrollable divs
I think I may misunderstand scroll management with Inertia.js and scrollable divs.
Maybe somebody can point me in the right direction.

I started off without scrollable divs. And using "preserve-scroll" on links works fine and remembers the scroll position in the document body.

Then I switched to a new layout where the height is always 100% of the screen.
And the logical columns of the application scroll automatically vertically. Slack-app style.

Clicking on Inertia links with preserve-scroll now does not restore the scroll position of the scrollable elements.

I tried a couple of things like using "scroll-region" but in the documentation it sounds as if scroll-region is not meant for preserving the scroll position but for resetting it.

This is a simplified example of my code (with Vue and Tailwind):

<template>

        <Link href="/" class="block" preserve-scroll>{{ item }}</Link>

        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin nec
        interdum turpis. Curabitur et lectus mollis libero placerat hendrerit
        eget vel ipsum. Morbi eu diam id justo interdum condimentum a vel dolor.
        In hac habitasse platea dictumst. Etiam imperdiet dolor laoreet placerat
        laoreet. Nulla erat lacus, facilisis quis nulla in, dignissim lobortis
        augue. Cras viverra diam diam, et commodo augue rhoncus non. Vestibulum
        pretium luctus justo, at lobortis odio vestibulum sed. Nulla facilisi.

</template>

```

I also tried to add "scroll-region" to the "ul" tag.
Using "preserve-state" in the s kind of does the trick but I would like to only preserve the scroll positions of all the scrollable elements after any click.

Any tipps appreciated.

Body:
I think I may misunderstand scroll management with Inertia.js and scrollable divs.
Maybe somebody can point me in the right direction.

I started off without scrollable divs. And using "preserve-scroll" on links works fine and remembers the scroll position in the document body.

Then I switched to a new layout where the height is always 100% of the screen.
And the logical columns of the application scroll automatically vertically. Slack-app style.

Clicking on Inertia links with preserve-scroll now does not restore the scroll position of the scrollable elements.

I tried a couple of things like using "scroll-region" but in the documentation it sounds as if scroll-region is not meant for preserving the scroll position but for resetting it.

This is a simplified example of my code (with Vue and Tailwind):

<template>

        <Link href="/" class="block" preserve-scroll>{{ item }}</Link>

        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin nec
        interdum turpis. Curabitur et lectus mollis libero placerat hendrerit
        eget vel ipsum. Morbi eu diam id justo interdum condimentum a vel dolor.
        In hac habitasse platea dictumst. Etiam imperdiet dolor laoreet placerat
        laoreet. Nulla erat lacus, facilisis quis nulla in, dignissim lobortis
        augue. Cras viverra diam diam, et commodo augue rhoncus non. Vestibulum
        pretium luctus justo, at lobortis odio vestibulum sed. Nulla facilisi.

</template>

I also tried to add "scroll-region" to the "ul" tag.
Using "preserve-state" in the s kind of does the trick but I would like to only preserve the scroll positions of all the scrollable elements after any click.

Any tipps appreciated.


问:
Selenium IDE: cannot assert Javascript allert
I am trying to test a website with Selenium for a course project. One of my test cases is attempting to add a book to a favourites list when the user hasn't logged in. In this case, I need to assert an alert, displaying a warning message. However, Selenium cannot detect the Javascript alert. The test gets stuck on the assert alert command.
I tried the following:

restarting Selenium IDE

different browsers: Vivaldi, Firefox

adding a pause command before the assert alert

adding \n symbols in the beginning and/or end of the alert text

I noticed that if I run the test automatically until it gets stuck, then manually close the allert and then press the "Add to favourites" button to spawn it again, Selenium manages to detect it.

My code on this test:

The Javascript alert I have to assert:

I apologise for the foreign language of the website. I already tried testing a website in English, which went even worse, because Selenium couldn't detect clicking on an <input type="button">


问:
How to hide marker of another side
We are trying add a marker as dynamically in model. The marker is a html.
But this marker shows in all side even though model is rotated. We hope to hide if model shows other side that has nothing marker.

https://user-images.githubusercontent.com/87656984/209636203-4fdf0b48-7472-4a38-9324-110d7d7e513d.png
https://user-images.githubusercontent.com/87656984/209636301-bfe21705-017f-4324-bafd-9a33aadf25b5.png

Thanks in advance

```<code><Canvas dpr={[1, 2]}>
      <ambientLight intensity={0.4}/>
      {markerList.map((lump, index) => (
          <>
              <Marker
                  key={index}
                  name='Marker'
                  position={[lump.posX, lump.posY, lump.posZ]}
              />
          </>
      ))}
      <DogModel/>
      <mesh
          onDoubleClick={e => {
          }}
          scale={[2, 200, 2.8]}
          position={[-0.9, 4, 0]}
          visible={true}
      >
          <boxGeometry/>
          <meshPhongMaterial color='royalblue' transparent opacity={0}/>
      </mesh>
      <PerspectiveCamera
          makeDefault
          ref={camera}
          position={[200, 0, 0]}
          zoom={window.innerWidth > 640 ? 15 : 10}
          fov={40}
      />
      <OrbitControls
          ref={orbit}
          target={[0, 1, 0]}
          enableRotate={true}
          minDistance={7}
          maxDistance={100}
          minPolarAngle={0}
          maxPolarAngle={Math.PI / 1.75}
          touches={{
              ONE: THREE.TOUCH.ROTATE,
              TWO: THREE.TOUCH.DOLLY_PAN
          }}
      />
    <Environment files="/old_depot_2k.hdr" ground={{height: '100%', radius: 130}}/>
</Canvas>
</code>```

marker code is below

```<code><mesh name={name}>
    <Html sprite position={[position[0], position[1], position[2]]}>
        <div
            id={'marker'}
            style={{display: status ? 'block' : 'none'}}
        >
            <Button.Ripple
                onPointerUp={setButtonAction}
                color='primary'
                className='btn-icon rounded-circle'>
                    <span className='TextWhite'>
                        <Plus size={16}/>
                    </span>
            </Button.Ripple>
        </div>
    </Html>
</mesh>
</code>```

Title: How to hide marker of another side

Body:
We are trying add a marker as dynamically in model. The marker is a html.
But this marker shows in all side even though model is rotated. We hope to hide if model shows other side that has nothing marker.

https://user-images.githubusercontent.com/87656984/209636203-4fdf0b48-7472-4a38-9324-110d7d7e513d.png
https://user-images.githubusercontent.com/87656984/209636301-bfe21705-017f-4324-bafd-9a33aadf25b5.png

Thanks in advance

<Canvas dpr={[1, 2]}>
      <ambientLight intensity={0.4}/>
      {markerList.map((lump, index) => (
          <>
              <Marker
                  key={index}
                  name='Marker'
                  position={[lump.posX, lump.posY, lump.posZ]}
              />
          </>
      ))}
      <DogModel/>
      <mesh
          onDoubleClick={e => {
          }}
          scale={[2, 200, 2.8]}
          position={[-0.9, 4, 0]}
          visible={true}
      >
          <boxGeometry/>
          <meshPhongMaterial color='royalblue' transparent opacity={0}/>
      </mesh>
      <PerspectiveCamera
          makeDefault
          ref={camera}
          position={[200, 0, 0]}
          zoom={window.innerWidth > 640 ? 15 : 10}
          fov={40}
      />
      <OrbitControls
          ref={orbit}
          target={[0, 1, 0]}
          enableRotate={true}
          minDistance={7}
          maxDistance={100}
          minPolarAngle={0}
          maxPolarAngle={Math.PI / 1.75}
          touches={{
              ONE: THREE.TOUCH.ROTATE,
              TWO: THREE.TOUCH.DOLLY_PAN
          }}
      />
    <Environment files="/old_depot_2k.hdr" ground={{height: '100%', radius: 130}}/>
</Canvas>

marker code is below

<mesh name={name}>

            <Button.Ripple
                onPointerUp={setButtonAction}
                color='primary'
                className='btn-icon rounded-circle'>

                        <Plus size={16}/>

            </Button.Ripple>

</mesh>


问:
Getting webpack error after upgrading my project from angular 5 to 10
`Getting this error:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

configuration.module.rules[8].rules[2] should be an object.
-> A rule
error Command failed with exit code 1.

I want when I run this command it should pass the build as it was happening when I was using angular 5.

```<code>yarn run webpack -- --config webpack/webpack.dev.js
</code>```
```<code>
> Here is my webpack config file

</code>```
```<code>module.exports = webpackMerge(commonConfig({ env: ENV }), {
    devtool: 'eval-source-map',
    devServer: {
        inline: false,
        contentBase: './build/www',
        proxy: [{
            context: [
                /* jhipster-needle-add-entity-to-webpack - JHipster will add entity api paths here */
                '/api',
                '/management',
                '/swagger-resources',
                '/v2/api-docs',
                '/h2-console',
                '/auth'
            ],
            target: 'http://127.0.0.1:8080',
            secure: false
        }],
        watchOptions: {
            ignored: /node_modules/
        }
    },
    entry: {
        polyfills: './src/main/webapp/app/polyfills',
        global: './src/main/webapp/content/css/global.css',
        main: './src/main/webapp/app/app.main'
    },
    output: {
        path: utils.root('build/www'),
        filename: 'app/[name].[hash].bundle.js',
        chunkFilename: 'app/[id].[hash].chunk.js'
    },
    module: {
        rules: [{
            test: /\.ts$/,
            enforce: 'pre',
            rules: 'tslint-loader',
            exclude: ['node_modules', new RegExp('reflect-metadata\\' + path.sep + 'Reflect\\.ts')]
        },
        {
            test: /\.ts$/,
            use: [
                { loader: 'angular2-template-loader' },
                { loader: 'cache-loader' },
                {
                    loader: 'thread-loader',
                    options: {
                        // there should be 1 cpu for the fork-ts-checker-webpack-plugin
                        workers: require('os').cpus().length - 1
                    }
                },
                {
                    loader: 'ts-loader',
                    options: {
                        transpileOnly: true,
                        happyPackMode: true
                    }
                },
                { loader: 'angular-router-loader' }
            ],
            exclude: ['node_modules']
        },
        {
            test: /\.scss$/,
            exclude: /node_modules/,
            use: [{loader: "to-string-loader"},{loader: "style-loader"},{loader: "css-loader"}, {loader: "sass-loader"}],
        },
        {
            test: /\.css$/,
            rules: ['to-string-loader', 'css-loader'],
            exclude: /(vendor\.css|global\.css)/
        },
        {
            test: /(vendor\.css|global\.css)/,
            rules: ['to-string-loader','style-loader', 'css-loader']
        }]
    },
    plugins: [
        new ForkTsCheckerWebpackPlugin(),
        new BrowserSyncPlugin({
            host: 'localhost',
            port: 9000,
            proxy: {
                target: 'http://localhost:9060'
            }
        }, {
            reload: false
        }),
        new webpack.ContextReplacementPlugin(
            /angular(\\|\/)core(\\|\/)/,
            path.resolve(__dirname, './src/main/webapp')
        ),
        new writeFilePlugin(),
        new webpack.WatchIgnorePlugin([
            utils.root('src/test'),
        ]),
        new WebpackNotifierPlugin({
            title: 'JHipster',
            contentImage: path.join(__dirname, 'logo-jhipster.png')
        })
    ],
    mode: 'development'
});
</code>```
```<code>
</code>```

`

Body:
`Getting this error:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

configuration.module.rules[8].rules[2] should be an object.
-> A rule
error Command failed with exit code 1.

I want when I run this command it should pass the build as it was happening when I was using angular 5.

yarn run webpack -- --config webpack/webpack.dev.js

> Here is my webpack config file

module.exports = webpackMerge(commonConfig({ env: ENV }), {
    devtool: 'eval-source-map',
    devServer: {
        inline: false,
        contentBase: './build/www',
        proxy: [{
            context: [
                /* jhipster-needle-add-entity-to-webpack - JHipster will add entity api paths here */
                '/api',
                '/management',
                '/swagger-resources',
                '/v2/api-docs',
                '/h2-console',
                '/auth'
            ],
            target: 'http://127.0.0.1:8080',
            secure: false
        }],
        watchOptions: {
            ignored: /node_modules/
        }
    },
    entry: {
        polyfills: './src/main/webapp/app/polyfills',
        global: './src/main/webapp/content/css/global.css',
        main: './src/main/webapp/app/app.main'
    },
    output: {
        path: utils.root('build/www'),
        filename: 'app/[name].[hash].bundle.js',
        chunkFilename: 'app/[id].[hash].chunk.js'
    },
    module: {
        rules: [{
            test: /\.ts$/,
            enforce: 'pre',
            rules: 'tslint-loader',
            exclude: ['node_modules', new RegExp('reflect-metadata\\' + path.sep + 'Reflect\\.ts')]
        },
        {
            test: /\.ts$/,
            use: [
                { loader: 'angular2-template-loader' },
                { loader: 'cache-loader' },
                {
                    loader: 'thread-loader',
                    options: {
                        // there should be 1 cpu for the fork-ts-checker-webpack-plugin
                        workers: require('os').cpus().length - 1
                    }
                },
                {
                    loader: 'ts-loader',
                    options: {
                        transpileOnly: true,
                        happyPackMode: true
                    }
                },
                { loader: 'angular-router-loader' }
            ],
            exclude: ['node_modules']
        },
        {
            test: /\.scss$/,
            exclude: /node_modules/,
            use: [{loader: "to-string-loader"},{loader: "style-loader"},{loader: "css-loader"}, {loader: "sass-loader"}],
        },
        {
            test: /\.css$/,
            rules: ['to-string-loader', 'css-loader'],
            exclude: /(vendor\.css|global\.css)/
        },
        {
            test: /(vendor\.css|global\.css)/,
            rules: ['to-string-loader','style-loader', 'css-loader']
        }]
    },
    plugins: [
        new ForkTsCheckerWebpackPlugin(),
        new BrowserSyncPlugin({
            host: 'localhost',
            port: 9000,
            proxy: {
                target: 'http://localhost:9060'
            }
        }, {
            reload: false
        }),
        new webpack.ContextReplacementPlugin(
            /angular(\\|\/)core(\\|\/)/,
            path.resolve(__dirname, './src/main/webapp')
        ),
        new writeFilePlugin(),
        new webpack.WatchIgnorePlugin([
            utils.root('src/test'),
        ]),
        new WebpackNotifierPlugin({
            title: 'JHipster',
            contentImage: path.join(__dirname, 'logo-jhipster.png')
        })
    ],
    mode: 'development'
});

`


问:
automatic Facebook activity log clean up with jQuery
I'm trying to use this jQuery to remove some content from facebook but I have a problem.
When I enter the code line by line it works, but when I create a loop it doesn't work.
First I check all the checkboxes and then click on remove, a pop up appears and wants me to confirm the removal with another Remove button.

```<code>setInterval(() => { for (const Button of
document.querySelectorAll('input[type=checkbox]')) {{Button.click();
document.querySelector('div[aria-label="Remove"]').click();
document.querySelector('div[aria-label="Remove interaction?"]').querySelector('div[aria-label="Remove"]').click(); } } }, 1000)

</code>```

When I run it line by line it works but the above code always gives "Cannot read properties of null (reading 'querySelector')"

Thanks for any suggestions.

I tried using document.activeElement but that one also didn't work.

Body:
I'm trying to use this jQuery to remove some content from facebook but I have a problem.
When I enter the code line by line it works, but when I create a loop it doesn't work.
First I check all the checkboxes and then click on remove, a pop up appears and wants me to confirm the removal with another Remove button.

setInterval(() => { for (const Button of
document.querySelectorAll('input[type=checkbox]')) {{Button.click();
document.querySelector('div[aria-label="Remove"]').click();
document.querySelector('div[aria-label="Remove interaction?"]').querySelector('div[aria-label="Remove"]').click(); } } }, 1000)

When I run it line by line it works but the above code always gives "Cannot read properties of null (reading 'querySelector')"

Thanks for any suggestions.

I tried using document.activeElement but that one also didn't work.


问:
How to appropriately determine the minPeers in Readiness endpoints of Hyperledger Besu, so as to check a network in DOWN status
Hyperledger Besu Configuration:
6 validator, 3 Tx-nodes

When all the nodes are up, the minPeers connected is 6, for UP status.
When the network is down, what is the optimal minPeers to depict DOWN status.
How is the logic arrived for the minPeers count


问:
NextJS error .next/static/xxx when access with domain
I've tried running in both dev and production mode and it doesn't have any issues when on localhost.

Then I tried to run it on VPS. But a problem arose here. When accessed using http://[my ip address]:[port]/my-slug everything runs normally without any errors. But when I use my domain, some errors appear so the website doesn't run as smoothly as it should.

Console log results

```<code>GET https://mydomain/_next/static/chunks/webpack-87b3a303122f2f0d.js net::ERR_ABORTED 404
GET https://mydomain/_next/static/chunks/framework-114634acb84f8baa.js net::ERR_ABORTED 404
GET https://mydomain/_next/static/chunks/main-9f14b7564a2b343f.js net::ERR_ABORTED 404
GET https://mydomain/_next/static/chunks/153-61ea73dffc04f433.js net::ERR_ABORTED 404
</code>```

Nginx Conf:

```<code>server {
listen 8080;
server_name mydomain www_mydomain;
    location / {
        proxy_pass http://localhost:4040;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}
</code>```

I use varnish with backend 8080, and 4040 it's port from my NextJS

I've tried deleting the .next folder and running npm run build one more time. But still getting error like that.

Body:
I've tried running in both dev and production mode and it doesn't have any issues when on localhost.

Then I tried to run it on VPS. But a problem arose here. When accessed using http://[my ip address]:[port]/my-slug everything runs normally without any errors. But when I use my domain, some errors appear so the website doesn't run as smoothly as it should.

Console log results

GET https://mydomain/_next/static/chunks/webpack-87b3a303122f2f0d.js net::ERR_ABORTED 404
GET https://mydomain/_next/static/chunks/framework-114634acb84f8baa.js net::ERR_ABORTED 404
GET https://mydomain/_next/static/chunks/main-9f14b7564a2b343f.js net::ERR_ABORTED 404
GET https://mydomain/_next/static/chunks/153-61ea73dffc04f433.js net::ERR_ABORTED 404

Nginx Conf:

server {
listen 8080;
server_name mydomain www_mydomain;
    location / {
        proxy_pass http://localhost:4040;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

I use varnish with backend 8080, and 4040 it's port from my NextJS

I've tried deleting the .next folder and running npm run build one more time. But still getting error like that.


问:
How to use boost_pool with std::vector<bool>?
I need to create many objects which all contain a std::vector<bool> of the same size (but the size is known at runtime).

I already use boost_pool for the objects allocations.

What's the right way to use boost_pool for the std::vector<bool> inside the objects to avoid memory fragmentation?


问:
Translate X or left tends to affect the height of absolutely postioned div
I have faced a weird CSS quirk where i am trying to have a full screen Nav for mobile, which works fine until there is some translateX or left:something, on any sibling div/element, the absolutely positioned div heights does not take the full screen especially in mobile devices, here is the code someone can try to see the issue

Note:- do not run the code snippet below as it fails to reproduce the error i am facing, copy and paste the below code in your local machine and then open the responsive window and try to select the phone devices

*,
::after,
::before{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

nav{
    display: flex;
    width: 90%;
    margin: 0 auto;
}

nav>ul {
    display: flex;
    width: 50%;
    justify-content: space-between;

}

nav>ul>li{
    list-style: none;
}

#mobile-nav{
    height: 100vh;
    width: 100vw;
    position: absolute;
    background-color: aquamarine;
    opacity:0.5;
}

section{
    transform: translateX(50%);
    width: 80%;
    height: 100px;
    border: 2px solid red;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./style.css">
    <title>Document</title>
</head>
<body>
    <div id="mobile-nav"></div>
    <nav class="nav">
     <ul>
        <li>Home</li>
        <li>Contact</li>
        <li>Products</li>
        <li>Carrers</li>
        <li>Support</li>
     </ul>
    </nav>
    <section></section>
</body>
</html></code>```

Body:
I have faced a weird CSS quirk where i am trying to have a full screen Nav for mobile, which works fine until there is some translateX or left:something, on any sibling div/element, the absolutely positioned div heights does not take the full screen especially in mobile devices, here is the code someone can try to see the issue

Note:- do not run the code snippet below as it fails to reproduce the error i am facing, copy and paste the below code in your local machine and then open the responsive window and try to select the phone devices

*,
::after,
::before{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

nav{
    display: flex;
    width: 90%;
    margin: 0 auto;
}

nav>ul {
    display: flex;
    width: 50%;
    justify-content: space-between;

}

nav>ul>li{
    list-style: none;
}

#mobile-nav{
    height: 100vh;
    width: 100vw;
    position: absolute;
    background-color: aquamarine;
    opacity:0.5;
}

section{
    transform: translateX(50%);
    width: 80%;
    height: 100px;
    border: 2px solid red;
}

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="./style.css">
    <title>Document</title>

Home

Contact

Products

Carrers

Support


问:
How to make watermark move till the video ends in FFMPEG
am using this command to move watermark around my video. It's working but it only move once around the edges and then desapers

```<code>ffmpeg -i film.mp4 -i logo_white.png -filter_complex "[0][1]overlay=x='0+(t-0)*(W-w)/5':y=0:enable='between(t,0,5)'[img];[img][1]overlay=x=W-w:y='0+(t-5)*(H-h)/5':enable='between(t,5,10)'[img];[img][1]overlay=x=(W-w)-(t-10)*(W-w)/5:y=H-h:enable='between(t,10,15)'[img],[img][1]overlay=x=0:y=(H-h)-(t-15)*(H-h)/5:enable='between(t,15,20)'"  output2.mp4
</code>```

I also tried this command using the -loop tag

```<code>ffmpeg -t 20 -loop 1 -i film.mp4 -i logo_white.png  -loop 0  -filter_complex "[0][1]overlay=x='0+(t-0)*(W-w)/5':y=0:enable='between(t,0,5)'[img];[img][1]overlay=x=W-w:y='0+(t-5)*(H-h)/5':enable='between(t,5,10)'[img];[img][1]overlay=x=(W-w)-(t-10)*(W-w)/5:y=H-h:enable='between(t,10,15)'[img],[img][1]overlay=x=0:y=(H-h)-(t-15)*(H-h)/5:enable='between(t,15,20)'" output2.mp4
</code>```

But it throws an error (option loop not found)

How to repeat the overlay over and over till the video ends?

Body:
am using this command to move watermark around my video. It's working but it only move once around the edges and then desapers

ffmpeg -i film.mp4 -i logo_white.png -filter_complex "[0][1]overlay=x='0+(t-0)*(W-w)/5':y=0:enable='between(t,0,5)'[img];[img][1]overlay=x=W-w:y='0+(t-5)*(H-h)/5':enable='between(t,5,10)'[img];[img][1]overlay=x=(W-w)-(t-10)*(W-w)/5:y=H-h:enable='between(t,10,15)'[img],[img][1]overlay=x=0:y=(H-h)-(t-15)*(H-h)/5:enable='between(t,15,20)'"  output2.mp4

I also tried this command using the -loop tag

ffmpeg -t 20 -loop 1 -i film.mp4 -i logo_white.png  -loop 0  -filter_complex "[0][1]overlay=x='0+(t-0)*(W-w)/5':y=0:enable='between(t,0,5)'[img];[img][1]overlay=x=W-w:y='0+(t-5)*(H-h)/5':enable='between(t,5,10)'[img];[img][1]overlay=x=(W-w)-(t-10)*(W-w)/5:y=H-h:enable='between(t,10,15)'[img],[img][1]overlay=x=0:y=(H-h)-(t-15)*(H-h)/5:enable='between(t,15,20)'" output2.mp4

But it throws an error (option loop not found)

How to repeat the overlay over and over till the video ends?


问:
Classes and methods not getting ignored in Jacoco coverage report
I wrote a custom annotation to ignore classes and methods while generating Jacoco coverage report. Please refer to code below:

```<code>@Target({ElementType.TYPE,ElementType.METHOD,ElementType.CONSTRUCTOR})
public @interface ExcludeFromJacocoGeneratedReport {

}
</code>```

This is working fine in my local but when I am running a Jenkins pipeline, classes and methods marked with this custom annotation are not getting ignored in Jacoco coverage report.

Please guide me if I have missed something or some explicit configuration is required before running jenkins pipeline in this case.

Body:
I wrote a custom annotation to ignore classes and methods while generating Jacoco coverage report. Please refer to code below:

@Target({ElementType.TYPE,ElementType.METHOD,ElementType.CONSTRUCTOR})
public @interface ExcludeFromJacocoGeneratedReport {

}

This is working fine in my local but when I am running a Jenkins pipeline, classes and methods marked with this custom annotation are not getting ignored in Jacoco coverage report.

Please guide me if I have missed something or some explicit configuration is required before running jenkins pipeline in this case.


问:
Aggregation function giving different output in group by and in Subquery
For HR Database,

```<code>select min(salary) from employees group by department_id;
</code>```

is returning 11 rows while,

```<code>select first_name, last_name, salary, department_id
from employees
where salary in (select min(salary) from employees group by department_id);
</code>```

is returning 14 rows with few duplicate department_id with different salaries

Trying to figure out employees with minimum salary in each department

Body:
For HR Database,

select min(salary) from employees group by department_id;

is returning 11 rows while,

select first_name, last_name, salary, department_id
from employees
where salary in (select min(salary) from employees group by department_id);

is returning 14 rows with few duplicate department_id with different salaries

Trying to figure out employees with minimum salary in each department


问:
migrated key loading api's using openssl 3.0.7, failed to give same signing file
migrated key loading api's using openssl 3.0.7, failed to give same signing file.
we are migrating the our application code from openssl 1.1.1q(case 1) to 3.0.7(case 2).
we are trying to sign the same file using above openssl version but migrated code or case2 is we are suspecting a key loading is not proper.
we are fetching n, e , d values from our private key and loading to PKEY in both case 1 and 2.
Please let me know where we missed or any suggestion on key loading part.

case 1:KEY loading using openssl 1.1.1q:where privateModulus and privateExponent are from our private key

```<code>  EVP_PKEY *pk8_key;
  pk8_key = EVP_PKEY_new();
  RSA *rsa = RSA_new();
  BIGNUM *rsa_n, *rsa_e, *rsa_d;

  rsa_n = BN_new();
  rsa_n=BN_bin2bn((const unsigned char*)privateModulus,(int)expModLength,rsa_n);
  if (!(rsa_n))
  {
    throw_exception("Error in assigning modulus(n)");
  }
  rsa_d = BN_new();
  rsa_d=BN_bin2bn((const unsigned char*)privateExponent,(int)expModLength,rsa_d);
  if (!(rsa_d))
  {
    throw_exception("Error in assigning exponent(d)");
  }
  rsa_e = BN_new();
  if(!BN_hex2bn(&rsa_e,"0x03"))
  {
    throw_exception("Error in assigning exponent(d)");
  }
  // Note - memory management of BIGNUMS are transfered and freed with RSA object.
  int ret = RSA_set0_key(rsa,rsa_n,rsa_e,rsa_d);
  if (1 != ret)
  {
    throw_exception("Error creating RSA key from inputs");
  }
  RSA_blinding_off(rsa);

  rsa_assign_status =  EVP_PKEY_assign_RSA(pk8_key, rsa);
</code>```

case2: KEY loading using openssl 3.0.7:where privateModulus and privateExponent are from our private key

```<code>EVP_PKEY* pk8_key = NULL;
  EVP_PKEY_CTX* ctx = NULL;
  BIGNUM* rsa_n =NULL , * rsa_d=NULL;
  OSSL_PARAM* params = NULL;
  OSSL_PARAM_BLD* bld = NULL;
  OSSL_LIB_CTX *libctx = NULL;
  int result = 0,i;
  unsigned int rsa_e = 0;

  rsa_n = BN_new();

  rsa_n=BN_bin2bn((const unsigned char*)privateModulus,(int)expModLength,rsa_n);
  if (!(rsa_n))
  {
    throw_exception("Error in assigning modulus(n)");
  }

  rsa_d = BN_new();
  rsa_d=BN_bin2bn((const unsigned char*)privateExponent,(int)expModLength,rsa_d);
  if (!(rsa_d))
  {
    throw_exception("Error in assigning exponent(d)");
  }

  rsa_e = 0x03;

  bld = OSSL_PARAM_BLD_new();
  OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_RSA_N, rsa_n);
  OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_RSA_D, rsa_d);
  //OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_RSA_E, rsa_e);
  OSSL_PARAM_BLD_push_uint(bld, OSSL_PKEY_PARAM_RSA_E, rsa_e);

  params = OSSL_PARAM_BLD_to_param(bld);

  libctx = OSSL_LIB_CTX_new();
  ctx = EVP_PKEY_CTX_new_from_name( libctx, "RSA", NULL );

  if (ctx == NULL || EVP_PKEY_fromdata_init(ctx) <= 0
      || EVP_PKEY_fromdata(ctx, &pk8_key, EVP_PKEY_KEYPAIR, params) <= 0)
  {
     printf("error");
  }
</code>```

Not sure whether EVP_PKEY_fromdata will assign  params same as EVP_PKEY_assign_RSA api.

we tried to set params different in many ways but not sure whether fromdata will assign params same as assign_rsa api.

we tried to sign the same file using both case and expecting same result but using our new way of constructing key we are unable to get same sign.

Please let us know about our key construction part and for same input file signing should be same or not.

Body:
migrated key loading api's using openssl 3.0.7, failed to give same signing file.
we are migrating the our application code from openssl 1.1.1q(case 1) to 3.0.7(case 2).
we are trying to sign the same file using above openssl version but migrated code or case2 is we are suspecting a key loading is not proper.
we are fetching n, e , d values from our private key and loading to PKEY in both case 1 and 2.
Please let me know where we missed or any suggestion on key loading part.

case 1:KEY loading using openssl 1.1.1q:where privateModulus and privateExponent are from our private key

  EVP_PKEY *pk8_key;
  pk8_key = EVP_PKEY_new();
  RSA *rsa = RSA_new();
  BIGNUM *rsa_n, *rsa_e, *rsa_d;

  rsa_n = BN_new();
  rsa_n=BN_bin2bn((const unsigned char*)privateModulus,(int)expModLength,rsa_n);
  if (!(rsa_n))
  {
    throw_exception("Error in assigning modulus(n)");
  }
  rsa_d = BN_new();
  rsa_d=BN_bin2bn((const unsigned char*)privateExponent,(int)expModLength,rsa_d);
  if (!(rsa_d))
  {
    throw_exception("Error in assigning exponent(d)");
  }
  rsa_e = BN_new();
  if(!BN_hex2bn(&rsa_e,"0x03"))
  {
    throw_exception("Error in assigning exponent(d)");
  }
  // Note - memory management of BIGNUMS are transfered and freed with RSA object.
  int ret = RSA_set0_key(rsa,rsa_n,rsa_e,rsa_d);
  if (1 != ret)
  {
    throw_exception("Error creating RSA key from inputs");
  }
  RSA_blinding_off(rsa);

  rsa_assign_status =  EVP_PKEY_assign_RSA(pk8_key, rsa);

case2: KEY loading using openssl 3.0.7:where privateModulus and privateExponent are from our private key

EVP_PKEY* pk8_key = NULL;
  EVP_PKEY_CTX* ctx = NULL;
  BIGNUM* rsa_n =NULL , * rsa_d=NULL;
  OSSL_PARAM* params = NULL;
  OSSL_PARAM_BLD* bld = NULL;
  OSSL_LIB_CTX *libctx = NULL;
  int result = 0,i;
  unsigned int rsa_e = 0;

  rsa_n = BN_new();

  rsa_n=BN_bin2bn((const unsigned char*)privateModulus,(int)expModLength,rsa_n);
  if (!(rsa_n))
  {
    throw_exception("Error in assigning modulus(n)");
  }

  rsa_d = BN_new();
  rsa_d=BN_bin2bn((const unsigned char*)privateExponent,(int)expModLength,rsa_d);
  if (!(rsa_d))
  {
    throw_exception("Error in assigning exponent(d)");
  }

  rsa_e = 0x03;

  bld = OSSL_PARAM_BLD_new();
  OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_RSA_N, rsa_n);
  OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_RSA_D, rsa_d);
  //OSSL_PARAM_BLD_push_BN(bld, OSSL_PKEY_PARAM_RSA_E, rsa_e);
  OSSL_PARAM_BLD_push_uint(bld, OSSL_PKEY_PARAM_RSA_E, rsa_e);

  params = OSSL_PARAM_BLD_to_param(bld);

  libctx = OSSL_LIB_CTX_new();
  ctx = EVP_PKEY_CTX_new_from_name( libctx, "RSA", NULL );

  if (ctx == NULL || EVP_PKEY_fromdata_init(ctx) <= 0
      || EVP_PKEY_fromdata(ctx, &pk8_key, EVP_PKEY_KEYPAIR, params) <= 0)
  {
     printf("error");
  }

Not sure whether EVP_PKEY_fromdata will assign  params same as EVP_PKEY_assign_RSA api.

we tried to set params different in many ways but not sure whether fromdata will assign params same as assign_rsa api.

we tried to sign the same file using both case and expecting same result but using our new way of constructing key we are unable to get same sign.

Please let us know about our key construction part and for same input file signing should be same or not.


问:
How to avoid the duplicate entries in mariaDB
Using Node js and Maria db in the project

Used stored procedure to insert the data

Every 5 mins api call will trigger and inserts the data with timestamp. So it was working fine in most of the time but sometimes there is lot of duplicate entries. I don't know exactly whats the problem

Need to prevent the duplicate entries


问:
How to access $_POST vars in WordPress?
I am extending the single-order page (maybe it has a different name) in WooCommerce with a function doing an API call. In this function I added 2 Checkboxes an a Select Field.

When clicking the blue Save-Order-Button the order is updated,
the API function does its job, but I cannot access the Checkboxes and the Select Field.

$_POST and $_REQUEST failed, also this:

```<code>function new_query_vars($vars) {
  $vars[] = 'checkbox_1';
  return $vars;
}
add_filter( 'query_vars', 'new_query_vars' );

add_query_arg( array('checkbox_1' => 'value'));

echo get_query_var('checkbox_1');
</code>```

The Input elements are inside this form:

```<code><form name="post" action="post.php" method="post" id="post">
</code>```

What is wrong here? How can I access the desired POST-vars?

Title: How to access $_POST vars in WordPress?

Body:
I am extending the single-order page (maybe it has a different name) in WooCommerce with a function doing an API call. In this function I added 2 Checkboxes an a Select Field.

When clicking the blue Save-Order-Button the order is updated,
the API function does its job, but I cannot access the Checkboxes and the Select Field.

$_POST and $_REQUEST failed, also this:

function new_query_vars($vars) {
  $vars[] = 'checkbox_1';
  return $vars;
}
add_filter( 'query_vars', 'new_query_vars' );

add_query_arg( array('checkbox_1' => 'value'));

echo get_query_var('checkbox_1');

The Input elements are inside this form:

<form name="post" action="post.php" method="post" id="post">

What is wrong here? How can I access the desired POST-vars?


问:
MySQL replication with 3 nodes (GTID and channels)
I would like to ask a question regarding replication of 3 nodes within MySQL before I do proceed with my idea by purchasing more hardware.

That being the case, currently I do have 2 nodes with master-master GTID based replication (lets name those nodes A and B, so A is master for B and B is master for A). They do replicate each others data flawlessly without issues. So, in general, it looks like this:

Now, I would like to add another node C, which would be a master to A and vice-versa (A being master to C). This of course would work on a different channel name:

My main question is - will a query executed on B replicate to C through A and will a query executed on C replicate to B through A?

I would like to avoid circular replication for that matter because it simply increases possible points of failure.


问:
CLIP for multi-label classification
I am using CLIP to determine the similarity between words and images.

For now I am using this repo and the following code and for classification it gives great results. I would need it for multi label classification in which I would need to use sigmoid instead of softmax.

```<code>import torch
from PIL import Image
import open_clip

model, _, preprocess = open_clip.create_model_and_transforms('ViT-B-32-quickgelu', pretrained='laion400m_e32')
tokenizer = open_clip.get_tokenizer('ViT-B-32-quickgelu')

image = preprocess(Image.open("CLIP.png")).unsqueeze(0)
text = tokenizer(["a diagram", "a dog", "a cat"])

with torch.no_grad(), torch.cuda.amp.autocast():
    image_features = model.encode_image(image)
    text_features = model.encode_text(text)
    image_features /= image_features.norm(dim=-1, keepdim=True)
    text_features /= text_features.norm(dim=-1, keepdim=True)

    text_probs = (100.0 * image_features @ text_features.T).softmax(dim=-1)

print("Label probs:", text_probs)  # prints: [[1., 0., 0.]]
</code>```

Now I would like to use it for multi-class. For example if we have on the image dog and cat I would like to have high probabilities for both, so I would need to run it with sigmoid. But this gives me results all around 0.55 with the correct classes being 0.56 and the wrong 0.54, so something like this [0.54, 0.555, 0.56]. I would like to have something like [0.01, 0.98, 0.99] after using the sigmoid.

What am I doing wrong there? How can I get the results I want?

Title: CLIP for multi-label classification

Body:
I am using CLIP to determine the similarity between words and images.

For now I am using this repo and the following code and for classification it gives great results. I would need it for multi label classification in which I would need to use sigmoid instead of softmax.

import torch
from PIL import Image
import open_clip

model, _, preprocess = open_clip.create_model_and_transforms('ViT-B-32-quickgelu', pretrained='laion400m_e32')
tokenizer = open_clip.get_tokenizer('ViT-B-32-quickgelu')

image = preprocess(Image.open("CLIP.png")).unsqueeze(0)
text = tokenizer(["a diagram", "a dog", "a cat"])

with torch.no_grad(), torch.cuda.amp.autocast():
    image_features = model.encode_image(image)
    text_features = model.encode_text(text)
    image_features /= image_features.norm(dim=-1, keepdim=True)
    text_features /= text_features.norm(dim=-1, keepdim=True)

    text_probs = (100.0 * image_features @ text_features.T).softmax(dim=-1)

print("Label probs:", text_probs)  # prints: [[1., 0., 0.]]

Now I would like to use it for multi-class. For example if we have on the image dog and cat I would like to have high probabilities for both, so I would need to run it with sigmoid. But this gives me results all around 0.55 with the correct classes being 0.56 and the wrong 0.54, so something like this [0.54, 0.555, 0.56]. I would like to have something like [0.01, 0.98, 0.99] after using the sigmoid.

What am I doing wrong there? How can I get the results I want?


问:
how to store auth0 user data in a mongodb database after they sign up in a next js application
I am working on a Next JS project. I am using auth0 (auth zero) for authentication. I want to store the user data(username, email, profile pic) in my mongodb database after they signup. I am using free plan so I can't use connect to mongodb method as they mentioned in the documentation.

their method: https://auth0.com/blog/connecting-auth0-to-mongodb/

I couldn't find any solution yet.


问:
How do I simplify testing / distribution for a Rust application that uses modern Windows APIs?
I am trying to use the Windows 10 Notification Listener API in a Rust project of mine, and I ran into a mysterious error when trying to register a notification event handler:

listener.NotificationChanged(&TypedEventHandler::new(
  move |_sender, args: &Option<UserNotificationChangedEventArgs>| {
    Ok(())
  },
))?;
```
```Element not found. (0x80070490)
```

Digging deeper into the docs, I realized this might be a modern API that is only available to applications with identity. So, reasonably, I tried to add package identity to my Rust app, which resulted in a lot more setup. I needed to create a new self-signed certificate, package with MakeAppx.exe, sign with SignTool.exe, and ultimately in the end after all of that it still refuses to install.

So, my question is primarily: How can I resolve this issue / simplify the development workflow / simplify end user flow? Can I somehow use these APIs in a traditional binary / work around them using a different technique to avoid these requirements? I much preferred the format of a traditional EXE that calls system APIs rather than these "modernized" application systems, as this system introduces a lot of friction in development, for end-users, and for potential future contributors.

I dislike the requirement of needing a certificate for building the app, having to install it first before running, and the inherent complexity of integrating this into a system that does not use traditional windows development tools.

Body:
I am trying to use the Windows 10 Notification Listener API in a Rust project of mine, and I ran into a mysterious error when trying to register a notification event handler:

listener.NotificationChanged(&TypedEventHandler::new(
  move |_sender, args: &Option<UserNotificationChangedEventArgs>| {
    Ok(())
  },
))?;

Element not found. (0x80070490)

Digging deeper into the docs, I realized this might be a modern API that is only available to applications with identity. So, reasonably, I tried to add package identity to my Rust app, which resulted in a lot more setup. I needed to create a new self-signed certificate, package with MakeAppx.exe, sign with SignTool.exe, and ultimately in the end after all of that it still refuses to install.

So, my question is primarily: How can I resolve this issue / simplify the development workflow / simplify end user flow? Can I somehow use these APIs in a traditional binary / work around them using a different technique to avoid these requirements? I much preferred the format of a traditional EXE that calls system APIs rather than these "modernized" application systems, as this system introduces a lot of friction in development, for end-users, and for potential future contributors.

I dislike the requirement of needing a certificate for building the app, having to install it first before running, and the inherent complexity of integrating this into a system that does not use traditional windows development tools.


问:
Make %matplotlib qt graph on client machine
I'm accessing a remote jupyter notebook server. I only want to use %matplotlib qt backend. But %matplotlib qt pops the plot on the server machine, not the client machine. Is there a way to get the plot to come out on the client machine? I am using this "%matplotlib qt" to take input on the graph runtime.


问:
''Failed to create a 'Type' from the text 'xctk:DateTimePicker'.' Line number '4' and line position '40'.'
When i set Build Action of BaseResources.xaml to Page and it will work.

When i set Build Action of BaseResources.xaml to Resource ,I get the following error.

System.Windows.Markup.XamlParseException: ''Failed to create a 'Type'
from the text 'xctk:DateTimePicker'.' Line number '4' and line
position '40'.'

XamlParseException: Type reference cannot find type named
'{http://schemas.xceed.com/wpf/xaml/toolkit}DateTimePicker'.

I've looked here, but i don't know how to get it to work when the Build Action is set to Resource.

This page states (note the word "must"):

```<code>Your resource must be defined as part of the project as a Resource build action.
</code>```

So, why does "Page" work? Am I using the wrong reference link?

The following is my project.

Project structure:

BaseResources.xaml:

```<code><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"  >
    <Style x:Key="DateTimePickerBase"  TargetType="{x:Type xctk:DateTimePicker}">
        <Setter Property="Background"   Value="LightYellow" />
    </Style>
</ResourceDictionary>
</code>```

App.xaml:

```<code><Application x:Class="Application"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:PIM"
             xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
             StartupUri="/Views/MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/PIM;component/Models/BaseResources.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
</code>```

MainWindow.xaml:

```<code><Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:self="clr-namespace:PIM"
        mc:Ignorable="d"
         xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        Title="MainWindow" Height="450" Width="800">
    <Window.DataContext>
        <self:MainWindowVM/>
    </Window.DataContext>
    <StackPanel>
        <TextBox Text="{Binding MyTextProperty}"/>
        <xctk:DateTimePicker x:Name="dtp"  Value="{Binding TodayDate}" Style="{StaticResource  DateTimePickerBase}"></xctk:DateTimePicker>
    </StackPanel>
</Window>
</code>```

MainWindowVM.vb:

Imports System.ComponentModel

Public Class MainWindowVM
Implements INotifyPropertyChanged

```<code>    Public Sub New()
        Me.myTextValue = "default value..."
    End Sub

    Private myTextValue As String = String.Empty
    Public Property MyTextProperty() As String
        Get
            Return Me.myTextValue
        End Get

        Set(ByVal value As String)
            Me.myTextValue = value
            NotifyPropertyChanged("MyTextProperty")
        End Set
    End Property

    Private _todayDate As DateTime = DateTime.Today
    Public Property TodayDate() As DateTime
        Get
            Return Me._todayDate
        End Get

        Set(ByVal value As DateTime)
            Me._todayDate = value
            NotifyPropertyChanged("TodayDate")
        End Set
    End Property

    Public Event PropertyChanged As PropertyChangedEventHandler _
        Implements INotifyPropertyChanged.PropertyChanged

    Private Sub NotifyPropertyChanged(ByVal propertyName As String)
        RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
    End Sub

End Class
</code>```

Body:
When i set Build Action of BaseResources.xaml to Page and it will work.

When i set Build Action of BaseResources.xaml to Resource ,I get the following error.

System.Windows.Markup.XamlParseException: ''Failed to create a 'Type'
from the text 'xctk:DateTimePicker'.' Line number '4' and line
position '40'.'

XamlParseException: Type reference cannot find type named
'{http://schemas.xceed.com/wpf/xaml/toolkit}DateTimePicker'.

I've looked here, but i don't know how to get it to work when the Build Action is set to Resource.

This page states (note the word "must"):

Your resource must be defined as part of the project as a Resource build action.

So, why does "Page" work? Am I using the wrong reference link?

The following is my project.

Project structure:

BaseResources.xaml:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"  >

</ResourceDictionary>

App.xaml:

<Application x:Class="Application"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:PIM"
             xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
             StartupUri="/Views/MainWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/PIM;component/Models/BaseResources.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

MainWindow.xaml:

<Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:self="clr-namespace:PIM"
        mc:Ignorable="d"
         xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
        Title="MainWindow" Height="450" Width="800">
    <Window.DataContext>
        <self:MainWindowVM/>
    </Window.DataContext>
    <StackPanel>
        <TextBox Text="{Binding MyTextProperty}"/>
        <xctk:DateTimePicker x:Name="dtp"  Value="{Binding TodayDate}" Style="{StaticResource  DateTimePickerBase}"></xctk:DateTimePicker>
    </StackPanel>
</Window>

MainWindowVM.vb:

Imports System.ComponentModel

Public Class MainWindowVM
Implements INotifyPropertyChanged

    Public Sub New()
        Me.myTextValue = "default value..."
    End Sub

    Private myTextValue As String = String.Empty
    Public Property MyTextProperty() As String
        Get
            Return Me.myTextValue
        End Get

        Set(ByVal value As String)
            Me.myTextValue = value
            NotifyPropertyChanged("MyTextProperty")
        End Set
    End Property

    Private _todayDate As DateTime = DateTime.Today
    Public Property TodayDate() As DateTime
        Get
            Return Me._todayDate
        End Get

        Set(ByVal value As DateTime)
            Me._todayDate = value
            NotifyPropertyChanged("TodayDate")
        End Set
    End Property

    Public Event PropertyChanged As PropertyChangedEventHandler _
        Implements INotifyPropertyChanged.PropertyChanged

    Private Sub NotifyPropertyChanged(ByVal propertyName As String)
        RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
    End Sub

End Class


问:
How to replicate segments in GA in Big Query

There is a segment(sequence start) in GA for first user interaction.

Looks like this
Step 1
default channel grouping,

(does not match regex)

Organic Search| Direct

Or

PageSceenType,

(does not match regex)

channel|home|topic|tag.

So there is a GA table in big query

Tried a where clause channelGrouping not in (‘Organic search’, ‘ Direct’) or pageScreenType not in (‘home’, ‘tag’, ‘topic’ channel

But the numbers don’t not match atall with Google analytics

Please how can replicate the segment in GA in BQ


问:
I am following a tutorial trying to get the downloadURL from firebase and setting them as properties in my move object, but it returns me undefined
```<code>import { initializeApp } from "firebase/app"; import { getStorage } from "firebase/storage";

const firebaseConfig = { ... // here is my API };

const app = initializeApp(firebaseConfig);

const storage = getStorage(app);

export { storage, app };
</code>```

app.js file

```<code>import { useState } from "react";
import "./newProduct.css";
import { storage } from "../../firebase";
import { getStorage, ref, uploadBytesResumable, getDownloadURL } from "firebase/storage";

export default function NewProduct() {
  const [movie, setMovie] = useState(null);
  const [img, setImg] = useState(null);
  const [imgTitle, setImgTitle] = useState(null);
  const [imgSm, setImgSm] = useState(null);
  const [trailer, setTrailer] = useState(null);
  const [video, setVideo] = useState(null);
  const [uploaded, setUploaded] = useState(0);

  const handleChange = (e) => {
    const value = e.target.value;
    setMovie({ ...movie, [e.target.name]: value });
  };

  const upload = (items) => {
    items.forEach((item) => {
      const fileName = new Date().getTime() + item.label + item.file.name;
      const storageRef = ref(storage, `/items/${fileName}`)
      const uploadTask = uploadBytesResumable(storageRef, item);
      uploadTask.on(
        "state_changed",
        (snapshot) => {
          const progress =
            (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
          console.log("Upload is" + progress + " % done.");
        },
        (err) => {
          console.log(err);
        },
        () => {
          getDownloadURL(uploadTask.snapshot.ref).then((downloadURL) => {
            setMovie((prevState) => {
              return { ...prevState, [item.label]: downloadURL };
            });
            setUploaded((prev) => prev + 1);
          });
        }
      );
    });
  };

  const handleUpload = (e) => {
    e.preventDefault();
    upload([
      { file: img, lable: "img" },
      { file: imgTitle, lable: "imgTitle" },
      { file: imgSm, lable: "imgSm" },
      { file: trailer, lable: "trailer" },
      { file: video, lable: "video" },
    ]);
  };

  console.log(movie);

  return (
    <div className="newProduct">
      <h1 className="addProductTitle">New Movie</h1>
      <form className="addProductForm">
        <div className="addProductItem">
          <label>Image</label>
          <input
            type="file"
            id="img"
            name="img"
            onChange={(e) => setImg(e.target.files[0])}
          />
        </div>
        <div className="addProductItem">
          <label>Title image</label>
          <input
            type="file"
            id="imgTitle"
            name="imgTitle"
            onChange={(e) => setImgTitle(e.target.files[0])}
          />
        </div>
        <div className="addProductItem">
          <label>Thumbnail image</label>
          <input
            type="file"
            id="imgSm"
            name="imgSm"
            onChange={(e) => setImgSm(e.target.files[0])}
          />
        </div>
        <div className="addProductItem">
          <label>Title</label>
          <input
            type="text"
            placeholder="John Wick"
            name="title"
            onChange={handleChange}
          />
        </div>
        <div className="addProductItem">
          <label>Description</label>
          <input
            type="text"
            placeholder="description"
            name="desc"
            onChange={handleChange}
          />
        </div>
        <div className="addProductItem">
          <label>Year</label>
          <input
            type="text"
            placeholder="year"
            name="year"
            onChange={handleChange}
          />
        </div>
        <div className="addProductItem">
          <label>Genre</label>
          <input
            type="text"
            placeholder="genre"
            name="genre"
            onChange={handleChange}
          />
        </div>
        <div className="addProductItem">
          <label>Duration</label>
          <input
            type="text"
            placeholder="duration"
            name="duration"
            onChange={handleChange}
          />
        </div>
        <div className="addProductItem">
          <label>Limit</label>
          <input
            type="text"
            placeholder="limit"
            name="limit"
            onChange={handleChange}
          />
        </div>
        <div className="addProductItem">
          <label>Is Series?</label>
          <select name="isSeries" id="isSeries" onChange={handleChange}>
            <option value="false">No</option>
            <option value="true">Yes</option>
          </select>
        </div>
        <div className="addProductItem">
          <label>Trailer</label>
          <input
            type="file"
            name="trailer"
            onChange={(e) => setTrailer(e.target.files[0])}
          />
        </div>
        <div className="addProductItem">
          <label>Video</label>
          <input
            type="file"
            name="video"
            onChange={(e) => setVideo(e.target.files[0])}
          />
        </div>
        {uploaded === 5 ? (
          <button className="addProductButton">Create</button>
        ) : (
          <button className="addProductButton" onClick={handleUpload}>
            Upload
          </button>
        )}
      </form>
    </div>
  );
}`
</code>```

I'm not sure where went wrong, I'm assuming it's one of my useState functions but I'm not sure.

this is what it shows on my console

(I uploaded 5 different files (img, imgTitle, imgSm, trailer, video), but it only retrives one link from the firebase and it sets the name of that property to "undefined" when it's suppose to return 5 different property names.

this is what it's suppose to be like based on the tutorial I followed:

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

Body:
import { initializeApp } from "firebase/app"; import { getStorage } from "firebase/storage";

const firebaseConfig = { ... // here is my API };

const app = initializeApp(firebaseConfig);

const storage = getStorage(app);

export { storage, app };

app.js file

import { useState } from "react";
import "./newProduct.css";
import { storage } from "../../firebase";
import { getStorage, ref, uploadBytesResumable, getDownloadURL } from "firebase/storage";

export default function NewProduct() {
  const [movie, setMovie] = useState(null);
  const [img, setImg] = useState(null);
  const [imgTitle, setImgTitle] = useState(null);
  const [imgSm, setImgSm] = useState(null);
  const [trailer, setTrailer] = useState(null);
  const [video, setVideo] = useState(null);
  const [uploaded, setUploaded] = useState(0);

  const handleChange = (e) => {
    const value = e.target.value;
    setMovie({ ...movie, [e.target.name]: value });
  };

  const upload = (items) => {
    items.forEach((item) => {
      const fileName = new Date().getTime() + item.label + item.file.name;
      const storageRef = ref(storage, `/items/${fileName}`)
      const uploadTask = uploadBytesResumable(storageRef, item);
      uploadTask.on(
        "state_changed",
        (snapshot) => {
          const progress =
            (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
          console.log("Upload is" + progress + " % done.");
        },
        (err) => {
          console.log(err);
        },
        () => {
          getDownloadURL(uploadTask.snapshot.ref).then((downloadURL) => {
            setMovie((prevState) => {
              return { ...prevState, [item.label]: downloadURL };
            });
            setUploaded((prev) => prev + 1);
          });
        }
      );
    });
  };

  const handleUpload = (e) => {
    e.preventDefault();
    upload([
      { file: img, lable: "img" },
      { file: imgTitle, lable: "imgTitle" },
      { file: imgSm, lable: "imgSm" },
      { file: trailer, lable: "trailer" },
      { file: video, lable: "video" },
    ]);
  };

  console.log(movie);

  return (

New Movie

      <form className="addProductForm">

          Image
          <input
            type="file"
            id="img"
            name="img"
            onChange={(e) => setImg(e.target.files[0])}
          />

          Title image
          <input
            type="file"
            id="imgTitle"
            name="imgTitle"
            onChange={(e) => setImgTitle(e.target.files[0])}
          />

          Thumbnail image
          <input
            type="file"
            id="imgSm"
            name="imgSm"
            onChange={(e) => setImgSm(e.target.files[0])}
          />

          Title
          <input
            type="text"
            placeholder="John Wick"
            name="title"
            onChange={handleChange}
          />

          Description
          <input
            type="text"
            placeholder="description"
            name="desc"
            onChange={handleChange}
          />

          Year
          <input
            type="text"
            placeholder="year"
            name="year"
            onChange={handleChange}
          />

          Genre
          <input
            type="text"
            placeholder="genre"
            name="genre"
            onChange={handleChange}
          />

          Duration
          <input
            type="text"
            placeholder="duration"
            name="duration"
            onChange={handleChange}
          />

          Limit
          <input
            type="text"
            placeholder="limit"
            name="limit"
            onChange={handleChange}
          />

          Is Series?
          <select name="isSeries" id="isSeries" onChange={handleChange}>
            <option value="false">No</option>
            <option value="true">Yes</option>
          </select>

          Trailer
          <input
            type="file"
            name="trailer"
            onChange={(e) => setTrailer(e.target.files[0])}
          />

          Video
          <input
            type="file"
            name="video"
            onChange={(e) => setVideo(e.target.files[0])}
          />

        {uploaded === 5 ? (
          <button className="addProductButton">Create</button>
        ) : (
          <button className="addProductButton" onClick={handleUpload}>
            Upload
          </button>
        )}
      </form>

  );
}`

I'm not sure where went wrong, I'm assuming it's one of my useState functions but I'm not sure.

this is what it shows on my console

(I uploaded 5 different files (img, imgTitle, imgSm, trailer, video), but it only retrives one link from the firebase and it sets the name of that property to "undefined" when it's suppose to return 5 different property names.

this is what it's suppose to be like based on the tutorial I followed:


问:
Pre-chat survey questions are not asking when Power Virtual Agent embedded with workstream- Omni channel - D365
I have configured a chat channel using the OMNI channel. There I have configured pre-chat survey questions and a power virtual agent configured for the workstream.
So when I initiate the chat using the chat widget, PVA questions are asked by chat but when it transfers the chat to an agent, Pre-chat Survey questions are not asked, they are directly assigned to the agent.

could anyone help if pre-chat survey questions can be asked also before assigning chat to the agent?


问:
Different outputs for different IDEs for same c++ program using continue keyword
For the following c++ program :

```<code>#include<iostream>
using namespace std;
int main()
{
    int i=1;
    while(i<=10)
    {
        if(i==5)
         continue;

       cout<<endl<<i;
       i++;
    }
    return 0;

}
</code>```

The outputs given by codeblock and online compilers vis. https://www.programiz.com/cpp-programming/online-compiler/ and https://www.onlinegdb.com/online_c++_compiler is different.

The output given by the codeblocks :

```<code>1
2
3
4
</code>```

The outputs by the online compilers :

```<code>1
2
3
</code>```

According to me the output given by the codeblock should be correct . Hence, I am unable to understand why the two online compilers are not giving 4 as an output.
Is it because of the while loop running infinite times ?

Body:
For the following c++ program :

#include<iostream>
using namespace std;
int main()
{
    int i=1;
    while(i<=10)
    {
        if(i==5)
         continue;

       cout<<endl<<i;
       i++;
    }
    return 0;

}

The outputs given by codeblock and online compilers vis. https://www.programiz.com/cpp-programming/online-compiler/ and https://www.onlinegdb.com/online_c++_compiler is different.

The output given by the codeblocks :

1
2
3
4

The outputs by the online compilers :

1
2
3

According to me the output given by the codeblock should be correct . Hence, I am unable to understand why the two online compilers are not giving 4 as an output.
Is it because of the while loop running infinite times ?


问:
Copy snowflake data from one environment to another (prod to dev)
I am trying to automate cloning snowflake objects and data from production to dev using Jenkins for performing a load test for API which uses these snowflake objects for sourcing data.

This activity is only anticipated when ever the jenkins pipeline triggers and the newly created snowflake objects need to be deleted once after the tests completes.

Am just trying to understand What is the best way to copy a table/schema from one snowflake environment to another?

Have identified some methods going through snowflake documentations, but not sure that is the best way to go for.

Below are the steps identified and will be wrapped in a python script from Jenkins :-

Create external stage in prod using

```<code>create or replace stage AIR_TICKET_FACT_DSP url='s3://public-assets-lab/LoadTest/' CREDENTIALS=(aws_key_id=' A******'aws_secret_key=' **********') file_format = csv;
</code>```

Copy table data to stage

```<code>COPY INTO @AIR_TICKET_FACT_DSP FROM EASEL_PDL.TICKET_FACT where cast(ISSUE_DATE as date)='2019-01-01'
</code>```

From the Dev environment
Use the command to insert the data to dev table

```<code>COPY INTO dev.AIR_TICKET_FACT_DSP FROM @AIR_TICKET_FACT_DSP
</code>```

Is this possible? If yes. is this the right approach?

Thanks in advance!

Body:
I am trying to automate cloning snowflake objects and data from production to dev using Jenkins for performing a load test for API which uses these snowflake objects for sourcing data.

This activity is only anticipated when ever the jenkins pipeline triggers and the newly created snowflake objects need to be deleted once after the tests completes.

Am just trying to understand What is the best way to copy a table/schema from one snowflake environment to another?

Have identified some methods going through snowflake documentations, but not sure that is the best way to go for.

Below are the steps identified and will be wrapped in a python script from Jenkins :-

Create external stage in prod using

create or replace stage AIR_TICKET_FACT_DSP url='s3://public-assets-lab/LoadTest/' CREDENTIALS=(aws_key_id=' A******'aws_secret_key=' **********') file_format = csv;

Copy table data to stage

COPY INTO @AIR_TICKET_FACT_DSP FROM EASEL_PDL.TICKET_FACT where cast(ISSUE_DATE as date)='2019-01-01'

From the Dev environment
Use the command to insert the data to dev table

COPY INTO dev.AIR_TICKET_FACT_DSP FROM @AIR_TICKET_FACT_DSP

Is this possible? If yes. is this the right approach?

Thanks in advance!