问:
Error is saying You may need an additional loader to handle the result of these loaders
I meet with the following error on my terminal whenever I try to use native-base in react-native

./node_modules/react-native-reanimated/lib/index.web.js 5:9
Module parse failed: Unexpected token (5:9)
File was processed with these loaders:

../../../AppData/Roaming/npm/node_modules/expo-cli/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| export * from "./reanimated1";
| export * from "./reanimated2";

export * as default from "./Animated";

=>Here is my babe.config.js

```<code>module.exports = function (api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
    plugins: [
      'react-native-reanimated/plugin',
      "nativewind/babel",
    ],
  };
};

</code>```

=>Here is my package.json

```<code>{
  "name": "equb",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start --android",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@react-navigation/drawer": "^6.5.4",
    "@react-navigation/native": "^6.1.1",
    "expo": "~47.0.8",
    "expo-linear-gradient": "~12.0.1",
    "expo-status-bar": "~1.4.2",
    "native-base": "^3.4.25",
    "nativewind": "^2.0.11",
    "react": "18.1.0",
    "react-dom": "^18.2.0",
    "react-native": "0.70.5",
    "react-native-gesture-handler": "^2.8.0",
    "react-native-reanimated": "^2.13.0",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-svg": "^12.1.1",
    "react-native-vector-icons": "^9.2.0",
    "react-native-web": "^0.17.1",
    "tailwindcss": "^3.2.4"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}

</code>```

I've installed native-base and enclose all my project in   as follows

```<code>export default function App() {
  return (
    <NativeBaseProvider>
      <NavigationContainer>
        <RootStack />
      </NavigationContainer>
    </NativeBaseProvider>
  );
}

</code>```

But error is still occuring

Body:
I meet with the following error on my terminal whenever I try to use native-base in react-native

./node_modules/react-native-reanimated/lib/index.web.js 5:9
Module parse failed: Unexpected token (5:9)
File was processed with these loaders:

../../../AppData/Roaming/npm/node_modules/expo-cli/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| export * from "./reanimated1";
| export * from "./reanimated2";

export * as default from "./Animated";

=>Here is my babe.config.js

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
    plugins: [
      'react-native-reanimated/plugin',
      "nativewind/babel",
    ],
  };
};

=>Here is my package.json

{
  "name": "equb",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start --android",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@react-navigation/drawer": "^6.5.4",
    "@react-navigation/native": "^6.1.1",
    "expo": "~47.0.8",
    "expo-linear-gradient": "~12.0.1",
    "expo-status-bar": "~1.4.2",
    "native-base": "^3.4.25",
    "nativewind": "^2.0.11",
    "react": "18.1.0",
    "react-dom": "^18.2.0",
    "react-native": "0.70.5",
    "react-native-gesture-handler": "^2.8.0",
    "react-native-reanimated": "^2.13.0",
    "react-native-safe-area-context": "^3.3.2",
    "react-native-svg": "^12.1.1",
    "react-native-vector-icons": "^9.2.0",
    "react-native-web": "^0.17.1",
    "tailwindcss": "^3.2.4"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}

I've installed native-base and enclose all my project in   as follows

export default function App() {
  return (
    <NativeBaseProvider>
      <NavigationContainer>
        <RootStack />
      </NavigationContainer>
    </NativeBaseProvider>
  );
}

But error is still occuring


来源: stackexchange

问:
tensorflow and faceRecogntion predict problem
i have built my model
for recongition faces
here is my model :

```<code> myModel = k.models.Sequential()
 myModel.add(k.layers.Conv2D(36, (5,5), activation='relu', input_shape = (100,100,3), name="ConvLay1"))
 myModel.add(k.layers.MaxPool2D((2,2)))
# Second convolution layer
 myModel.add(tf.keras.layers.Conv2D(54, (5,5), activation='relu', input_shape =(100,100,3), name="ConvLay2"))
 myModel.add(tf.keras.layers.MaxPool2D((2,2)))

# Flatten the layers
 myModel.add(tf.keras.layers.Flatten())

# Feed to Dense network
 myModel.add(tf.keras.layers.Dense(units = 1024, activation = 'relu'))
 myModel.add(tf.keras.layers.Dense(units = 512, activation = 'relu'))
 myModel.add(tf.keras.layers.Dense(units = 256, activation = 'relu'))

# sigmoid classifier
 myModel.add(tf.keras.layers.Dense(5, activation='sigmoid'))
</code>```

then i compile my model :

```<code>mymodel.compile(optimizer='Adam',metrics=['accuracy'], loss='sparse_categorical_crossentropy')
</code>```

and finaly the fit method :

```<code>history = mymodel.fit(x_train1, y_train1,
                    batch_size =1,
                    epochs = 35,
                    verbose = 2)
</code>```

change in fit parameters batch == 1 and batch ==2 and batch ==3
and changing ecpochs from 20 to 250 .
My problem is when i run my recognition faces file based on this my file.h5
with every change in parameter that i said before it still make wrong predict about faces i dont know why
although when i its about ending training its says :

```<code>1147/1147 - 9s - loss: 4.2069e-06 - accuracy: 1.0000 - 9s/epoch - 8ms/step
</code>```

and in evaluate :

```<code> 0s 45ms/step - loss: 0.0017 - accuracy: 1.0000
</code>```

so any suggestions
that i can make
and thank you for reading my problem
and here is samples of my dataset
every person have 100 photos of any person
sample of person 1
sample of person 2

ContentLicense: CC BY-SA 4.0

Body:
i have built my model
for recongition faces
here is my model :

 myModel = k.models.Sequential()
 myModel.add(k.layers.Conv2D(36, (5,5), activation='relu', input_shape = (100,100,3), name="ConvLay1"))
 myModel.add(k.layers.MaxPool2D((2,2)))
# Second convolution layer
 myModel.add(tf.keras.layers.Conv2D(54, (5,5), activation='relu', input_shape =(100,100,3), name="ConvLay2"))
 myModel.add(tf.keras.layers.MaxPool2D((2,2)))

# Flatten the layers
 myModel.add(tf.keras.layers.Flatten())

# Feed to Dense network
 myModel.add(tf.keras.layers.Dense(units = 1024, activation = 'relu'))
 myModel.add(tf.keras.layers.Dense(units = 512, activation = 'relu'))
 myModel.add(tf.keras.layers.Dense(units = 256, activation = 'relu'))

# sigmoid classifier
 myModel.add(tf.keras.layers.Dense(5, activation='sigmoid'))

then i compile my model :

mymodel.compile(optimizer='Adam',metrics=['accuracy'], loss='sparse_categorical_crossentropy')

and finaly the fit method :

history = mymodel.fit(x_train1, y_train1,
                    batch_size =1,
                    epochs = 35,
                    verbose = 2)

change in fit parameters batch == 1 and batch ==2 and batch ==3
and changing ecpochs from 20 to 250 .
My problem is when i run my recognition faces file based on this my file.h5
with every change in parameter that i said before it still make wrong predict about faces i dont know why
although when i its about ending training its says :

1147/1147 - 9s - loss: 4.2069e-06 - accuracy: 1.0000 - 9s/epoch - 8ms/step

and in evaluate :

 0s 45ms/step - loss: 0.0017 - accuracy: 1.0000

so any suggestions
that i can make
and thank you for reading my problem
and here is samples of my dataset
every person have 100 photos of any person
sample of person 1
sample of person 2


问:
How to replace an avatar image from a form with an url input?
how can i change the avatar image of my page when i fill the form? i'm still new with js so i don't know a lot of stuff, i'm studying it

  <button type="submit" class="profile__edit-button"></button>

<form class="form" id="form-avatar">
  <button type="button" class="popup__close"></button>

Edit Profile

  <input type="url" placeholder="New image url" id='url-avatar' class="form__input" value="" required>

  <button type="submit" class="form__submit">Save</button>
</form>
```
<p>I was trying this function but nothing happen in the page. I tried</p>
<pre class="lang-js prettyprint-override"><code>
function changeAvatar() {
  const inputAvatarValue = formAvatarInput.value;
  profileAvatar.src = inputAvatarValue;

  return changeAvatar;
};

formUpdateAvatar.addEventListener('submit', changeAvatar);
</code>```

Body:
how can i change the avatar image of my page when i fill the form? i'm still new with js so i don't know a lot of stuff, i'm studying it

  <button type="submit" class="profile__edit-button"></button>

<form class="form" id="form-avatar">
  <button type="button" class="popup__close"></button>

Edit Profile

  <input type="url" placeholder="New image url" id='url-avatar' class="form__input" value="" required>

  <button type="submit" class="form__submit">Save</button>
</form>

I was trying this function but nothing happen in the page. I tried

function changeAvatar() {
  const inputAvatarValue = formAvatarInput.value;
  profileAvatar.src = inputAvatarValue;

  return changeAvatar;
};

formUpdateAvatar.addEventListener('submit', changeAvatar);


问:
Quarto compilation with xelatex hanging in RStudio after update to 1.2.269
I'm using quarto in RStudio (windows) to compile a markdown document to pdf with xelatex. Until now I was using the quarto 1.1... version, all was working fine. Today I have updated to version 1.2.269 and now I can't compile my document, the xelatex call hangs in a 'tlmgr updating' call. It generates .tex output but the xelatex call just hangs there and never ends. However my TexLive installation is fully updated, as I have checked manually with tlmgr. Launching xelatex from TexWorks works ok and xelatex can compile this .tex file and generate the correct pdf file. Any advice about what can be wrong with quarto or xelatex call from RStudio after this quarto update? Thanks in advance</p>


问:
How to make ROOM TypeConerter return correct object not a LinkedTreeMap?
I have such entity class

```<code>@Entity
data class ListResponse(
    @SerializedName("answer")
    @ColumnInfo(name = "answer")
    val answer: Map<Int, ItemList>
)

data class ItemList(
    @SerializedName("yes")
    val yes: YesItem,

    @SerializedName("no")
    val no: NoItem
)

data class YesItem(
    @SerializedName("time")
    val timeYes: String,

    @SerializedName("date")
    val dateYes: String
)

data class NoItem(
    @SerializedName("time")
    val timeNo: String,

    @SerializedName("date")
    val dateNo: String
)
</code>```

And TypeConerter

```<code>    @TypeConverter
    fun convertFromMapToJSONString(map: Map<Int, ItemList>): String {
        return Gson().toJson(promotionMap)
    }

    @TypeConverter
    fun convertFromJSONStringToMap(jsonString: String?): Map<Int, ItemList>? {
        return Gson().fromJson<Map<Int, ItemList>>(jsonString, MutableMap::class.java)
    }
</code>```

Repository Class

```<code>    suspend fun insert(respone: ListResponse) {
        dao.insert(respone)
    }

    suspend fun getAll(): ListResponse {
        return dao.getAll()
    }
</code>```

Dao:

```<code>@Dao
interface ListDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(list: ListResponse): Long

    @Query("SELECT * FROM $TABLE_NAME")
    suspend fun getAll(): ListResponse

    companion object {
        const val TABLE_NAME = "list_table"
    }
}
</code>```

But class live data liveData.getValue() return LinkedTreeMap, not ListResponse object
but if I do

```<code>JsonObject jsonObject = new Gson().toJsonTree(liveData.getValue()).getAsJsonObject();
ListResponse reedUnreadItemList = new Gson().fromJson(jsonObject, ListResponse.class);
</code>```

It will return correct ListResponse object.

How cant I put this toJsonTree to TypeConverter class, to make liveData.getValue() return correct object?

Body:
I have such entity class

@Entity
data class ListResponse(
    @SerializedName("answer")
    @ColumnInfo(name = "answer")
    val answer: Map<Int, ItemList>
)

data class ItemList(
    @SerializedName("yes")
    val yes: YesItem,

    @SerializedName("no")
    val no: NoItem
)

data class YesItem(
    @SerializedName("time")
    val timeYes: String,

    @SerializedName("date")
    val dateYes: String
)

data class NoItem(
    @SerializedName("time")
    val timeNo: String,

    @SerializedName("date")
    val dateNo: String
)

And TypeConerter

    @TypeConverter
    fun convertFromMapToJSONString(map: Map<Int, ItemList>): String {
        return Gson().toJson(promotionMap)
    }

    @TypeConverter
    fun convertFromJSONStringToMap(jsonString: String?): Map<Int, ItemList>? {
        return Gson().fromJson<Map<Int, ItemList>>(jsonString, MutableMap::class.java)
    }

Repository Class

    suspend fun insert(respone: ListResponse) {
        dao.insert(respone)
    }

    suspend fun getAll(): ListResponse {
        return dao.getAll()
    }

Dao:

@Dao
interface ListDao {
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(list: ListResponse): Long

    @Query("SELECT * FROM $TABLE_NAME")
    suspend fun getAll(): ListResponse

    companion object {
        const val TABLE_NAME = "list_table"
    }
}

But class live data liveData.getValue() return LinkedTreeMap, not ListResponse object
but if I do

JsonObject jsonObject = new Gson().toJsonTree(liveData.getValue()).getAsJsonObject();
ListResponse reedUnreadItemList = new Gson().fromJson(jsonObject, ListResponse.class);

It will return correct ListResponse object.

How cant I put this toJsonTree to TypeConverter class, to make liveData.getValue() return correct object?


问:
Wordpress Redirect IP to URL and URL to IP (Stuck in Loop)
I was developing my website over IP now I got the domain and after changing the
site_url in wp_config.php file
Reference
https://wordpress.org/support/article/changing-the-site-url/

It keep on redirecting me From URL to IP and Ip to URL.I tried to debug and put some php code in index.php file

(Wordpress Multisite

Htaccess file

`

```<code>RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

# WP Maximum Execution Time Exceeded
<IfModule mod_php5.c>
        php_value max_execution_time 300
php_value upload_max_filesize 200M
</IfModule>
</code>```

`

Body:
I was developing my website over IP now I got the domain and after changing the
site_url in wp_config.php file
Reference
https://wordpress.org/support/article/changing-the-site-url/

It keep on redirecting me From URL to IP and Ip to URL.I tried to debug and put some php code in index.php file

(Wordpress Multisite

Htaccess file

`

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

# WP Maximum Execution Time Exceeded
<IfModule mod_php5.c>
        php_value max_execution_time 300
php_value upload_max_filesize 200M
</IfModule>

`


问:
Not Receiving Push Notifications iOS in Kill State React native
I am using @react-native-community/push-notification-ios: "^1.10.1"
When the app is in background I am receiving notifications perfectly but when app is killed by OS the notifications are not received in iOS.

Also when app is reopened, I received notifications that are sent in Killed State.

React Native Version: "0.69.1"

```<code>PushNotification.configure({
    // (optional) Called when Token is generated (iOS and Android)
    onRegister: function (token) {
        console.log("PUSH NOTIFICATION TOKEN:", token.token, token.os);

    },

    // (required) Called when a remote is received or opened, or local notification is opened
    onNotification: function (notification) {

        if (Platform.OS == 'ios') {

            PushNotificationIOS.addNotificationRequest({
                id: notification.data.msgId,

                title:notification.data.title,
                body: notification.data.body,
                userInfo: { jobId: "123" },
                isSilent: false,
            });

        }
</code>```

Body:
I am using @react-native-community/push-notification-ios: "^1.10.1"
When the app is in background I am receiving notifications perfectly but when app is killed by OS the notifications are not received in iOS.

Also when app is reopened, I received notifications that are sent in Killed State.

React Native Version: "0.69.1"

PushNotification.configure({
    // (optional) Called when Token is generated (iOS and Android)
    onRegister: function (token) {
        console.log("PUSH NOTIFICATION TOKEN:", token.token, token.os);

    },

    // (required) Called when a remote is received or opened, or local notification is opened
    onNotification: function (notification) {

        if (Platform.OS == 'ios') {

            PushNotificationIOS.addNotificationRequest({
                id: notification.data.msgId,

                title:notification.data.title,
                body: notification.data.body,
                userInfo: { jobId: "123" },
                isSilent: false,
            });

        }


问:
Unable to see user location on android rnmapbox/maps
This is my first time working with Mapbox I'm using the latest recommended v10 (10.0.0-beta.59) and I'm not able to see the user location marker on Android.

In AndroidManifest.xml I've added the permissions:

```<code><uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
</code>```

Then in the screen where I have the map I'm displaying the user locations like:

```<code>import MapboxGL from "@rnmapbox/maps";

//... other code

  async function hasLocationPermission() {
    if (Platform.OS === 'ios' || (Platform.OS === 'android' && Platform.Version < 23)) {
      return true;
    }
    const isGranted = await MapboxGL.requestAndroidLocationPermissions();
    return isGranted;
  }

  useEffect(() => {
    const task = async () => {
      const per = await hasLocationPermission()
      setPermission(per)
    }
    task()
  }, [false])

// ... other code

        <MapboxGL.MapView style={styles.map} compassEnabled={true} logoEnabled={false}>
          <MapboxGL.UserLocation
            androidRenderMode={'compass'}
            visible={true}
            onUpdate={(location) => { console.log("location: ", location) }}
            showsUserHeadingIndicator={true}
          />
          <MapboxGL.Camera
            zoomLevel={zoom}
            followUserMode={'compass'}
            followUserLocation />
        </MapboxGL.MapView>

//... rest of the code
</code>```

When I run the app, I can see the user location marker on the iOS simulator. I'm running the Android app on the android physical device, and it asked me for location permission at the start and then nothing. I do see locationManager Error:  [Error: Last location unavailable] on but I'm not using the last location and plus I'm on the v10 version and that too for react-native.

Body:
This is my first time working with Mapbox I'm using the latest recommended v10 (10.0.0-beta.59) and I'm not able to see the user location marker on Android.

In AndroidManifest.xml I've added the permissions:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Then in the screen where I have the map I'm displaying the user locations like:

import MapboxGL from "@rnmapbox/maps";

//... other code

  async function hasLocationPermission() {
    if (Platform.OS === 'ios' || (Platform.OS === 'android' && Platform.Version < 23)) {
      return true;
    }
    const isGranted = await MapboxGL.requestAndroidLocationPermissions();
    return isGranted;
  }

  useEffect(() => {
    const task = async () => {
      const per = await hasLocationPermission()
      setPermission(per)
    }
    task()
  }, [false])

// ... other code

        <MapboxGL.MapView style={styles.map} compassEnabled={true} logoEnabled={false}>
          <MapboxGL.UserLocation
            androidRenderMode={'compass'}
            visible={true}
            onUpdate={(location) => { console.log("location: ", location) }}
            showsUserHeadingIndicator={true}
          />
          <MapboxGL.Camera
            zoomLevel={zoom}
            followUserMode={'compass'}
            followUserLocation />
        </MapboxGL.MapView>

//... rest of the code

When I run the app, I can see the user location marker on the iOS simulator. I'm running the Android app on the android physical device, and it asked me for location permission at the start and then nothing. I do see locationManager Error:  [Error: Last location unavailable] on but I'm not using the last location and plus I'm on the v10 version and that too for react-native.


问:
What is the function of the fourth and fifth steps of the Paul Heckel's Diff Algorithm, and the result does not change after removal
I learn the Paul Heckel's Diff Algorithm from https://gist.github.com/regexident/19b066f86c701fae256600f4ae656934

I can't understand the pass 4 and pass 5, and when I remove it, the result not change


问:
How to interpret an XCOM within a task_group to keep a history of dynamically generated tasks within it?
I implemented a dag with a task_group that loops on the contents of a file.. This isn't ideal, I wish I could loop through the contents of an XCom, unless I'm mistaken, that isn't possible.

import json
import logging
from airflow.decorators import task_group
from airflow.operators.dummy import DummyOperator
from dtm.migration.helpers.tasks import (
    check_compliance_of_objects_sizes,
)

from airflow.providers.google.cloud.transfers.gcs_to_gcs import GCSToGCSOperator

from airflow.providers.google.cloud.sensors.gcs import (
    GCSObjectExistenceSensor,
)

@task_group(group_id="copy_task_group")
def copy_and_verify(
    inp_parameters_path: str,
    impersonated_service_account: str,
):
    try:
        with open(inp_parameters_path, "r") as f:
            inp_parameters = json.load(f)
            for entry in inp_parameters:
                sensor_source_file = GCSObjectExistenceSensor(
                    task_id=f"sensor_source_file_{entry}",
                    bucket=inp_parameters[entry]["source"]["bucket"],
                    object=(
                        f"{inp_parameters[entry]['source']['prefix']}"
                        f"/{inp_parameters[entry]['source']['object']}"
                    ),
                    impersonation_chain=impersonated_service_account,
                )

                copy_file = GCSToGCSOperator(
                    task_id=f"copy_file_{entry}",
                    source_bucket=inp_parameters[entry]["source"]["bucket"],
                    source_object=(
                        f"{inp_parameters[entry]['source']['prefix']}"
                        f"/{inp_parameters[entry]['source']['object']}"
                    ),
                    destination_bucket=inp_parameters[entry]["destination"][
                        "bucket"
                    ],
                    destination_object=(
                        f"{inp_parameters[entry]['destination']['prefix']}"
                        f"/{inp_parameters[entry]['destination']['object']}"
                    ),
                    impersonation_chain=impersonated_service_account,
                )

                check_size = check_compliance_of_objects_sizes(
                    date_of_execution="{{ds_nodash}}",
                    data_to_check=inp_parameters[entry],
                    impersonation_chain=impersonated_service_account,
                )

                sensor_destination_file = GCSObjectExistenceSensor(
                    task_id=f"sensor_destination_file_{entry}",
                    bucket=inp_parameters[entry]["destination"]["bucket"],
                    object=(
                        f"{inp_parameters[entry]['destination']['prefix']}"
                        f"/{inp_parameters[entry]['destination']['object']}"
                    ),
                    impersonation_chain=impersonated_service_account,
                )

                end_op = DummyOperator(task_id=f"end_{entry}")

                (
                    sensor_source_file
                    >> copy_file
                    >> check_size
                    >> sensor_destination_file
                    >> end_op
                )

    except FileNotFoundError:
        logging.info(
            f"File {inp_parameters_path} is generated in a prior task."
        )

```
<p>As you can see, I used <code>try...except FileNotFoundError:</code> because the error (file not found) is raised on the dag creation since the <code>inp_parameters_path</code> hadn't been created yet by the upstream tasks.</p>
<p>The <code>inp_parameters_path</code> is a file that is created upstream, but unfortunately, it seems that in order to display the logged steps of the task_group post execution I need to keep this file.. Which I don't because it will change from one day to another.</p>
<p>Example of removal of task_group contents after execution:
<img src="https://i.stack.imgur.com/LKhL1.png" alt="task_group_content_removal" /></p>
<p>The contents were well present before the <code>remove_mapping_file</code> has run.</p>
<p>How to pass an <code>XCom</code> to a <code>task_group</code> the same way I can do it with a <code>task</code>? If that's not possible, how do I archive those created <code>inp_parameters_path</code> files per execution so that I can come back and browse the execution of the dag?</p>
<p>If it can help, here's how my dag operates :</p>
<pre class="lang-py prettyprint-override"><code>
@dag(
    catchup=False,
    schedule_interval="@daily",
    max_active_runs=1,
    dag_id="migrate_dtm_gcs_data_history",
    start_date=datetime(2022, 12, 1),
    dagrun_timeout=timedelta(minutes=20),
    tags=[
        "migration",
        "dtm",
    ],
    default_args=default_args,
)
def template_dag():

    map = convert_csv_migration_to_map(
        source_csv=f"{COMPOSER_GCS_LOC_PATH}/dags/dtm/migration/helpers/gcs_migration_mapping_archetype.csv",
        delimiter=",",
    )

    updated_map_1 = update_mapping_with_gcp_project_and_buckets_ids(
        src_mig_map=map,
        env="dev",
        impersonation_chain=IMPERSONATED_SERVICE_ACCOUNT,
    )

    list_files_and_prefixes = GCSListObjectsOperator(
        task_id="list_files_and_prefixes",
        bucket=LEGACY_DTM_HISTORY_BUCKET,
        prefix="raw_data/datamart/{{ds_nodash}}",
        impersonation_chain=IMPERSONATED_SERVICE_ACCOUNT,
    )

    updated_map_2 = match_data_with_migration_map(
        src_mig_map=updated_map_1,
        files_and_prefixes=list_files_and_prefixes.output,
    )

    list_of_maps = flatten_to_input_files_granularity(
        src_mig_map=updated_map_2,
    )

    gcs_migration_maps_path = (
        f"{COMPOSER_GCS_LOC_PATH}/dags/dtm/migration"
        f"/helpers/gcs_migration_list_of_maps_{{ds_nodash}}.json"
    )
    write_list_of_maps_into_dict = gen_dict_file_from_list_of_map(
        file_name=gcs_migration_maps_path,
        list_of_maps=list_of_maps,
    )
    copy_task_group = copy_and_verify(
        inp_parameters_path=gcs_migration_maps_path,
        impersonated_service_account=IMPERSONATED_SERVICE_ACCOUNT,
    )

    remove_mapping_file = BashOperator(
        task_id="remove_mapping_file",
        bash_command=f"rm -vf {gcs_migration_maps_path}",
    )

    (
        map
        >> updated_map_1
        >> list_files_and_prefixes
        >> updated_map_2
        >> list_of_maps
        >> write_list_of_maps_into_dict
        >> copy_task_group
        >> remove_mapping_file
    )

dag = template_dag()
</code>```

Body:
I implemented a dag with a task_group that loops on the contents of a file.. This isn't ideal, I wish I could loop through the contents of an XCom, unless I'm mistaken, that isn't possible.

import json
import logging
from airflow.decorators import task_group
from airflow.operators.dummy import DummyOperator
from dtm.migration.helpers.tasks import (
    check_compliance_of_objects_sizes,
)

from airflow.providers.google.cloud.transfers.gcs_to_gcs import GCSToGCSOperator

from airflow.providers.google.cloud.sensors.gcs import (
    GCSObjectExistenceSensor,
)

@task_group(group_id="copy_task_group")
def copy_and_verify(
    inp_parameters_path: str,
    impersonated_service_account: str,
):
    try:
        with open(inp_parameters_path, "r") as f:
            inp_parameters = json.load(f)
            for entry in inp_parameters:
                sensor_source_file = GCSObjectExistenceSensor(
                    task_id=f"sensor_source_file_{entry}",
                    bucket=inp_parameters[entry]["source"]["bucket"],
                    object=(
                        f"{inp_parameters[entry]['source']['prefix']}"
                        f"/{inp_parameters[entry]['source']['object']}"
                    ),
                    impersonation_chain=impersonated_service_account,
                )

                copy_file = GCSToGCSOperator(
                    task_id=f"copy_file_{entry}",
                    source_bucket=inp_parameters[entry]["source"]["bucket"],
                    source_object=(
                        f"{inp_parameters[entry]['source']['prefix']}"
                        f"/{inp_parameters[entry]['source']['object']}"
                    ),
                    destination_bucket=inp_parameters[entry]["destination"][
                        "bucket"
                    ],
                    destination_object=(
                        f"{inp_parameters[entry]['destination']['prefix']}"
                        f"/{inp_parameters[entry]['destination']['object']}"
                    ),
                    impersonation_chain=impersonated_service_account,
                )

                check_size = check_compliance_of_objects_sizes(
                    date_of_execution="{{ds_nodash}}",
                    data_to_check=inp_parameters[entry],
                    impersonation_chain=impersonated_service_account,
                )

                sensor_destination_file = GCSObjectExistenceSensor(
                    task_id=f"sensor_destination_file_{entry}",
                    bucket=inp_parameters[entry]["destination"]["bucket"],
                    object=(
                        f"{inp_parameters[entry]['destination']['prefix']}"
                        f"/{inp_parameters[entry]['destination']['object']}"
                    ),
                    impersonation_chain=impersonated_service_account,
                )

                end_op = DummyOperator(task_id=f"end_{entry}")

                (
                    sensor_source_file
                    >> copy_file
                    >> check_size
                    >> sensor_destination_file
                    >> end_op
                )

    except FileNotFoundError:
        logging.info(
            f"File {inp_parameters_path} is generated in a prior task."
        )

As you can see, I used try...except FileNotFoundError: because the error (file not found) is raised on the dag creation since the inp_parameters_path hadn't been created yet by the upstream tasks.

The inp_parameters_path is a file that is created upstream, but unfortunately, it seems that in order to display the logged steps of the task_group post execution I need to keep this file.. Which I don't because it will change from one day to another.

Example of removal of task_group contents after execution:

The contents were well present before the remove_mapping_file has run.

How to pass an XCom to a task_group the same way I can do it with a task? If that's not possible, how do I archive those created inp_parameters_path files per execution so that I can come back and browse the execution of the dag?

If it can help, here's how my dag operates :

@dag(
    catchup=False,
    schedule_interval="@daily",
    max_active_runs=1,
    dag_id="migrate_dtm_gcs_data_history",
    start_date=datetime(2022, 12, 1),
    dagrun_timeout=timedelta(minutes=20),
    tags=[
        "migration",
        "dtm",
    ],
    default_args=default_args,
)
def template_dag():

    map = convert_csv_migration_to_map(
        source_csv=f"{COMPOSER_GCS_LOC_PATH}/dags/dtm/migration/helpers/gcs_migration_mapping_archetype.csv",
        delimiter=",",
    )

    updated_map_1 = update_mapping_with_gcp_project_and_buckets_ids(
        src_mig_map=map,
        env="dev",
        impersonation_chain=IMPERSONATED_SERVICE_ACCOUNT,
    )

    list_files_and_prefixes = GCSListObjectsOperator(
        task_id="list_files_and_prefixes",
        bucket=LEGACY_DTM_HISTORY_BUCKET,
        prefix="raw_data/datamart/{{ds_nodash}}",
        impersonation_chain=IMPERSONATED_SERVICE_ACCOUNT,
    )

    updated_map_2 = match_data_with_migration_map(
        src_mig_map=updated_map_1,
        files_and_prefixes=list_files_and_prefixes.output,
    )

    list_of_maps = flatten_to_input_files_granularity(
        src_mig_map=updated_map_2,
    )

    gcs_migration_maps_path = (
        f"{COMPOSER_GCS_LOC_PATH}/dags/dtm/migration"
        f"/helpers/gcs_migration_list_of_maps_{{ds_nodash}}.json"
    )
    write_list_of_maps_into_dict = gen_dict_file_from_list_of_map(
        file_name=gcs_migration_maps_path,
        list_of_maps=list_of_maps,
    )
    copy_task_group = copy_and_verify(
        inp_parameters_path=gcs_migration_maps_path,
        impersonated_service_account=IMPERSONATED_SERVICE_ACCOUNT,
    )

    remove_mapping_file = BashOperator(
        task_id="remove_mapping_file",
        bash_command=f"rm -vf {gcs_migration_maps_path}",
    )

    (
        map
        >> updated_map_1
        >> list_files_and_prefixes
        >> updated_map_2
        >> list_of_maps
        >> write_list_of_maps_into_dict
        >> copy_task_group
        >> remove_mapping_file
    )

dag = template_dag()


问:
how to generate html from swagger yaml file
I want to generate same html file as output which we see during writing api specification in see this image for reference.
How I can do this?</p>


问:
Specifying a maxDuration in vercel.json for an Express.js application
I've upgraded to a Pro plan in hosting my Express app on Vercel. I expected that the maxDuration should have been increased from the default 10 seconds t0 60 seconds (for the pro plan) but it seems I have to explicitly specify the maxDuration value in my vercel.json file. Here's my vercel.json:

```<code>{
  "version": 2,
  "builds": [
    {
      "src": "./server.js",
      "use": "@vercel/node"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "/server.js"
    }
  ],
  "functions": {
    "controllers/*.js": {
      "maxDuration": 60
    },
    "middleware/**/*.js": {
      "maxDuration": 60
    }
  }
}

</code>```

When I commit and successfully pushed to Github, Github shows an error-based notification from Vercel that says "Conflicting functions and builds Configuration" which clearly says that in my vercel.json file I can't use the "builds" and the "functions" command together; I can only use either of them.

I tried deleting the "builds" command. Upon pushing again, Vercel couldnt interprete/convert my Express.js controller functions/files into serverless functions. Though I know that the build command is definitely necessary.

I really need help. How can I do the configuration in a way that I can set a maxDuration so that my API doesn't timeout after the default 10 seconds?
Thanks.

Body:
I've upgraded to a Pro plan in hosting my Express app on Vercel. I expected that the maxDuration should have been increased from the default 10 seconds t0 60 seconds (for the pro plan) but it seems I have to explicitly specify the maxDuration value in my vercel.json file. Here's my vercel.json:

{
  "version": 2,
  "builds": [
    {
      "src": "./server.js",
      "use": "@vercel/node"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "/server.js"
    }
  ],
  "functions": {
    "controllers/*.js": {
      "maxDuration": 60
    },
    "middleware/**/*.js": {
      "maxDuration": 60
    }
  }
}

When I commit and successfully pushed to Github, Github shows an error-based notification from Vercel that says "Conflicting functions and builds Configuration" which clearly says that in my vercel.json file I can't use the "builds" and the "functions" command together; I can only use either of them.

I tried deleting the "builds" command. Upon pushing again, Vercel couldnt interprete/convert my Express.js controller functions/files into serverless functions. Though I know that the build command is definitely necessary.

I really need help. How can I do the configuration in a way that I can set a maxDuration so that my API doesn't timeout after the default 10 seconds?
Thanks.


问:
Three JS Geometry not rendering in scene?
I'm a complete beginner with three.js and am just trying to get to grips with creating a basic scene. I have copied and pasted code from a tutorial into VSCode and executed it through the live server extension.

This is the code below:

<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>Three.js Basic Scene</title>

```

The intended output is a blue cube on the screen with a white background, however all i am getting is a completely white screen. Any ideas why this is happening when the code is completely copied and pasted?

Body:
I'm a complete beginner with three.js and am just trying to get to grips with creating a basic scene. I have copied and pasted code from a tutorial into VSCode and executed it through the live server extension.

This is the code below:

<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>Three.js Basic Scene</title>

The intended output is a blue cube on the screen with a white background, however all i am getting is a completely white screen. Any ideas why this is happening when the code is completely copied and pasted?


问:
Unable to execute SSO for the ASP.NET web application running on WS 2016 via IIS 10
We have a legacy ASP.NET application running on the WS 2016 via IIS 10. We did specify all possible settings for the authentication section the way it is instructed for the SSO

However, no matter what was done the Single Sign On is simply not working. The user always is prompted with the authentication popup. And the irony is, on another server we have identical settings, and the Single Sign On works just fine

Any ideas, suggestions?


问:
How can I find nth palindrome number using if-else where n < 100?

How can I find nth palindrome number using if-else where n < 100 ?

```<code> Need Solution in c++
</code>```

i cant find any solution in online

Body:
How can I find nth palindrome number using if-else where n < 100 ?

 Need Solution in c++

i cant find any solution in online


问:
How to make necessary to select at least one checkbox?
I have a structure where I list the checkboxes according to the title and array. For example: Title is the title we know, list items are checkbox.

Title1

List item

List item

List item

Title2

List item2

List item2

In the part in Title 1, the first 2 checkboxes are checked by default. I want at least one of the checkboxes in Title1 to always remain selected. So if we have 1 checked checkbox in Title1, I will only disable this checkbox, so the user cannot unchecked it but can check the other ones. selectedField contains the entire array without distinguishing the title. I print the ones that match the title that I sent as a prop to the Fieldset Component by grouping them under the same title. How can i do this?

FieldSet Parent Component

```<code>import React from 'react'
import Fieldset from './Fieldset'

const Filters = ({
  selectedFields,
  fieldSelectionMultipliers,
  setFieldSelectionMultipliers,
}) => {
  return (
    <div className="w-full bg-white px-4 py-5 sm:p-6">
      <div className="md:grid md:grid-cols-2 md:gap-6">
        <div className="mt-4 space-y-6 md:col-span-1 md:mt-0">
          <Fieldset
            title="Title1"
            selectedFields={selectedFields}
            setTotal={setFieldSelectionMultipliers}
            total={fieldSelectionMultipliers}
          />
          <Fieldset
            title="Title2"
            selectedFields={selectedFields}
            setTotal={setFieldSelectionMultipliers}
            total={fieldSelectionMultipliers}
          />
        </div>
        <div className="mt-4 space-y-6 md:col-span-1 md:mt-0">
          <Fieldset
            title="Title3"
            selectedFields={selectedFields}
            setTotal={setFieldSelectionMultipliers}
            total={fieldSelectionMultipliers}
          />
        </div>
      </div>
    </div>
  )
}

export default Filters

</code>```

FieldSet Component

```<code>import React from 'react'
import FieldSetItem from '../FieldSetItem'

const Fieldset = ({ title, selectedFields, total, setTotal }) => {
  return (
    <fieldset>
      <legend className="sr-only">{title}</legend>
      <div className="text-base font-medium text-gray-900" aria-hidden="true">
        {title}
      </div>
      <div className="mt-4 space-y-2">
        {selectedFields.map(
          (field) =>
            field.content_object.parent.name === title && (
              <FieldSetItem
                key={field.nanoid}
                isPreselected={field.content_object.is_preselected}
                total={total}
                setTotal={setTotal}
                field={field}
                title={title}
              />
            )
        )}
      </div>
    </fieldset>
  )
}

export default Fieldset
</code>```

FieldSetItem Component

```<code>import React, { useState, useEffect } from 'react'

const FieldSetItem = ({ title, field, total, setTotal, isPreselected }) => {
  const [isChecked, setIsChecked] = useState(isPreselected)
  // const [isDisabled, setIsDisabled] = useState(false)

  const onFieldChange = (e) => {
    e.target.checked
      ? setTotal((Number(total) + Number(e.target.value)).toFixed(2))
      : setTotal((Number(total) - Number(e.target.value)).toFixed(2))
    setIsChecked(e.target.checked)
  }

  useEffect(() => {
    if (isChecked) {
      setTotal((Number(total) + Number(field.multiplier)).toFixed(2))
    }
  }, [])

  return (
    <div className="flex items-start">
      <div className="flex h-5 items-center">
        <input
          value={field.multiplier}
          name={field.content_object.nanoid}
          type="checkbox"
          className="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
          checked={isChecked}
          onChange={onFieldChange}
          title={title}
          // disabled={isDisabled}
        />
      </div>
      <div className="ml-3 text-sm">
        <label htmlFor="candidates" className="font-medium text-gray-700">
          {field.content_object.name}
        </label>
      </div>
    </div>
  )
}

export default FieldSetItem

</code>```

Body:
I have a structure where I list the checkboxes according to the title and array. For example: Title is the title we know, list items are checkbox.

Title1

List item

List item

List item

Title2

List item2

List item2

In the part in Title 1, the first 2 checkboxes are checked by default. I want at least one of the checkboxes in Title1 to always remain selected. So if we have 1 checked checkbox in Title1, I will only disable this checkbox, so the user cannot unchecked it but can check the other ones. selectedField contains the entire array without distinguishing the title. I print the ones that match the title that I sent as a prop to the Fieldset Component by grouping them under the same title. How can i do this?

FieldSet Parent Component

import React from 'react'
import Fieldset from './Fieldset'

const Filters = ({
  selectedFields,
  fieldSelectionMultipliers,
  setFieldSelectionMultipliers,
}) => {
  return (

          <Fieldset
            title="Title1"
            selectedFields={selectedFields}
            setTotal={setFieldSelectionMultipliers}
            total={fieldSelectionMultipliers}
          />
          <Fieldset
            title="Title2"
            selectedFields={selectedFields}
            setTotal={setFieldSelectionMultipliers}
            total={fieldSelectionMultipliers}
          />

          <Fieldset
            title="Title3"
            selectedFields={selectedFields}
            setTotal={setFieldSelectionMultipliers}
            total={fieldSelectionMultipliers}
          />

  )
}

export default Filters

FieldSet Component

import React from 'react'
import FieldSetItem from '../FieldSetItem'

const Fieldset = ({ title, selectedFields, total, setTotal }) => {
  return (
    <fieldset>
      <legend className="sr-only">{title}</legend>

        {title}

        {selectedFields.map(
          (field) =>
            field.content_object.parent.name === title && (
              <FieldSetItem
                key={field.nanoid}
                isPreselected={field.content_object.is_preselected}
                total={total}
                setTotal={setTotal}
                field={field}
                title={title}
              />
            )
        )}

    </fieldset>
  )
}

export default Fieldset

FieldSetItem Component

import React, { useState, useEffect } from 'react'

const FieldSetItem = ({ title, field, total, setTotal, isPreselected }) => {
  const [isChecked, setIsChecked] = useState(isPreselected)
  // const [isDisabled, setIsDisabled] = useState(false)

  const onFieldChange = (e) => {
    e.target.checked
      ? setTotal((Number(total) + Number(e.target.value)).toFixed(2))
      : setTotal((Number(total) - Number(e.target.value)).toFixed(2))
    setIsChecked(e.target.checked)
  }

  useEffect(() => {
    if (isChecked) {
      setTotal((Number(total) + Number(field.multiplier)).toFixed(2))
    }
  }, [])

  return (

        <input
          value={field.multiplier}
          name={field.content_object.nanoid}
          type="checkbox"
          className="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
          checked={isChecked}
          onChange={onFieldChange}
          title={title}
          // disabled={isDisabled}
        />

          {field.content_object.name}

  )
}

export default FieldSetItem


问:
How can GCC -ftree-partial-pre generate more assembly but run faster?
When implementing different sort algorithms for my computer science class I stumbled upon a curious optimization case with GCC(version 12.2).

I tried programming selection sort with two different variants: once storing the value of the current minimum (selection_sort) and once with only storing the index of the current minimum value (selection_nostore_sort)

links to godbolt and quick-bench (code & relevant assembly is also down below):

https://gcc.godbolt.org/z/Gdab1xenf

https://quick-bench.com/q/5xh06k8DD9qi1RCFvFMVBdbkDuw

I was expecting the nostore version to be slower because it has to reach out into the array for comparisons.
This was the case up to -O2, however with -O3 nostore runs about 10% faster (both on my local machine i7-10750H and quick-bench)
Testing out all the extra optimizations that -O3enables I was able to figure out that -O2 -ftree-partial-pre produces the same result.

When checking out the generated assembly in both cases I noticed that -ftree-partial-pre actually produces more assembler code yet runs faster.

I dont see any obvious reason why the -ftree-partial-pre version runs faster, what could be the causes here?
Thanks a lot for your help! My professors were sadly unable to give me an explanation.

#include <vector>
#include <random>
#include <functional>
using std::size_t;

const size_t DATA_ELEMS = 10'000;
const size_t RAND_RANGE = 1'000'000;

std::vector<size_t> random_data()
{
    std::srand(42);
    std::vector<size_t> result(DATA_ELEMS);
    const auto rand_size_t_range = [] () -> size_t {
        return std::rand() % RAND_RANGE;
    };
    std::generate(result.begin(), result.end(), rand_size_t_range);

    return result;
}

inline void swap(std::vector<size_t> &a, size_t i1, size_t i2)
{
    size_t h = a[i1];
    a[i1] = a[i2];
    a[i2] = h;
}

void selection_sort(std::vector<size_t> &a)
{

    for (size_t k = 0; k < a.size(); k++)
    {
        size_t min = a[k];
        size_t i_min = k;
        for (size_t i = k + 1; i < a.size(); i++)
        {
            if (a[i] < min)
            {
                min = a[i];
                i_min = i;
            }
        }
        if (i_min != k)
        {
            swap(a, i_min, k);
        }
    }
}

/*
    This is normally quite a bit slower than selection_sort
    However compiling with -02 -ftree-partial-pre seems to make this function
    quite a bit faster than selection_sort
*/
void selection_nostore_sort(std::vector<size_t> &a)
{
    for (size_t k = 0; k < a.size(); k++)
    {
        size_t i_min = k;
        for (size_t i = k + 1; i < a.size(); i++)
        {
            if (a[i] < a[i_min])
            {
                i_min = i;
            }
        }
        if (i_min != k)
        {
            swap(a, i_min, k);
        }
    }
}

```
<p>The <code>-O2</code> version</p>
```
selection_nostore_sort(std::vector<unsigned long, std::allocator<unsigned long> >&):
        mov     rax, QWORD PTR [rdi+8]
        mov     rcx, QWORD PTR [rdi]
        mov     rsi, rax
        sub     rsi, rcx
        sar     rsi, 3
        cmp     rcx, rax
        je      .L10
        xor     r8d, r8d
        lea     rdi, [r8+1]
        cmp     rdi, rsi
        jnb     .L10
.L18:
        mov     rax, rdi
        mov     rdx, r8
.L13:
        mov     r9, QWORD PTR [rcx+rdx*8]
        cmp     QWORD PTR [rcx+rax*8], r9
        cmovb   rdx, rax
        add     rax, 1
        cmp     rsi, rax
        jne     .L13
        cmp     rdx, r8
        je      .L14
        lea     rax, [rcx+rdx*8]
        mov     r8, QWORD PTR [rcx-8+rdi*8]
        mov     rdx, QWORD PTR [rax]
        mov     QWORD PTR [rax], r8
        mov     QWORD PTR [rcx-8+rdi*8], rdx
.L14:
        mov     r8, rdi
        lea     rdi, [r8+1]
        cmp     rdi, rsi
        jb      .L18
.L10:
        ret
```
<p>The <code>-O3</code> / <code>-O2 -ftree-partial-pre</code> version</p>
```selection_nostore_sort(std::vector<unsigned long, std::allocator<unsigned long> >&):
        mov     rax, QWORD PTR [rdi+8]
        mov     r10, QWORD PTR [rdi]
        mov     r9, rax
        sub     r9, r10
        sar     r9, 3
        cmp     r10, rax
        je      .L21
        push    r12
        lea     r11, [r10+8]
        push    rbp
        push    rbx
        xor     ebx, ebx
        lea     rbp, [rbx+1]
        cmp     rbp, r9
        jnb     .L10
.L26:
        mov     r12, QWORD PTR [r11-8]
        mov     rax, r11
        mov     rdx, rbp
        mov     r8, rbx
        mov     rsi, r12
        jmp     .L14
.L25:
        add     rdx, 1
        lea     rdi, [r10+r8*8]
        add     rax, 8
        cmp     rdx, r9
        je      .L24
.L14:
        mov     rcx, QWORD PTR [rax]
        mov     rdi, rax
        cmp     rcx, rsi
        jnb     .L25
        mov     r8, rdx
        add     rdx, 1
        mov     rsi, rcx
        add     rax, 8
        cmp     rdx, r9
        jne     .L14
.L24:
        cmp     r8, rbx
        je      .L15
        mov     QWORD PTR [rdi], r12
        mov     QWORD PTR [r11-8], rsi
.L15:
        mov     rbx, rbp
        add     r11, 8
        lea     rbp, [rbx+1]
        cmp     rbp, r9
        jb      .L26
.L10:
        pop     rbx
        pop     rbp
        pop     r12
        ret
.L21:
        ret
```

Body:
When implementing different sort algorithms for my computer science class I stumbled upon a curious optimization case with GCC(version 12.2).

I tried programming selection sort with two different variants: once storing the value of the current minimum (selection_sort) and once with only storing the index of the current minimum value (selection_nostore_sort)

links to godbolt and quick-bench (code & relevant assembly is also down below):

https://gcc.godbolt.org/z/Gdab1xenf

https://quick-bench.com/q/5xh06k8DD9qi1RCFvFMVBdbkDuw

I was expecting the nostore version to be slower because it has to reach out into the array for comparisons.
This was the case up to -O2, however with -O3 nostore runs about 10% faster (both on my local machine i7-10750H and quick-bench)
Testing out all the extra optimizations that -O3enables I was able to figure out that -O2 -ftree-partial-pre produces the same result.

When checking out the generated assembly in both cases I noticed that -ftree-partial-pre actually produces more assembler code yet runs faster.

I dont see any obvious reason why the -ftree-partial-pre version runs faster, what could be the causes here?
Thanks a lot for your help! My professors were sadly unable to give me an explanation.

#include <vector>
#include <random>
#include <functional>
using std::size_t;

const size_t DATA_ELEMS = 10'000;
const size_t RAND_RANGE = 1'000'000;

std::vector<size_t> random_data()
{
    std::srand(42);
    std::vector<size_t> result(DATA_ELEMS);
    const auto rand_size_t_range = [] () -> size_t {
        return std::rand() % RAND_RANGE;
    };
    std::generate(result.begin(), result.end(), rand_size_t_range);

    return result;
}

inline void swap(std::vector<size_t> &a, size_t i1, size_t i2)
{
    size_t h = a[i1];
    a[i1] = a[i2];
    a[i2] = h;
}

void selection_sort(std::vector<size_t> &a)
{

    for (size_t k = 0; k < a.size(); k++)
    {
        size_t min = a[k];
        size_t i_min = k;
        for (size_t i = k + 1; i < a.size(); i++)
        {
            if (a[i] < min)
            {
                min = a[i];
                i_min = i;
            }
        }
        if (i_min != k)
        {
            swap(a, i_min, k);
        }
    }
}

/*
    This is normally quite a bit slower than selection_sort
    However compiling with -02 -ftree-partial-pre seems to make this function
    quite a bit faster than selection_sort
*/
void selection_nostore_sort(std::vector<size_t> &a)
{
    for (size_t k = 0; k < a.size(); k++)
    {
        size_t i_min = k;
        for (size_t i = k + 1; i < a.size(); i++)
        {
            if (a[i] < a[i_min])
            {
                i_min = i;
            }
        }
        if (i_min != k)
        {
            swap(a, i_min, k);
        }
    }
}

The -O2 version

selection_nostore_sort(std::vector<unsigned long, std::allocator<unsigned long> >&):
        mov     rax, QWORD PTR [rdi+8]
        mov     rcx, QWORD PTR [rdi]
        mov     rsi, rax
        sub     rsi, rcx
        sar     rsi, 3
        cmp     rcx, rax
        je      .L10
        xor     r8d, r8d
        lea     rdi, [r8+1]
        cmp     rdi, rsi
        jnb     .L10
.L18:
        mov     rax, rdi
        mov     rdx, r8
.L13:
        mov     r9, QWORD PTR [rcx+rdx*8]
        cmp     QWORD PTR [rcx+rax*8], r9
        cmovb   rdx, rax
        add     rax, 1
        cmp     rsi, rax
        jne     .L13
        cmp     rdx, r8
        je      .L14
        lea     rax, [rcx+rdx*8]
        mov     r8, QWORD PTR [rcx-8+rdi*8]
        mov     rdx, QWORD PTR [rax]
        mov     QWORD PTR [rax], r8
        mov     QWORD PTR [rcx-8+rdi*8], rdx
.L14:
        mov     r8, rdi
        lea     rdi, [r8+1]
        cmp     rdi, rsi
        jb      .L18
.L10:
        ret

The -O3 / -O2 -ftree-partial-pre version

selection_nostore_sort(std::vector<unsigned long, std::allocator<unsigned long> >&):
        mov     rax, QWORD PTR [rdi+8]
        mov     r10, QWORD PTR [rdi]
        mov     r9, rax
        sub     r9, r10
        sar     r9, 3
        cmp     r10, rax
        je      .L21
        push    r12
        lea     r11, [r10+8]
        push    rbp
        push    rbx
        xor     ebx, ebx
        lea     rbp, [rbx+1]
        cmp     rbp, r9
        jnb     .L10
.L26:
        mov     r12, QWORD PTR [r11-8]
        mov     rax, r11
        mov     rdx, rbp
        mov     r8, rbx
        mov     rsi, r12
        jmp     .L14
.L25:
        add     rdx, 1
        lea     rdi, [r10+r8*8]
        add     rax, 8
        cmp     rdx, r9
        je      .L24
.L14:
        mov     rcx, QWORD PTR [rax]
        mov     rdi, rax
        cmp     rcx, rsi
        jnb     .L25
        mov     r8, rdx
        add     rdx, 1
        mov     rsi, rcx
        add     rax, 8
        cmp     rdx, r9
        jne     .L14
.L24:
        cmp     r8, rbx
        je      .L15
        mov     QWORD PTR [rdi], r12
        mov     QWORD PTR [r11-8], rsi
.L15:
        mov     rbx, rbp
        add     r11, 8
        lea     rbp, [rbx+1]
        cmp     rbp, r9
        jb      .L26
.L10:
        pop     rbx
        pop     rbp
        pop     r12
        ret
.L21:
        ret


问:
Can we wrap all our API in one Circute Breaker
Can I wrap more than 2 API's in my circuit Breaker can i do that

I am facing a problem in wraping 2 api's in my ckt breaker


问:
Is it possible to set timeout for any connection to host.docker.internal in java application under docker containter?
I'm connecting to database service running on localhost. Via java program running on docker I would like to connect to that service.
Here is small example:

```<code>Connection con = DriverManager.getConnection("jdbc:db2://host.docker.internal:1000/database","user","******");
logger.info("connection created");
</code>```

In case, that database service isn't available, getting connection will never expire. So no timeout exception or unable to connect exception will be thrown. Thread will be remain seated and will not end.
And this will happen not just for jdbc connection, but also for e.g. http, jms, ...

Is it possible to set timeout in docker for host.docker.internal?

Body:
I'm connecting to database service running on localhost. Via java program running on docker I would like to connect to that service.
Here is small example:

Connection con = DriverManager.getConnection("jdbc:db2://host.docker.internal:1000/database","user","******");
logger.info("connection created");

In case, that database service isn't available, getting connection will never expire. So no timeout exception or unable to connect exception will be thrown. Thread will be remain seated and will not end.
And this will happen not just for jdbc connection, but also for e.g. http, jms, ...

Is it possible to set timeout in docker for host.docker.internal?


问:
Microsoft Graph - Trouble in Contact Folder / Categories API(s)
There are couple of issues in Graph API for contact folders when used in personal accounts(***@outlook.com)

Issue 1: Contact Folder(Categories) created via graph API is not visible in Outlook UI(even after multiple refreshes over 5 minutes).

-The folder (Folder from API) which was created via API is not visible in Outlook UI (refer image #2) but the getContactFolder API returns the folder (refer image #1)

Issue 2: Above mentioned folder (Folder from API) becomes visible in Outlook UI when a contact is created via graph API inside the folder. (Refer Image #3)

Issue 3: While creating a contact in Outlook UI, the category list is not consistent. Categories created via API are missing. Refer image #4

Issue 4: Change notifications are not consistent for the folders created via API. Microsoft sends the notification only to the contacts created inside the folder via API but not from the UI.

```<code>POST https://graph.microsoft.com/v1.0/me/contactfolders/{folderId}/contacts

{"givenName":"Test Contact"}
</code>```

Steps to reproduce to issue 4

Step 1:Subscribe for change notifications for the folder created via API.

Step 2: From Outlook UI, create a category with same name as step #1
(refer image #4)

Image 1: Graph API response

Image 2: Outlook UI after folder creation

Image 3: Outlook UI after contact creation in folder via API

Image 4: Category "Folder From API" is not listed during search

Body:
There are couple of issues in Graph API for contact folders when used in personal accounts(***@outlook.com)

Issue 1: Contact Folder(Categories) created via graph API is not visible in Outlook UI(even after multiple refreshes over 5 minutes).

-The folder (Folder from API) which was created via API is not visible in Outlook UI (refer image #2) but the getContactFolder API returns the folder (refer image #1)

Issue 2: Above mentioned folder (Folder from API) becomes visible in Outlook UI when a contact is created via graph API inside the folder. (Refer Image #3)

Issue 3: While creating a contact in Outlook UI, the category list is not consistent. Categories created via API are missing. Refer image #4

Issue 4: Change notifications are not consistent for the folders created via API. Microsoft sends the notification only to the contacts created inside the folder via API but not from the UI.

POST https://graph.microsoft.com/v1.0/me/contactfolders/{folderId}/contacts

{"givenName":"Test Contact"}

Steps to reproduce to issue 4

Step 1:Subscribe for change notifications for the folder created via API.

Step 2: From Outlook UI, create a category with same name as step #1
(refer image #4)

Image 1: Graph API response

Image 2: Outlook UI after folder creation

Image 3: Outlook UI after contact creation in folder via API

Image 4: Category "Folder From API" is not listed during search


问:
Exporting Probit regression results to LATEX with additional statistics (z values, LR chi^2, and Pseduo-R^2)?
I'm new to all of this so will very much appreciate any help at all!

I have a "glm" model results that I want to export to Latex, in the form of a table.
I've tried to use the "texreg" package, but couldn't find a way to add to the table some statistics like:
z-value, LR chi^2, and Pseduo-R^2.

Does anyone know an easy way of doing it?

this is the code that I currently run:

```<code>texreg(
  l = list(extract_probit_model_Emp, extract_probit_model_lfp),
  file = "results/probit_test",
  stars = c(0.01, 0.05, 0.1),
  custom.header = list("probit" = 1:2),
  custom.model.names = c("Employment", "LFP"),
  omit.coef = "control",
  center = TRUE,
  caption = "Probit Test on Employment and LFP")
</code>```

I wonder if there is any way of doind it with the texreg package, or is there another one that is easy to handle?

Thanks in advance!

PS:
I have the same problem with exporting OLS reg results. Guess this is roughly the same?

Body:
I'm new to all of this so will very much appreciate any help at all!

I have a "glm" model results that I want to export to Latex, in the form of a table.
I've tried to use the "texreg" package, but couldn't find a way to add to the table some statistics like:
z-value, LR chi^2, and Pseduo-R^2.

Does anyone know an easy way of doing it?

this is the code that I currently run:

texreg(
  l = list(extract_probit_model_Emp, extract_probit_model_lfp),
  file = "results/probit_test",
  stars = c(0.01, 0.05, 0.1),
  custom.header = list("probit" = 1:2),
  custom.model.names = c("Employment", "LFP"),
  omit.coef = "control",
  center = TRUE,
  caption = "Probit Test on Employment and LFP")

I wonder if there is any way of doind it with the texreg package, or is there another one that is easy to handle?

Thanks in advance!

PS:
I have the same problem with exporting OLS reg results. Guess this is roughly the same?


问:
Convert "Chrome Performance Profile" to "Chrome JavaScript Profiler .cpuprofile"
Is there a way to convert Chrome Performance Profile json to .cpuprofile format ?</p>


问:
How to fix "attributeerror module 'numba' has no attribute 'core'"
I am using the package sktime and I wanted to use the RocketClassifier. Somehow when I run from sktime.classification.kernel_based import RocketClassifier from the python console it works. But when I run the code in a Jupyter Notebook (VS Code) I get following error: attributeerror module 'numba' has no attribute 'core.
I have numba version 58.0.4. Have someone maybe a solution for that or can someone explain me, why it is not working?


问:
Reducing load time on a wordpress post-type with multiple tinyMCE fields within repeatable fields
We are working for a client and in that process we have made a post-type that requires multiple tinyMCE editor areas within repeatable fields made with advanced custom fields. The issue with this is that the amount of time it takes to load is too slow to make it an effective tool for the client to use.

I have searched stackoverflow and google for a solution to this issue, but i cannot seem to read my way to a solutions to implement in order to solve the slow page speed for this.

We are on:

WP 6.1.1

PHP 8.1

SQL 5.7.34

ACF 6.0.5

We would appreciate:

Possible workarounds

Solutions or link to solutions

Advice on which measures to try out

Alternatives


问:
Troubleshoot when and why `Subscription Filter` of a log group is deleted
I can see that the Subscription Filter of a log group is deleted and want to know when and how it got deleted.

I looked into cloud trail but not able to get any DeleteSubscriptionFilter events there. Only events available there is DescribeSubscriptionFilters but that was not much use, at least I was not able to get much information from there.

Thanks in advance


问:
Why do we need to create item and object on fabric chain?
I am looking at the sample codes of the hyperledger fabric NFT example and I see that after adding itemonchain in the ledger state, they add nftonchain in the ledger state as well.

Why do we need to add 2 different objects in the chain?

I refer to these lines from the code

```<code>let item = objectBuilder.itemOnchainStruct(payload, imageName, imageHash, signedDataStr);
let nft = objectBuilder.nftOnchainStruct(item, payload, callerInfo.username, aesKey);

let payloadForOnchain = [];
payloadForOnchain.push(JSON.stringify(item));
payloadForOnchain.push(JSON.stringify(nft));
</code>```

Body:
I am looking at the sample codes of the hyperledger fabric NFT example and I see that after adding itemonchain in the ledger state, they add nftonchain in the ledger state as well.

Why do we need to add 2 different objects in the chain?

I refer to these lines from the code

let item = objectBuilder.itemOnchainStruct(payload, imageName, imageHash, signedDataStr);
let nft = objectBuilder.nftOnchainStruct(item, payload, callerInfo.username, aesKey);

let payloadForOnchain = [];
payloadForOnchain.push(JSON.stringify(item));
payloadForOnchain.push(JSON.stringify(nft));


问:
How do I replace sb/lb with sw/lw
So on my assignment, I have to process a string typed from console and remove CONTROL characters like (!@#$%^&*...), I know it can be done with sb/lb, but our professor wants us to read each character using lw/sw. I don't want the answer but how in heavens do you do such a thing??? I figured out a way but the memory is the problem what memory alignment should I have to my arrays, where I save the characters.

I think the solution has to do with sll and srl BUT the saving the characters is the problem.

Title: How do I replace sb/lb with sw/lw


问:
R - Adding ggplots (calendR) into a gt table
I want to create a table of calendar plots. I used calendR to create the plots (over 70 plots) and I want to get them into a table. I often work with gt tables and I found a working function for adding ggplots to the table.

```<code>library(calendR)
library(gt)
plot = calendR(start = "M",               # Weeks start on Monday
        mbg.col = 4,               # Background color of the month names
        months.col = "white",      # Color of the text of the month names
        special.days = "weekend",  # Color the weekends
        special.col = "lightblue", # Color of the special.days
        lty = 0,                   # Line type (no line)
        weeknames = c("M", "T",  # Week names
                      "W", "T",
                      "F", "S",
                      "S"),
        title.size = 20,   # Title size
        orientation = "p")      # Background image

dplyr::tibble(
  Year1 = NA,
  Year2 = NA
) %>%
  gt() %>%
  text_transform(
    locations = cells_body(columns = c(Year1, Year2)),
    fn = function(x) {
      plot %>%
        ggplot_image(height = px(300))
    }
  )
</code>```

As you see, the plots are not readable because they are too big or do not have the right resolution. How can I solve this problem? I want to have at least 2 plots a row, more would be great.

Body:
I want to create a table of calendar plots. I used calendR to create the plots (over 70 plots) and I want to get them into a table. I often work with gt tables and I found a working function for adding ggplots to the table.

library(calendR)
library(gt)
plot = calendR(start = "M",               # Weeks start on Monday
        mbg.col = 4,               # Background color of the month names
        months.col = "white",      # Color of the text of the month names
        special.days = "weekend",  # Color the weekends
        special.col = "lightblue", # Color of the special.days
        lty = 0,                   # Line type (no line)
        weeknames = c("M", "T",  # Week names
                      "W", "T",
                      "F", "S",
                      "S"),
        title.size = 20,   # Title size
        orientation = "p")      # Background image

dplyr::tibble(
  Year1 = NA,
  Year2 = NA
) %>%
  gt() %>%
  text_transform(
    locations = cells_body(columns = c(Year1, Year2)),
    fn = function(x) {
      plot %>%
        ggplot_image(height = px(300))
    }
  )

As you see, the plots are not readable because they are too big or do not have the right resolution. How can I solve this problem? I want to have at least 2 plots a row, more would be great.


问:
Entity Framework: How to include or handle records that fail in a .Join operation
I have an issue at the moment where I'm trying to join two tables and then select records however if the join fails then this means that the records where the join failed are omitted from the results. I'd still like them to be included and maybe just enter some default value in the one property that's used from the join.

My current query is:

`

```<code>var query = _context.spl.Where(x => x.Active == true)
                .Join(_context.GeographyPostCodesGeolocations, spl => spl.ServiceProviderLocPostcode1 + " " + spl.ServiceProviderLocPostcode2, pc => pc.PostCode, (spl, pc) => new
                {
                    serviceProviderLocation = spl,
                    postCodeData = pc,
                    distanceFromLoc = postCodeGeoObj != null ? Math.Sqrt(Math.Pow((pc.Eastings - postCodeGeoObj.Eastings), 2) + Math.Pow((pc.Northings - postCodeGeoObj.Northings), 2)) * 0.000621 : 0
                })
                .Select(x => new ServiceProviderLocationListViewModel
                {
                    DistanceFromVehicleLoc = x.distanceFromLoc,
                    Eastings = x.postCodeData.Eastings,
                    Northings = x.postCodeData.Northings,
                    ServiceProviderLocation = x.serviceProviderLocation.serviceProviderLocName
                })
                .AsQueryable();
</code>```

`

As you can see at the moment it's not possible for the .select to work unless the join works as the objects in there require the join to have worked.

Is there some way to catch any items that don't work within the .join? I found some info on DefaultIfEmpty but I couldn't seem to get that to work. The other tricky bit is that this is a queryable as there are filters applied afterwards when querying.

Body:
I have an issue at the moment where I'm trying to join two tables and then select records however if the join fails then this means that the records where the join failed are omitted from the results. I'd still like them to be included and maybe just enter some default value in the one property that's used from the join.

My current query is:

`

var query = _context.spl.Where(x => x.Active == true)
                .Join(_context.GeographyPostCodesGeolocations, spl => spl.ServiceProviderLocPostcode1 + " " + spl.ServiceProviderLocPostcode2, pc => pc.PostCode, (spl, pc) => new
                {
                    serviceProviderLocation = spl,
                    postCodeData = pc,
                    distanceFromLoc = postCodeGeoObj != null ? Math.Sqrt(Math.Pow((pc.Eastings - postCodeGeoObj.Eastings), 2) + Math.Pow((pc.Northings - postCodeGeoObj.Northings), 2)) * 0.000621 : 0
                })
                .Select(x => new ServiceProviderLocationListViewModel
                {
                    DistanceFromVehicleLoc = x.distanceFromLoc,
                    Eastings = x.postCodeData.Eastings,
                    Northings = x.postCodeData.Northings,
                    ServiceProviderLocation = x.serviceProviderLocation.serviceProviderLocName
                })
                .AsQueryable();

`

As you can see at the moment it's not possible for the .select to work unless the join works as the objects in there require the join to have worked.

Is there some way to catch any items that don't work within the .join? I found some info on DefaultIfEmpty but I couldn't seem to get that to work. The other tricky bit is that this is a queryable as there are filters applied afterwards when querying.