问:
tf.keras.metrics.TrueNegatives keep on getting added on every epoch. Value doesn't seem to reset after each epoch
I am training a DeepFM model by DeepCTR. During training, the metrics are wrongly calculated. The  confusion matrix metrics(TP, FP, TN, FN) doesn't seem to reset after each epoch and keeps on adding.

The metrics are defined as

METRICS = [
    tf.keras.metrics.TruePositives(name='tp'),
    tf.keras.metrics.FalsePositives(name='fp'),
    tf.keras.metrics.TrueNegatives(name='tn'),
    tf.keras.metrics.FalseNegatives(name='fn'),
    tf.keras.metrics.Precision(name='precision'),
    tf.keras.metrics.Recall(name='recall'),
    tf.keras.metrics.AUC(name='auc'),
    tf.keras.metrics.AUC(name='prc', curve='PR'), # precision-recall curve
    tf.keras.metrics.BinaryCrossentropy(name='bce'),
]
```
<p>The sum of confusion matrix increases exponentially topping the number of training samples I have.</p>
<pre class="lang-bash prettyprint-override"><code>Epoch 1/5
69/69 [==============================] - 4s 29ms/step - loss: 0.6810 - tp: 154.6667 - fp: 333572.0625 - tn: 239617.6094 - fn: 52.3478 - precision: 4.5102e-04 - recall: 0.7916 - auc: 0.5877 - prc: 5.0342e-04 - bce: 0.6911
Epoch 2/5
69/69 [==============================] - 2s 27ms/step - loss: 0.5650 - tp: 442.0580 - fp: 782765.5625 - tn: 917517.3125 - fn: 179.7101 - precision: 5.5941e-04 - recall: 0.7099 - auc: 0.6618 - prc: 9.4619e-04 - bce: 0.6555
Epoch 3/5
69/69 [==============================] - 2s 28ms/step - loss: 0.1199 - tp: 792.6667 - fp: 973029.1250 - tn: 1854353.7500 - fn: 237.1304 - precision: 8.1280e-04 - recall: 0.7671 - auc: 0.7935 - prc: 0.0402 - bce: 0.5320
Epoch 4/5
69/69 [==============================] - 2s 27ms/step - loss: 0.0099 - tp: 1195.8406 - fp: 984204.6250 - tn: 2970279.2500 - fn: 241.0000 - precision: 0.0012 - recall: 0.8311 - auc: 0.8924 - prc: 0.1829 - bce: 0.3886
Epoch 5/5
69/69 [==============================] - 2s 29ms/step - loss: 0.0074 - tp: 1603.8406 - fp: 984474.1875 - tn: 4097109.2500 - fn: 241.0000 - precision: 0.0016 - recall: 0.8688 - auc: 0.9353 - prc: 0.2926 - bce: 0.3021
</code>```

Tried overriding the TruePositive class as

class TruePositives(tf.keras.metrics.TruePositives):
    def reset_states(self):
        print('Resetting TruePositives')
        super().reset_states()

    def update_state(self, y_true, y_pred, sample_weight=None):
        super().update_state(y_true, y_pred, sample_weight)

    def result(self):
        return super().result()
```

to check if the reset function is being called.

It is not being called.

Similar problem encountered here

Body:
I am training a DeepFM model by DeepCTR. During training, the metrics are wrongly calculated. The  confusion matrix metrics(TP, FP, TN, FN) doesn't seem to reset after each epoch and keeps on adding.

The metrics are defined as

METRICS = [
    tf.keras.metrics.TruePositives(name='tp'),
    tf.keras.metrics.FalsePositives(name='fp'),
    tf.keras.metrics.TrueNegatives(name='tn'),
    tf.keras.metrics.FalseNegatives(name='fn'),
    tf.keras.metrics.Precision(name='precision'),
    tf.keras.metrics.Recall(name='recall'),
    tf.keras.metrics.AUC(name='auc'),
    tf.keras.metrics.AUC(name='prc', curve='PR'), # precision-recall curve
    tf.keras.metrics.BinaryCrossentropy(name='bce'),
]

The sum of confusion matrix increases exponentially topping the number of training samples I have.

Epoch 1/5
69/69 [==============================] - 4s 29ms/step - loss: 0.6810 - tp: 154.6667 - fp: 333572.0625 - tn: 239617.6094 - fn: 52.3478 - precision: 4.5102e-04 - recall: 0.7916 - auc: 0.5877 - prc: 5.0342e-04 - bce: 0.6911
Epoch 2/5
69/69 [==============================] - 2s 27ms/step - loss: 0.5650 - tp: 442.0580 - fp: 782765.5625 - tn: 917517.3125 - fn: 179.7101 - precision: 5.5941e-04 - recall: 0.7099 - auc: 0.6618 - prc: 9.4619e-04 - bce: 0.6555
Epoch 3/5
69/69 [==============================] - 2s 28ms/step - loss: 0.1199 - tp: 792.6667 - fp: 973029.1250 - tn: 1854353.7500 - fn: 237.1304 - precision: 8.1280e-04 - recall: 0.7671 - auc: 0.7935 - prc: 0.0402 - bce: 0.5320
Epoch 4/5
69/69 [==============================] - 2s 27ms/step - loss: 0.0099 - tp: 1195.8406 - fp: 984204.6250 - tn: 2970279.2500 - fn: 241.0000 - precision: 0.0012 - recall: 0.8311 - auc: 0.8924 - prc: 0.1829 - bce: 0.3886
Epoch 5/5
69/69 [==============================] - 2s 29ms/step - loss: 0.0074 - tp: 1603.8406 - fp: 984474.1875 - tn: 4097109.2500 - fn: 241.0000 - precision: 0.0016 - recall: 0.8688 - auc: 0.9353 - prc: 0.2926 - bce: 0.3021

Tried overriding the TruePositive class as

class TruePositives(tf.keras.metrics.TruePositives):
    def reset_states(self):
        print('Resetting TruePositives')
        super().reset_states()

    def update_state(self, y_true, y_pred, sample_weight=None):
        super().update_state(y_true, y_pred, sample_weight)

    def result(self):
        return super().result()

to check if the reset function is being called.

It is not being called.

Similar problem encountered here


来源: stackexchange

问:
I am trying to iterate over ArrayType of Structs, how can I do that? I see there are no specific functions in class ArrayType to do this
This is the snippet:

ArrayType(
StructType(
[
StructField(“EmpID”, StringType(), True),
StructField(
“EmpAdd”,
StructType(
[
StructField(“HouseNo”, StringType(), True),
StructField(“City”, StringType(), True),
]
),
True,
),
]
),
True,
)

Expected:

Iterate over this and get all the elements:

StructType(
[
StructField(“EmpID”, StringType(), True),
StructField(
“EmpAdd”,
StructType(
[
StructField(“HouseNo”, StringType(), True),
StructField(“City”, StringType(), True),
]
),
True,
),
]
),
True,

I dont find any method to iterate over this

ContentLicense: CC BY-SA 4.0


问:
Using Components from different file with CDN
This is what I got:

import Header from "./components/Header";

function List() {
    return (

Was first released in 2013

Was originally created by Jordan Walke

Has well over 100K stars on Github

Is maintained by Facebook

Powers thousands of enterprise apps, including mobile apps

    );
}

const page = (

        <List></List>

)

// React 18:
ReactDOM.createRoot(document.getElementById("root")).render(page);```
<pre class="snippet-code-css lang-css prettyprint-override"><code>html, body {
    margin: 0;
    padding: 0;
}</code>```

        <link rel="stylesheet" href="index.css">

```
</div>
</div>
</p>
<p>And my components/header.js file:</p>
```import React from "react";

export default function Header() {
    return (

Fun facts about React

    );
}
```

If I add the Header function to my index.js file it works fine.
But I can't get it to work in a different file.

Any suggestions on what I am doing wrong?

Body:
This is what I got:

import Header from "./components/Header";

function List() {
    return (

Was first released in 2013

Was originally created by Jordan Walke

Has well over 100K stars on Github

Is maintained by Facebook

Powers thousands of enterprise apps, including mobile apps

    );
}

const page = (

        <List></List>

)

// React 18:
ReactDOM.createRoot(document.getElementById("root")).render(page);

html, body {
    margin: 0;
    padding: 0;
}

        <link rel="stylesheet" href="index.css">

And my components/header.js file:

import React from "react";

export default function Header() {
    return (

Fun facts about React

    );
}

If I add the Header function to my index.js file it works fine.
But I can't get it to work in a different file.

Any suggestions on what I am doing wrong?


问:
How to make parts of a json string bold in react native
I have a json file like this...

```<code> {
    "key1": "key1",
    "value1": "I only want this part of the text to be bold",

    "key2": "key2",
    "value2": "I don't want any text here to be bold"
 }
</code>```

I am rendering the content in the following way...

```<code>...
...
<Text style={styles.normalText}>{jsonData.get(item.value)}</Text>
...
...
</code>```

Where styles.normalText is...

```<code>normalText: {
    fontSize: 15,
    lineHeight: 21,
    fontWeight: '400',
    paddingBottom: 24,
},
</code>```

Now I want only "this part" words from value1 of json to be bold. I don't have any clue how to achieve that. I don't want to use InnerHTML since it is vulnerable to XSS injection. But I want to do something like defining my own custom style like...

```<code>boldText: {
    fontSize: 15,
    lineHeight: 21,
    fontWeight: '700',
    paddingBottom: 24,
},
</code>```

and use <boldText> </boldText> tag in the json file wherever I want bold text. Is this possible?

Body:
I have a json file like this...

 {
    "key1": "key1",
    "value1": "I only want this part of the text to be bold",

    "key2": "key2",
    "value2": "I don't want any text here to be bold"
 }

I am rendering the content in the following way...

...
...
<Text style={styles.normalText}>{jsonData.get(item.value)}</Text>
...
...

Where styles.normalText is...

normalText: {
    fontSize: 15,
    lineHeight: 21,
    fontWeight: '400',
    paddingBottom: 24,
},

Now I want only "this part" words from value1 of json to be bold. I don't have any clue how to achieve that. I don't want to use InnerHTML since it is vulnerable to XSS injection. But I want to do something like defining my own custom style like...

boldText: {
    fontSize: 15,
    lineHeight: 21,
    fontWeight: '700',
    paddingBottom: 24,
},

and use <boldText> </boldText> tag in the json file wherever I want bold text. Is this possible?


问:
Browser Error in Console. => Firefox can’t establish a connection to the server at ws://127.0.0.1:56997/
I am building a fullstack project in vscode. but I am getting this error on every browser consoles. and this error keeps coming repeatedly:

Firefox can’t establish a connection to the server at ws://127.0.0.1:56997/.a1aw

How can this be fixed?

I am not using any websocket config.


问:
how to get equipments based on distance from firestore and use it in streambuilder?
I am using streambuilder to fetch documents from firestore and pass individual data to listTile . I want to put a condition to fetch only equipments within 10 km range. In my database , the location is in the format of geopoint [latitute,longitude]. I used geoquery to restrict the equipments within particular range. But I got to know that it only fetches based on latitude and not longitude.
How to run a geo "nearby" query with firestore? - from this answer it is clear that we have to use geohashes for this query. But I am not sure exactly where to use it in my code. Below is my code

```<code> Expanded(
            child: TabBarView(
            children: _site == BestTutorSite.sell
                ? [
                    equipmentListStreamBuilder(
                        'SellEquipments', 'equipmentType.Tractor'),
                    equipmentListStreamBuilder(
                        'SellEquipments', 'equipmentType.Implement'),
                    equipmentListStreamBuilder(
                        'SellEquipments', 'equipmentType.Harvester'),
                  ]
                : [
                    equipmentListStreamBuilder(
                        'RentEquipments', 'equipmentType.Tractor'),
                    equipmentListStreamBuilder(
                        'RentEquipments', 'equipmentType.Implement'),
                    equipmentListStreamBuilder(
                        'RentEquipments', 'equipmentType.Harvester'),
                  ]),)

 StreamBuilder<QuerySnapshot<Object?>> equipmentListStreamBuilder(
  collectionName, eType) {
return StreamBuilder<QuerySnapshot>(
  stream: FirebaseFirestore.instance
      .collection(collectionName)
      .where("equipmentType", isEqualTo: eType)
      .where("geopoint", isLessThan: greaterGeopoint)
      .where("geopoint", isGreaterThan: lesserGeopoint)
      .snapshots(),
  builder: (context, snapshot) {
    return !snapshot.hasData
        ? Center(child: CircularProgressIndicator())
        : ListView.builder(
            itemCount: snapshot.data!.docs.length,
            itemBuilder: (context, index) {
              DocumentSnapshot data = snapshot.data!.docs[index];
             return ListTile(
                leading: Icon(Icons.car_rental),
                title: Text(data['brand'].toString()),
                subtitle: Text("prem"),
                trailing: Icon(Icons.more_vert),
              );
            },
          );
  },
);

getNearByEquipments(double latitude, double longitude, double distance) {
print("---------inside getequipments");
// ~1 mile of lat and lon in degrees
double lat = 0.0144927536231884;
double lon = 0.0181818181818182;

double lowerLat = latitude - (lat * distance);

double lowerLon = longitude - (lon * distance);

double greaterLat = latitude + (lat * distance);
double greaterLon = longitude + (lon * distance);
setState(() {
  lesserGeopoint = GeoPoint(lowerLat, lowerLon);
  greaterGeopoint = GeoPoint(greaterLat, greaterLon);
});
</code>```

}

Body:
I am using streambuilder to fetch documents from firestore and pass individual data to listTile . I want to put a condition to fetch only equipments within 10 km range. In my database , the location is in the format of geopoint [latitute,longitude]. I used geoquery to restrict the equipments within particular range. But I got to know that it only fetches based on latitude and not longitude.
How to run a geo "nearby" query with firestore? - from this answer it is clear that we have to use geohashes for this query. But I am not sure exactly where to use it in my code. Below is my code

 Expanded(
            child: TabBarView(
            children: _site == BestTutorSite.sell
                ? [
                    equipmentListStreamBuilder(
                        'SellEquipments', 'equipmentType.Tractor'),
                    equipmentListStreamBuilder(
                        'SellEquipments', 'equipmentType.Implement'),
                    equipmentListStreamBuilder(
                        'SellEquipments', 'equipmentType.Harvester'),
                  ]
                : [
                    equipmentListStreamBuilder(
                        'RentEquipments', 'equipmentType.Tractor'),
                    equipmentListStreamBuilder(
                        'RentEquipments', 'equipmentType.Implement'),
                    equipmentListStreamBuilder(
                        'RentEquipments', 'equipmentType.Harvester'),
                  ]),)

 StreamBuilder<QuerySnapshot<Object?>> equipmentListStreamBuilder(
  collectionName, eType) {
return StreamBuilder<QuerySnapshot>(
  stream: FirebaseFirestore.instance
      .collection(collectionName)
      .where("equipmentType", isEqualTo: eType)
      .where("geopoint", isLessThan: greaterGeopoint)
      .where("geopoint", isGreaterThan: lesserGeopoint)
      .snapshots(),
  builder: (context, snapshot) {
    return !snapshot.hasData
        ? Center(child: CircularProgressIndicator())
        : ListView.builder(
            itemCount: snapshot.data!.docs.length,
            itemBuilder: (context, index) {
              DocumentSnapshot data = snapshot.data!.docs[index];
             return ListTile(
                leading: Icon(Icons.car_rental),
                title: Text(data['brand'].toString()),
                subtitle: Text("prem"),
                trailing: Icon(Icons.more_vert),
              );
            },
          );
  },
);

getNearByEquipments(double latitude, double longitude, double distance) {
print("---------inside getequipments");
// ~1 mile of lat and lon in degrees
double lat = 0.0144927536231884;
double lon = 0.0181818181818182;

double lowerLat = latitude - (lat * distance);

double lowerLon = longitude - (lon * distance);

double greaterLat = latitude + (lat * distance);
double greaterLon = longitude + (lon * distance);
setState(() {
  lesserGeopoint = GeoPoint(lowerLat, lowerLon);
  greaterGeopoint = GeoPoint(greaterLat, greaterLon);
});

}


问:
Checking the connection to local server
i want to check the connection from android app to the local server, what is the best way to check the connection every X second to do some work when the server is reachable

for now, I'm using this code

```<code>public static boolean itsOnline(Context context) {
    String host="google.com"; //put the local server ip instead
    try {
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
                .permitAll().build();

        StrictMode.setThreadPolicy(policy);

        Socket sock = new Socket();
        SocketAddress sockaddr = new InetSocketAddress(host,443);

        sock.connect(sockaddr, 2000);
        sock.close();
        Toast.makeText(context.getApplicationContext(), "Connected to : "+ host, Toast.LENGTH_SHORT).show();

        return true;
    } catch (IOException ioException) {
        Toast.makeText(context.getApplicationContext(), "Not Connected to : "+host, Toast.LENGTH_LONG).show();
        return false;
    }
</code>```

but i want to make it done continually, and if there is a better way i will appreciate any advice.

Title: Checking the connection to local server

Body:
i want to check the connection from android app to the local server, what is the best way to check the connection every X second to do some work when the server is reachable

for now, I'm using this code

public static boolean itsOnline(Context context) {
    String host="google.com"; //put the local server ip instead
    try {
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
                .permitAll().build();

        StrictMode.setThreadPolicy(policy);

        Socket sock = new Socket();
        SocketAddress sockaddr = new InetSocketAddress(host,443);

        sock.connect(sockaddr, 2000);
        sock.close();
        Toast.makeText(context.getApplicationContext(), "Connected to : "+ host, Toast.LENGTH_SHORT).show();

        return true;
    } catch (IOException ioException) {
        Toast.makeText(context.getApplicationContext(), "Not Connected to : "+host, Toast.LENGTH_LONG).show();
        return false;
    }

but i want to make it done continually, and if there is a better way i will appreciate any advice.


问:
Cannot import sparkdl into databricks notebook
As I said in the title, I cannot import sparkdl module into databricks.
I followed step by step this official tutorial sparkdl tutorial but when I simply put some code like:

```<code>from sparkdl import readImages
</code>```

I get an error that says I cannot import readImages from sparkdl, the same for other classes such DeepImageFeaturizer.

I checked and It seems there is some sort of problem with the versions of keras,tensorflow,sparkdl,h5py and the maven library spark-deep-learning so I'm looking for a stable combination beetween them.
Taking into account that from Databricks I can only install tensorflow from 2.5.0 up to newer version.

With the following versions:

```<code>tensorflow v 2.5.0, keras 2.2.4, 1.4.0-spark-deep-learning,h5py v 3.7.0
</code>```

I Got the following error while importing DeepImageFeaturizer

```<code>from sparkdl import DeepImageFeaturizer ImportError: cannot import name 'resnet50' from 'keras.applications' (/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/keras/applications/__init__.py)
</code>```

Any help or suggestion will be really appreciated

Body:
As I said in the title, I cannot import sparkdl module into databricks.
I followed step by step this official tutorial sparkdl tutorial but when I simply put some code like:

from sparkdl import readImages

I get an error that says I cannot import readImages from sparkdl, the same for other classes such DeepImageFeaturizer.

I checked and It seems there is some sort of problem with the versions of keras,tensorflow,sparkdl,h5py and the maven library spark-deep-learning so I'm looking for a stable combination beetween them.
Taking into account that from Databricks I can only install tensorflow from 2.5.0 up to newer version.

With the following versions:

tensorflow v 2.5.0, keras 2.2.4, 1.4.0-spark-deep-learning,h5py v 3.7.0

I Got the following error while importing DeepImageFeaturizer

from sparkdl import DeepImageFeaturizer ImportError: cannot import name 'resnet50' from 'keras.applications' (/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.9/site-packages/keras/applications/__init__.py)

Any help or suggestion will be really appreciated


问:
How can I change BLE connection parameters from bluetoothctl? (org.bluez.Error.Failed le-connection-abort-by-local)
I am trying to connect to a BLE smart lock from my Raspberry Pi Model 4 to open the lock. I have installed the latest BlueZ 5.66. I can successfully connect to the lock with hci_tool like this:

sudo hcitool lecc --random DE:44:38:02:AA:EA

With btmon I see the following:

```<code>Bluetooth monitor ver 5.66
= Note: Linux version 5.15.76-v7l+ (armv7l)                            0.028327
= Note: Bluetooth subsystem version 2.22                               0.028335
= New Index: E4:5F:01:12:67:74 (Primary,UART,hci0)              [hci0] 0.028338
= Open Index: E4:5F:01:12:67:74                                 [hci0] 0.028341
= Index Info: E4:5F:01:12:67:74 (Broadcom Corporation)          [hci0] 0.028345
@ MGMT Open: bluetoothd (privileged) version 1.21             {0x0001} 0.028348
@ RAW Open: hcitool (privileged) version 2.22                 {0x0002} 4.924550
@ RAW Close: hcitool                                          {0x0002} 4.924600
@ RAW Open: hcitool (privileged) version 2.22          {0x0002} [hci0] 4.924657
< HCI Command: LE Create Connection (0x08|0x000d) plen 25    #1 [hci0] 4.924801
        Scan interval: 2.500 msec (0x0004)
        Scan window: 2.500 msec (0x0004)
        Filter policy: Accept list is not used (0x00)
        Peer address type: Random (0x01)
        Peer address: DE:44:38:02:AA:EA (Static)
        Own address type: Public (0x00)
        Min connection interval: 18.75 msec (0x000f)
        Max connection interval: 18.75 msec (0x000f)
        Connection latency: 0 (0x0000)
        Supervision timeout: 32000 msec (0x0c80)
        Min connection length: 0.625 msec (0x0001)
        Max connection length: 0.625 msec (0x0001)
> HCI Event: Command Status (0x0f) plen 4                    #2 [hci0] 4.926433
      LE Create Connection (0x08|0x000d) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 31                   #3 [hci0] 14.452646
      LE Enhanced Connection Complete (0x0a)
        Status: Success (0x00)
        Handle: 64
        Role: Central (0x00)
        Peer address type: Random (0x01)
        Peer address: DE:44:38:02:AA:EA (Static)
        Local resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Peer resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Connection interval: 18.75 msec (0x000f)
        Connection latency: 0 (0x0000)
        Supervision timeout: 32000 msec (0x0c80)
        Central clock accuracy: 0x00
@ MGMT Event: Device Connected (0x000b) plen 13       {0x0001} [hci0] 14.452752
        LE Address: DE:44:38:02:AA:EA (Static)
        Flags: 0x00000008
          Connection Locally Initiated
        Data length: 0
@ RAW Open: btmon (privileged) version 2.22                  {0x0003} 14.453015
< HCI Command: LE Read Remote Used... (0x08|0x0016) plen 2  #4 [hci0] 14.453048
        Handle: 64 Address: DE:44:38:02:AA:EA (Static)
@ RAW Close: btmon                                           {0x0003} 14.453086
> HCI Event: Command Status (0x0f) plen 4                   #5 [hci0] 14.453388
      LE Read Remote Used Features (0x08|0x0016) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 11                   #6 [hci0] 14.503982
      LE Data Length Change (0x07)
        Handle: 64 Address: DE:44:38:02:AA:EA (Static)
        Max TX octets: 27
        Max TX time: 2120
        Max RX octets: 27
        Max RX time: 2120
> HCI Event: LE Meta Event (0x3e) plen 12                   #7 [hci0] 14.541397
      LE Read Remote Used Features (0x04)
        Status: Success (0x00)
        Handle: 64 Address: DE:44:38:02:AA:EA (Static)
        Features: 0x25 0x01 0x00 0x00 0x00 0x00 0x00 0x00
          LE Encryption
          Extended Reject Indication
          LE Data Packet Length Extension
          LE 2M PHY

[.. I cut out a lot here ...]

@ MGMT Event: New Connection Para.. (0x001c) plen 16  {0x0001} [hci0] 19.341463
        Store hint: Reserved (0xea)
        BR/EDR Address: 02:DE:44:38:02:AA (OUI 02-DE-44)
        Min connection interval: 320
        Max connection interval: 520
        Connection latency: 0 (0x0000)
        Supervision timeout: 400
< ACL Data TX: Handle 64 flags 0x00 dlen 10               #114 [hci0] 19.341506
      LE L2CAP: Connection Parameter Update Response (0x13) ident 3 len 2
        Result: Connection Parameters accepted (0x0000)
< HCI Command: LE Connection Upd.. (0x08|0x0013) plen 14  #115 [hci0] 19.341550
        Handle: 64 Address: DE:44:38:02:AA:EA (Static)
        Min connection interval: 400.00 msec (0x0140)
        Max connection interval: 650.00 msec (0x0208)
        Connection latency: 0 (0x0000)
        Supervision timeout: 4000 msec (0x0190)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4                 #116 [hci0] 19.343911
      LE Connection Update (0x08|0x0013) ncmd 1
        Status: Success (0x00)
> HCI Event: Number of Completed Packets (0x13) plen 5    #117 [hci0] 19.522890
        Num handles: 1
        Handle: 64 Address: DE:44:38:02:AA:EA (Static)
        Count: 1
> HCI Event: LE Meta Event (0x3e) plen 10                 #118 [hci0] 20.095076
      LE Connection Update Complete (0x03)
        Status: Success (0x00)
        Handle: 64 Address: DE:44:38:02:AA:EA (Static)
        Connection interval: 648.75 msec (0x0207)
        Connection latency: 0 (0x0000)
        Supervision timeout: 4000 msec (0x0190)
> HCI Event: Disconnect Complete (0x05) plen 4            #119 [hci0] 27.880662
        Status: Success (0x00)
        Handle: 64 Address: DE:44:38:02:AA:EA (Static)
        Reason: Remote User Terminated Connection (0x13)
@ MGMT Event: Device Disconnected (0x000c) plen 8     {0x0001} [hci0] 27.880723
        LE Address: DE:44:38:02:AA:EA (Static)
        Reason: Connection terminated by remote host (0x03)
@ RAW Close: hcitool                                  {0x0002} [hci0] 45.071448
</code>```

However, from my app in Python I use the bleak library, which in turn uses Bluez to establish the connection. This fails and I tried to connect using bluetoothctl via the command line. The connection parameters in btmon look entirely different, and I get an error on the command line after a while:

```<code>[bluetooth]# connect DE:44:38:02:AA:EA
Attempting to connect to DE:44:38:02:AA:EA
Failed to connect: org.bluez.Error.Failed le-connection-abort-by-local
</code>```

btmon:

```<code>Bluetooth monitor ver 5.66
= Note: Linux version 5.15.76-v7l+ (armv7l)                            0.605856
= Note: Bluetooth subsystem version 2.22                               0.605871
= New Index: E4:5F:01:12:67:74 (Primary,UART,hci0)              [hci0] 0.605877
= Open Index: E4:5F:01:12:67:74                                 [hci0] 0.605881
= Index Info: E4:5F:01:12:67:74 (Broadcom Corporation)          [hci0] 0.605897
@ MGMT Open: bluetoothd (privileged) version 1.21             {0x0001} 0.605903
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7   #1 [hci0] 4.022789
        Type: Passive (0x00)
        Interval: 60.000 msec (0x0060)
        Window: 60.000 msec (0x0060)
        Own address type: Public (0x00)
        Filter policy: Ignore not in accept list (0x01)
> HCI Event: Command Complete (0x0e) plen 4                  #2 [hci0] 4.023364
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2       #3 [hci0] 4.023445
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                  #4 [hci0] 4.024390
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 43                    #5 [hci0] 7.318969
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: DE:44:38:02:AA:EA (Static)
        Data length: 31
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        TX power: -13 dBm
        Company: internal use (65535)
          Data: 643f000000000400130500443802aaea3202020113
        RSSI: -61 dBm (0xc3)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2       #6 [hci0] 7.319103
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4                  #7 [hci0] 7.320572
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Create Connection (0x08|0x000d) plen 25    #8 [hci0] 7.320667
        Scan interval: 60.000 msec (0x0060)
        Scan window: 60.000 msec (0x0060)
        Filter policy: Accept list is not used (0x00)
        Peer address type: Random (0x01)
        Peer address: DE:44:38:02:AA:EA (Static)
        Own address type: Public (0x00)
        Min connection interval: 30.00 msec (0x0018)
        Max connection interval: 50.00 msec (0x0028)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4                    #9 [hci0] 7.321723
      LE Create Connection (0x08|0x000d) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Create Connectio.. (0x08|0x000e) plen 0  #10 [hci0] 11.373868
> HCI Event: Command Complete (0x0e) plen 4                #11 [hci0] 11.398188
      LE Create Connection Cancel (0x08|0x000e) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 31                  #12 [hci0] 11.398363
      LE Enhanced Connection Complete (0x0a)
        Status: Unknown Connection Identifier (0x02)
        Handle: 64
        Role: Central (0x00)
        Peer address type: Random (0x01)
        Peer address: DE:44:38:02:AA:EA (Static)
        Local resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Peer resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Connection interval: 48.75 msec (0x0027)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Central clock accuracy: 0x00
</code>```

Why is that? And how I can set the connection parameters with bluetoothctl so that it works?

Any advice is appreciated - thanks in advance!
Nicolas

Body:
I am trying to connect to a BLE smart lock from my Raspberry Pi Model 4 to open the lock. I have installed the latest BlueZ 5.66. I can successfully connect to the lock with hci_tool like this:

sudo hcitool lecc --random DE:44:38:02:AA:EA

With btmon I see the following:

Bluetooth monitor ver 5.66
= Note: Linux version 5.15.76-v7l+ (armv7l)                            0.028327
= Note: Bluetooth subsystem version 2.22                               0.028335
= New Index: E4:5F:01:12:67:74 (Primary,UART,hci0)              [hci0] 0.028338
= Open Index: E4:5F:01:12:67:74                                 [hci0] 0.028341
= Index Info: E4:5F:01:12:67:74 (Broadcom Corporation)          [hci0] 0.028345
@ MGMT Open: bluetoothd (privileged) version 1.21             {0x0001} 0.028348
@ RAW Open: hcitool (privileged) version 2.22                 {0x0002} 4.924550
@ RAW Close: hcitool                                          {0x0002} 4.924600
@ RAW Open: hcitool (privileged) version 2.22          {0x0002} [hci0] 4.924657
< HCI Command: LE Create Connection (0x08|0x000d) plen 25    #1 [hci0] 4.924801
        Scan interval: 2.500 msec (0x0004)
        Scan window: 2.500 msec (0x0004)
        Filter policy: Accept list is not used (0x00)
        Peer address type: Random (0x01)
        Peer address: DE:44:38:02:AA:EA (Static)
        Own address type: Public (0x00)
        Min connection interval: 18.75 msec (0x000f)
        Max connection interval: 18.75 msec (0x000f)
        Connection latency: 0 (0x0000)
        Supervision timeout: 32000 msec (0x0c80)
        Min connection length: 0.625 msec (0x0001)
        Max connection length: 0.625 msec (0x0001)
> HCI Event: Command Status (0x0f) plen 4                    #2 [hci0] 4.926433
      LE Create Connection (0x08|0x000d) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 31                   #3 [hci0] 14.452646
      LE Enhanced Connection Complete (0x0a)
        Status: Success (0x00)
        Handle: 64
        Role: Central (0x00)
        Peer address type: Random (0x01)
        Peer address: DE:44:38:02:AA:EA (Static)
        Local resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Peer resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Connection interval: 18.75 msec (0x000f)
        Connection latency: 0 (0x0000)
        Supervision timeout: 32000 msec (0x0c80)
        Central clock accuracy: 0x00
@ MGMT Event: Device Connected (0x000b) plen 13       {0x0001} [hci0] 14.452752
        LE Address: DE:44:38:02:AA:EA (Static)
        Flags: 0x00000008
          Connection Locally Initiated
        Data length: 0
@ RAW Open: btmon (privileged) version 2.22                  {0x0003} 14.453015
< HCI Command: LE Read Remote Used... (0x08|0x0016) plen 2  #4 [hci0] 14.453048
        Handle: 64 Address: DE:44:38:02:AA:EA (Static)
@ RAW Close: btmon                                           {0x0003} 14.453086
> HCI Event: Command Status (0x0f) plen 4                   #5 [hci0] 14.453388
      LE Read Remote Used Features (0x08|0x0016) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 11                   #6 [hci0] 14.503982
      LE Data Length Change (0x07)
        Handle: 64 Address: DE:44:38:02:AA:EA (Static)
        Max TX octets: 27
        Max TX time: 2120
        Max RX octets: 27
        Max RX time: 2120
> HCI Event: LE Meta Event (0x3e) plen 12                   #7 [hci0] 14.541397
      LE Read Remote Used Features (0x04)
        Status: Success (0x00)
        Handle: 64 Address: DE:44:38:02:AA:EA (Static)
        Features: 0x25 0x01 0x00 0x00 0x00 0x00 0x00 0x00
          LE Encryption
          Extended Reject Indication
          LE Data Packet Length Extension
          LE 2M PHY

[.. I cut out a lot here ...]

@ MGMT Event: New Connection Para.. (0x001c) plen 16  {0x0001} [hci0] 19.341463
        Store hint: Reserved (0xea)
        BR/EDR Address: 02:DE:44:38:02:AA (OUI 02-DE-44)
        Min connection interval: 320
        Max connection interval: 520
        Connection latency: 0 (0x0000)
        Supervision timeout: 400
< ACL Data TX: Handle 64 flags 0x00 dlen 10               #114 [hci0] 19.341506
      LE L2CAP: Connection Parameter Update Response (0x13) ident 3 len 2
        Result: Connection Parameters accepted (0x0000)
< HCI Command: LE Connection Upd.. (0x08|0x0013) plen 14  #115 [hci0] 19.341550
        Handle: 64 Address: DE:44:38:02:AA:EA (Static)
        Min connection interval: 400.00 msec (0x0140)
        Max connection interval: 650.00 msec (0x0208)
        Connection latency: 0 (0x0000)
        Supervision timeout: 4000 msec (0x0190)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4                 #116 [hci0] 19.343911
      LE Connection Update (0x08|0x0013) ncmd 1
        Status: Success (0x00)
> HCI Event: Number of Completed Packets (0x13) plen 5    #117 [hci0] 19.522890
        Num handles: 1
        Handle: 64 Address: DE:44:38:02:AA:EA (Static)
        Count: 1
> HCI Event: LE Meta Event (0x3e) plen 10                 #118 [hci0] 20.095076
      LE Connection Update Complete (0x03)
        Status: Success (0x00)
        Handle: 64 Address: DE:44:38:02:AA:EA (Static)
        Connection interval: 648.75 msec (0x0207)
        Connection latency: 0 (0x0000)
        Supervision timeout: 4000 msec (0x0190)
> HCI Event: Disconnect Complete (0x05) plen 4            #119 [hci0] 27.880662
        Status: Success (0x00)
        Handle: 64 Address: DE:44:38:02:AA:EA (Static)
        Reason: Remote User Terminated Connection (0x13)
@ MGMT Event: Device Disconnected (0x000c) plen 8     {0x0001} [hci0] 27.880723
        LE Address: DE:44:38:02:AA:EA (Static)
        Reason: Connection terminated by remote host (0x03)
@ RAW Close: hcitool                                  {0x0002} [hci0] 45.071448

However, from my app in Python I use the bleak library, which in turn uses Bluez to establish the connection. This fails and I tried to connect using bluetoothctl via the command line. The connection parameters in btmon look entirely different, and I get an error on the command line after a while:

[bluetooth]# connect DE:44:38:02:AA:EA
Attempting to connect to DE:44:38:02:AA:EA
Failed to connect: org.bluez.Error.Failed le-connection-abort-by-local

btmon:

Bluetooth monitor ver 5.66
= Note: Linux version 5.15.76-v7l+ (armv7l)                            0.605856
= Note: Bluetooth subsystem version 2.22                               0.605871
= New Index: E4:5F:01:12:67:74 (Primary,UART,hci0)              [hci0] 0.605877
= Open Index: E4:5F:01:12:67:74                                 [hci0] 0.605881
= Index Info: E4:5F:01:12:67:74 (Broadcom Corporation)          [hci0] 0.605897
@ MGMT Open: bluetoothd (privileged) version 1.21             {0x0001} 0.605903
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7   #1 [hci0] 4.022789
        Type: Passive (0x00)
        Interval: 60.000 msec (0x0060)
        Window: 60.000 msec (0x0060)
        Own address type: Public (0x00)
        Filter policy: Ignore not in accept list (0x01)
> HCI Event: Command Complete (0x0e) plen 4                  #2 [hci0] 4.023364
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2       #3 [hci0] 4.023445
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                  #4 [hci0] 4.024390
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 43                    #5 [hci0] 7.318969
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Random (0x01)
        Address: DE:44:38:02:AA:EA (Static)
        Data length: 31
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        TX power: -13 dBm
        Company: internal use (65535)
          Data: 643f000000000400130500443802aaea3202020113
        RSSI: -61 dBm (0xc3)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2       #6 [hci0] 7.319103
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4                  #7 [hci0] 7.320572
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Create Connection (0x08|0x000d) plen 25    #8 [hci0] 7.320667
        Scan interval: 60.000 msec (0x0060)
        Scan window: 60.000 msec (0x0060)
        Filter policy: Accept list is not used (0x00)
        Peer address type: Random (0x01)
        Peer address: DE:44:38:02:AA:EA (Static)
        Own address type: Public (0x00)
        Min connection interval: 30.00 msec (0x0018)
        Max connection interval: 50.00 msec (0x0028)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4                    #9 [hci0] 7.321723
      LE Create Connection (0x08|0x000d) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Create Connectio.. (0x08|0x000e) plen 0  #10 [hci0] 11.373868
> HCI Event: Command Complete (0x0e) plen 4                #11 [hci0] 11.398188
      LE Create Connection Cancel (0x08|0x000e) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 31                  #12 [hci0] 11.398363
      LE Enhanced Connection Complete (0x0a)
        Status: Unknown Connection Identifier (0x02)
        Handle: 64
        Role: Central (0x00)
        Peer address type: Random (0x01)
        Peer address: DE:44:38:02:AA:EA (Static)
        Local resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Peer resolvable private address: 00:00:00:00:00:00 (Non-Resolvable)
        Connection interval: 48.75 msec (0x0027)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Central clock accuracy: 0x00

Why is that? And how I can set the connection parameters with bluetoothctl so that it works?

Any advice is appreciated - thanks in advance!
Nicolas


问:
Want to fetch last traded price in parallel
Here is the code I have for fetching the values between Two Particular values, I need to fetch Last traded price at the same time, please help this is my code for fetching all values between min value and axvalueout

Here is the excel sheet

I tried with fetching strike price values between minvalue and maxvalue, I am getting output as well, I am expecting last traded price also to be get fetched in parallel based on the last last fetched values of strike price


问:
How to run java program using Oracle JDK 17, if Oracle JDK 17 does not come with JRE
I am new to Java..

My understanding is that to build java program one needs a JDK and to run java programs JRE is needed. I have build my project with Oracle JDK 17. How to run java program the same program if Oracle JDK 17 does not come with JRE


问:
Exporting to pdf in datatables returns error in customize
I have the following code to export to pdf with datatables:

```<code>{
  extend: 'pdf',
  text: 'pdf',
  title: 'Registo de Marcações',
  footer: true,
    exportOptions: {
    stripHtml : false,
    columns: function ( idx, data, node ) {
      if (idx >= 4) {
        return data;
      }
    }
  },
  customize: function ( win ) {
    $(win.document.body)
    .css( 'font-size', '10pt' );

    $(win.document.body).find( 'table' )
    .addClass( 'compact' )
    .css( 'font-size', 'inherit' );
  }
}
</code>```

I'll start by saying that stripHtml: false doesn't work, because when I generate the pdf it doesn't return the font-awesome icon. Returns as shown in the picture:

And it should return as it returns when I print:

Then in this part of the code $(win.document.body) generates this error:

Uncaught TypeError: Cannot read properties of undefined (reading
'body')
at Object.customize

How can I solve these problems? On the print button, the code works fine. The problems only appear in the generate pdf button

Body:
I have the following code to export to pdf with datatables:

{
  extend: 'pdf',
  text: 'pdf',
  title: 'Registo de Marcações',
  footer: true,
    exportOptions: {
    stripHtml : false,
    columns: function ( idx, data, node ) {
      if (idx >= 4) {
        return data;
      }
    }
  },
  customize: function ( win ) {
    $(win.document.body)
    .css( 'font-size', '10pt' );

    $(win.document.body).find( 'table' )
    .addClass( 'compact' )
    .css( 'font-size', 'inherit' );
  }
}

I'll start by saying that stripHtml: false doesn't work, because when I generate the pdf it doesn't return the font-awesome icon. Returns as shown in the picture:

And it should return as it returns when I print:

Then in this part of the code $(win.document.body) generates this error:

Uncaught TypeError: Cannot read properties of undefined (reading
'body')
at Object.customize

How can I solve these problems? On the print button, the code works fine. The problems only appear in the generate pdf button


问:
Why method PUT doesnt work in my app, kotlin app?
this function is set on button with onClickListener

```<code>private fun sendData() {
        val jsonService = JsonService()
        val call = jsonService.updateMessage(g_id, eMessage.text.toString(), username.text.toString())
        //username.text = eMessage.text.toString()
        call.enqueue(object : Callback<ShoutboxItem> {
            override fun onResponse(call: Call<ShoutboxItem>, response: Response<ShoutboxItem>) {
                Log.i("Sent","good")

            }

            override fun onFailure(call: Call<ShoutboxItem>, t: Throwable) {
                Log.i("error", t.toString());
            }
        })
    }
</code>```
```<code> @FormUrlEncoded
    @PUT("message/{id}")
    fun editMessage(@Path("id") id : String, @Field("content") contentEdit: String, @Field("login") login : String ) : Call<ShoutboxItem>
</code>```
```<code>fun updateMessage(id : String, message : String, login : String): Call<ShoutboxItem> {
        return jsonPlaceholderAPI.editMessage(id, message, login)
    }
</code>```
```<code>data class ShoutboxItem(
    val content: String,
    val date: String,
    val id: String,
    val login: String
)

</code>```

I got onResponse call with sucefull use of PUT, but nothing changes on http://tgryl.pl/shoutbox/messages

Any ideas why it didnt work?

Body:
this function is set on button with onClickListener

private fun sendData() {
        val jsonService = JsonService()
        val call = jsonService.updateMessage(g_id, eMessage.text.toString(), username.text.toString())
        //username.text = eMessage.text.toString()
        call.enqueue(object : Callback<ShoutboxItem> {
            override fun onResponse(call: Call<ShoutboxItem>, response: Response<ShoutboxItem>) {
                Log.i("Sent","good")

            }

            override fun onFailure(call: Call<ShoutboxItem>, t: Throwable) {
                Log.i("error", t.toString());
            }
        })
    }

 @FormUrlEncoded
    @PUT("message/{id}")
    fun editMessage(@Path("id") id : String, @Field("content") contentEdit: String, @Field("login") login : String ) : Call<ShoutboxItem>

fun updateMessage(id : String, message : String, login : String): Call<ShoutboxItem> {
        return jsonPlaceholderAPI.editMessage(id, message, login)
    }

data class ShoutboxItem(
    val content: String,
    val date: String,
    val id: String,
    val login: String
)

I got onResponse call with sucefull use of PUT, but nothing changes on http://tgryl.pl/shoutbox/messages

Any ideas why it didnt work?


问:
How to get only the element i have selected not all elements with same id? (laravel)
Hello how i get only the element i select, without getting all elements with the same id ?

code : istProj.blade.php (i only tried with id label)

```<code> @foreach ($proiecte->istoricProiecte as $istProj)
     <input type="text" class='form-control' value="{{ $istProj->proiecte_id }}" name='denumire_proiect' placeholder="Introduceti numele clientului" readonly>
 @endforeach
</code>```

i want to get all the data from the first image table, so i have for example: id proiect = 1, tip actiune = plata, colaborator = 1, suma = 500, data = ... and i want when i press on the eye to go into a page with all those details into labels for deleting the data or update the data.

my IstoricProiecte.php model:

```<code>protected $table = 'IstoricProiecte';
public $fillable = [
    'id',
    'proiect_id',
    'action_type',
    'colaborator_id',
    'suma',
    'data'
];
use HasFactory;

// un model(istoric proiecte) apartine proiect
public function Proiecte()
{
    return $this->belongsTo(Proiecte::class);
}

public function setDataAttribute($value)
{
    $this->attributes['data'] = Carbon::createFromFormat('m/d/Y', $value)->format('Y-m-d');
}
</code>```

my Proiecte.php model:

```<code>protected $table = 'Proiecte';
public $fillable = [
    'id',
    'Denumire_Client',
    'Firma_Client',
    'Reprezentant_Firma',
    'Contact_Client',
    'Suma_Proiect',
    'Numar_Transe',
    'Status_Proiect'
];
use HasFactory;

public function istoricProiecte()
{
    return $this->hasMany(istoricProiecte::class);
}
</code>```

ViewProjController.php

```<code>public function viewIstProj($id)
{
    $proiecte = Proiecte::find($id);
    $istoric = IstoricProiecte::all();
    $colaborator = Colaboratori::all();
    $time = Carbon::now()->format('m/d/Y');
    // $ist = DB::table('IstoricProiecte')->select('IstoricProiecte.*')->join('Proiecte', 'id', '=', 'IstoricProiecte.id_proiect')->where('id', $id)->get();
    return view('istProj', compact('proiecte', 'istoric', 'colaborator', 'time'));
}
</code>```

web.php

```<code>Route::get('istProj/{id}', [App\Http\Controllers\ViewProjController::class, 'viewIstProj'])->name('viewIstProj');
</code>```

Body:
Hello how i get only the element i select, without getting all elements with the same id ?

code : istProj.blade.php (i only tried with id label)

 @foreach ($proiecte->istoricProiecte as $istProj)
     <input type="text" class='form-control' value="{{ $istProj->proiecte_id }}" name='denumire_proiect' placeholder="Introduceti numele clientului" readonly>
 @endforeach

i want to get all the data from the first image table, so i have for example: id proiect = 1, tip actiune = plata, colaborator = 1, suma = 500, data = ... and i want when i press on the eye to go into a page with all those details into labels for deleting the data or update the data.

my IstoricProiecte.php model:

protected $table = 'IstoricProiecte';
public $fillable = [
    'id',
    'proiect_id',
    'action_type',
    'colaborator_id',
    'suma',
    'data'
];
use HasFactory;

// un model(istoric proiecte) apartine proiect
public function Proiecte()
{
    return $this->belongsTo(Proiecte::class);
}

public function setDataAttribute($value)
{
    $this->attributes['data'] = Carbon::createFromFormat('m/d/Y', $value)->format('Y-m-d');
}

my Proiecte.php model:

protected $table = 'Proiecte';
public $fillable = [
    'id',
    'Denumire_Client',
    'Firma_Client',
    'Reprezentant_Firma',
    'Contact_Client',
    'Suma_Proiect',
    'Numar_Transe',
    'Status_Proiect'
];
use HasFactory;

public function istoricProiecte()
{
    return $this->hasMany(istoricProiecte::class);
}

ViewProjController.php

public function viewIstProj($id)
{
    $proiecte = Proiecte::find($id);
    $istoric = IstoricProiecte::all();
    $colaborator = Colaboratori::all();
    $time = Carbon::now()->format('m/d/Y');
    // $ist = DB::table('IstoricProiecte')->select('IstoricProiecte.*')->join('Proiecte', 'id', '=', 'IstoricProiecte.id_proiect')->where('id', $id)->get();
    return view('istProj', compact('proiecte', 'istoric', 'colaborator', 'time'));
}

web.php

Route::get('istProj/{id}', [App\Http\Controllers\ViewProjController::class, 'viewIstProj'])->name('viewIstProj');


问:
Basic F# / Rust performance comparison
this is a simplistic performance test based on https://www.youtube.com/watch?v=QlMLB2-G25c which compares the performance of rust vs wasm vs python vs go

the original rust program (from https://github.com/masmullin2000/random-sort-examples) is:

```<code>use rand::prelude::*;

fn main() {
    let vec = make_random_vec(1_000_000, 100);
    for _ in 0..250 {
        let mut v = vec.clone();
        // v.sort_unstable();
        v.sort();   // using stable sort as f# sort is a stable sort
    }
}

pub fn make_random_vec(sz: usize, modulus: i64) -> Vec<i64> {
    let mut v: Vec<i64> = Vec::with_capacity(sz);
    for _ in 0..sz {
        let x: i64 = random();
        v.push(x % modulus);
    }
    v
}
</code>```

so i created the following f# program to compare against rust

```<code>open System

let rec cls (arr:int64 array) count =
    if count > 0 then
        let v1 = Array.copy arr
        let v2 = Array.sort v1
        cls arr (count-1)
    else
        ()

let rnd = Random()
let rndArray = Array.init 1000000 (fun _ -> int64 (rnd.Next(100)))
cls rndArray 250 |> ignore
</code>```

i was expecting f# to be slower (both running on WSL2) but got the following times on my Core i7 8th gen laptop

Rust - around 17 seconds

Rust (unstable sort) - around 2.7 seconds

F# - around 11 seconds

my questions:

is the dotnet compiler doing some sort of optimisation that throws away some of the processing because the return values are not being used resulting in the f# code running faster or am i doing something wrong?

does f# have an unstable sort function that i can use to compare against the Rust unstable sort?

Title: Basic F# / Rust performance comparison

Body:
this is a simplistic performance test based on https://www.youtube.com/watch?v=QlMLB2-G25c which compares the performance of rust vs wasm vs python vs go

the original rust program (from https://github.com/masmullin2000/random-sort-examples) is:

use rand::prelude::*;

fn main() {
    let vec = make_random_vec(1_000_000, 100);
    for _ in 0..250 {
        let mut v = vec.clone();
        // v.sort_unstable();
        v.sort();   // using stable sort as f# sort is a stable sort
    }
}

pub fn make_random_vec(sz: usize, modulus: i64) -> Vec<i64> {
    let mut v: Vec<i64> = Vec::with_capacity(sz);
    for _ in 0..sz {
        let x: i64 = random();
        v.push(x % modulus);
    }
    v
}

so i created the following f# program to compare against rust

open System

let rec cls (arr:int64 array) count =
    if count > 0 then
        let v1 = Array.copy arr
        let v2 = Array.sort v1
        cls arr (count-1)
    else
        ()

let rnd = Random()
let rndArray = Array.init 1000000 (fun _ -> int64 (rnd.Next(100)))
cls rndArray 250 |> ignore

i was expecting f# to be slower (both running on WSL2) but got the following times on my Core i7 8th gen laptop

Rust - around 17 seconds

Rust (unstable sort) - around 2.7 seconds

F# - around 11 seconds

my questions:

is the dotnet compiler doing some sort of optimisation that throws away some of the processing because the return values are not being used resulting in the f# code running faster or am i doing something wrong?

does f# have an unstable sort function that i can use to compare against the Rust unstable sort?


问:
Adding "Expiration Date" to email send with Microsoft365R
Does anybody know whether there is a possibility of adding an Expiration-Date to the email that is send with Microsoft365R?

I have the following lines of code and would like the message to be removed from the receiver's inbox after a specific date.

```<code>library(Microsoft365R)
library(blastula)

outlb <- get_business_outlook()
bl_em <- compose_email(body = "body of email")
em <- outlb@create_email(
  bl_em,
  subject = "subjectline",
  to="name@domain.com"
)
em$send()
</code>```

Body:
Does anybody know whether there is a possibility of adding an Expiration-Date to the email that is send with Microsoft365R?

I have the following lines of code and would like the message to be removed from the receiver's inbox after a specific date.

library(Microsoft365R)
library(blastula)

outlb <- get_business_outlook()
bl_em <- compose_email(body = "body of email")
em <- outlb@create_email(
  bl_em,
  subject = "subjectline",
  to="name@domain.com"
)
em$send()


问:
TypeScript compiler doesn't recognize check for optional object attribute in external function
I have a type definition with an optional member which I need to access in a function. In order to assure that the optional member is indeed set, I created a "validator"-function which throws an error if the optional member of the object is not set. However, the TypeScript transpiler still complains that the optional member may be undefined when accessing it. When I check the member in the function directly, it sure recognizes the check.

Usually, I wouldn't mind that much, but since I have to check for lots of optional members, the code gets quite messy and I would like to extract the checks into a function. Also, when throwing an error inside the try-block, it is recommended to use an external error handler function instead of catching locally, but this will lead to the same problem: The TypeScript compiler not recognizing that the optional member's existence has been checked.

I have created a minimal code example which you can also test out in the TypeScript Playground

type SomeObjectType = {
  requiredMember: boolean;
  optionalMember?: OptionalMemberType;
}

type OptionalMemberType = {
  someMember: string;
}

function main(someObject: SomeObjectType) {
  try {
    checkOptionalMemberSet(someObject);

    // if (!someObject.optionalMember) {
    //   throw new Error('Optional member not set, aborting...');
    // }

    console.log(someObject.requiredMember);
    console.log(someObject.optionalMember.someMember); // 'someObject.optionalMember' is possibly 'undefined'.(18048)
  } catch (e) {
    console.error(e);
  }
}

function checkOptionalMemberSet(someObject: SomeObjectType) {
  if (!someObject.optionalMember) {
    throw new Error('Optional member not set, aborting...');
  }
}

const someObject = {
  requiredMember: true
};

main(someObject);

```

Any ideas what I could be missing here?

Body:
I have a type definition with an optional member which I need to access in a function. In order to assure that the optional member is indeed set, I created a "validator"-function which throws an error if the optional member of the object is not set. However, the TypeScript transpiler still complains that the optional member may be undefined when accessing it. When I check the member in the function directly, it sure recognizes the check.

Usually, I wouldn't mind that much, but since I have to check for lots of optional members, the code gets quite messy and I would like to extract the checks into a function. Also, when throwing an error inside the try-block, it is recommended to use an external error handler function instead of catching locally, but this will lead to the same problem: The TypeScript compiler not recognizing that the optional member's existence has been checked.

I have created a minimal code example which you can also test out in the <a href="https://www.typescriptlang.org/play?#code/C4TwDgpgBAyg9gWwgeQEYCsIGNgBVzQC8UA3gFBRQBOEAjgK4CWNAJgLIQKoRUBcUqOHAA2EAIYA7ANwUocMMEZwJY4Ry48A-P2QKlKtZ25V8kGQF8yZUJCi7Fy1euOmipWQGdEEZz34fgKkYJAHMLKwAzegkcfSgEMWCACi8kNEwcfng0jGw8AgBKd0pAkGLKKCwAC2wAa3t9JyMeGAhgFO90vIKZWUoAen6oRgioJIBCVJRcnAA6eQcDXyoi8gqoQYrgKqo4AHcoCQgDgFEqXaokgHIGx2F45qpDuGAoDzaAGigxQSpFUNmgKuPT6GyGllBWGUXlEs2EcBCHRyGWAsxoDGYEHYjxB6yhEhhEDhCKR0xR8z0d2Wsymyx6YKgVymXTmC0ahg0VCuww8UDAcA8HkYqGEZSu0RYEAiwSxV1mSQAjAAOAAMABYlQVZOZKmJgNUxhBVpDoSIiTwLkkjTJKJYIVEYotKjUsPVKUtHq12syZsAsp1fa5jZQRmNJgHyWyqTjyiUdvtDscoGdLTd3aoHpznq93sAvj84H9giFAbNgTaoHarPiAm8I3koMQ1tQ6ExWMt+IF6BAyOZeglkj6USCgA" rel="nofollow noreferrer">TypeScript Playground

type SomeObjectType = {
  requiredMember: boolean;
  optionalMember?: OptionalMemberType;
}

type OptionalMemberType = {
  someMember: string;
}

function main(someObject: SomeObjectType) {
  try {
    checkOptionalMemberSet(someObject);

    // if (!someObject.optionalMember) {
    //   throw new Error('Optional member not set, aborting...');
    // }

    console.log(someObject.requiredMember);
    console.log(someObject.optionalMember.someMember); // 'someObject.optionalMember' is possibly 'undefined'.(18048)
  } catch (e) {
    console.error(e);
  }
}

function checkOptionalMemberSet(someObject: SomeObjectType) {
  if (!someObject.optionalMember) {
    throw new Error('Optional member not set, aborting...');
  }
}

const someObject = {
  requiredMember: true
};

main(someObject);

Any ideas what I could be missing here?


问:
Clustering with R 'Mclust' function: setting priors for output parameters
I am using the R package mclust to separate data into clusters. For this, I am using a uni-dimensional that allows for variable variances of the normal distributions underlying the clustering (the "V" model in the package).

The function looks like this: Mclust(dataToCluster, G=possibleClusters, modelNames=c("V")). To define the number of clusters possible, I use an array possibleClusters, e. g. 1:4 to allow for one to four clusters.

As a result of the clustering, after automatic model selection by Mclust using the BIC, I get a result with parameters of a normal distribution. For a model with three clusters, it might look like this:

```<code># output shortened and commented for better readibility
>   result$parameters

# proportion of data points per cluster ("lambda")
$pro
[1] 0.3459566 0.3877521 0.2662913

# mean of normal distribution per cluster ("mu")
$mean
       1        2        3
110.3197 204.0477 265.0929

# variances per cluster ("sigma sq")
$variance$sigmasq
[1] 342.5032 128.4648 254.9257
</code>```

However, I do have some knowledge about what these parameters are supposed to look like a priori. For example, I might know that:

sigmasq must be between 100 and 1000 units

the mean value for adjacent clusters must be at least 40 units apart

if there are three clusters, the mean value of the third cluster must be at least 215 units

Here is a graphical example for possible results of the clustering (the x axis corresponds to the units of mean and sigma unsquared):

Taking into account the constraints given above, example plots A1 (according to rules 1 and 2) and B1 (according to rules 2 and 3) can't be correct. Instead, the results should look more like A2 and B2, which were produced using slightly different data. Note that, taking into account these constraints, the “best” number of clusters might change (A1 vs. A2).

I would like to know how to include this kind of a priori information when using the Mclust function. The function does have a parameter prior, which might allow for this but I wasn't able to figure out how this could work. How could I bring the constraints into the function?

Body:
I am using the R package mclust to separate data into clusters. For this, I am using a uni-dimensional that allows for variable variances of the normal distributions underlying the clustering (the "V" model in the package).

The function looks like this: Mclust(dataToCluster, G=possibleClusters, modelNames=c("V")). To define the number of clusters possible, I use an array possibleClusters, e. g. 1:4 to allow for one to four clusters.

As a result of the clustering, after automatic model selection by Mclust using the BIC, I get a result with parameters of a normal distribution. For a model with three clusters, it might look like this:

# output shortened and commented for better readibility
>   result$parameters

# proportion of data points per cluster ("lambda")
$pro
[1] 0.3459566 0.3877521 0.2662913

# mean of normal distribution per cluster ("mu")
$mean
       1        2        3
110.3197 204.0477 265.0929

# variances per cluster ("sigma sq")
$variance$sigmasq
[1] 342.5032 128.4648 254.9257

However, I do have some knowledge about what these parameters are supposed to look like a priori. For example, I might know that:

sigmasq must be between 100 and 1000 units

the mean value for adjacent clusters must be at least 40 units apart

if there are three clusters, the mean value of the third cluster must be at least 215 units

Here is a graphical example for possible results of the clustering (the x axis corresponds to the units of mean and sigma unsquared):

Taking into account the constraints given above, example plots A1 (according to rules 1 and 2) and B1 (according to rules 2 and 3) can't be correct. Instead, the results should look more like A2 and B2, which were produced using slightly different data. Note that, taking into account these constraints, the “best” number of clusters might change (A1 vs. A2).

I would like to know how to include this kind of a priori information when using the Mclust function. The function does have a parameter prior, which might allow for this but I wasn't able to figure out how this could work. How could I bring the constraints into the function?


问:
How to save a 3-D array consisting of 2-D images from MATLAB to a Python-readable format?
I need to save a lot of 3-D MATLAB arrays (consisting of stacks of images) of format a x b x N (a = image width, b = image length, N = number of images) to a Python-readable format, so that they can be read to Python as matrices or memmaps.

All the tools I've encountered so far are either for 2-D arrays  (such as the MATLAB's function mat2np.m from the File Exchange)or overly clumsy. Is there a neat way to do this?


问:
Nodemailer changes URI before Mail is send - ENOENT: no such file or directory
Hey guys I have Questions depending the way that Nodemailer sends an Email with an attached PDF that comes from an Emulator (using Expo).

Basically I am creating a PDF inside my App (Frontend), after my PDF is created I am opening it with Expos DocumentPicker. I can see the content/type of that file inside my frotend with console.log():

```<code>{"size":69496,"name":"Monatsbericht_xxx_xxx_Dezember2022.pdf","type":"success","uri":"file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540xxx%252Fxxx/DocumentPicker/93136a82-823f-4b3d-9822-a693ab747576.pdf","mimeType":"application/pdf"}
</code>```

Then I taking the URI part and sendig it to my REST API. I can confirm the URI when I console.log it. Here is the code of my Nodemailer function:

```<code>  router.post("/sendmonthreport", async (req, res) => {
    const {recieverMail} = req.body;
    const {senderUser} = req.body;
    const {pathMonthLock} = req.body;

let transport = nodemailer.createTransport({
  host: "ex01.thgmbh.lan",
  port: 25,
  secure: false,          // upgrade later with STARTTLS
  tls: {
    rejectUnauthorized: false
  }
});

var message = {
  from: "xxx <xxx@xxx.com>",
  to: `${recieverMail}`,
  subject: `Monatsbericht abgeschlossen für - ${senderUser}`,
  text: `Monatsbericht aus der xxx App `,
  attachments:[{
    filename: "Monatsbericht_12-2022_xxx_xxx_Gxxx.pdf",
    path: `./${pathMonthLock}`,
    contentType: "application/pdf"
  }]
}

console.log("FileUri in the Backend/Nodemailer: " + pathMonthLock);

await transport.sendMail(message)
.catch(err => console.log("Error Mail: " + err ))

res.send("email send")
  })
</code>```

The console.log gives me:

```<code>FileUri in the Backend/Nodemailer: `file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540xxx%252Fxxx/DocumentPicker/93136a82-823f-4b3d-9822-a693ab747576.pdf`
</code>```

So as you can see it gets the right URI, however when the email actually gets send or tries to send it it gets an Error that looks like this:

```<code>Error Mail: Error: ENOENT: no such file or directory, open 'C:\Dev\Programmierung\xxx\xxx-xxx\file:\data\user\0\host.exp.exponent\cache\ExperienceData\%2540xxx%252Fxxx\DocumentPicker\93136a82-823f-4b3d-9822-a693ab747576.pdf'
</code>```

So what I am seeing is that somehow the Project Structure gets appended infront of my actuall URI. Obviously there is no File inside my Project Structure therefore it cant be found. How can I tell nodemailer to take the correct URI/File?

Body:
Hey guys I have Questions depending the way that Nodemailer sends an Email with an attached PDF that comes from an Emulator (using Expo).

Basically I am creating a PDF inside my App (Frontend), after my PDF is created I am opening it with Expos DocumentPicker. I can see the content/type of that file inside my frotend with console.log():

{"size":69496,"name":"Monatsbericht_xxx_xxx_Dezember2022.pdf","type":"success","uri":"file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540xxx%252Fxxx/DocumentPicker/93136a82-823f-4b3d-9822-a693ab747576.pdf","mimeType":"application/pdf"}

Then I taking the URI part and sendig it to my REST API. I can confirm the URI when I console.log it. Here is the code of my Nodemailer function:

  router.post("/sendmonthreport", async (req, res) => {
    const {recieverMail} = req.body;
    const {senderUser} = req.body;
    const {pathMonthLock} = req.body;

let transport = nodemailer.createTransport({
  host: "ex01.thgmbh.lan",
  port: 25,
  secure: false,          // upgrade later with STARTTLS
  tls: {
    rejectUnauthorized: false
  }
});

var message = {
  from: "xxx <xxx@xxx.com>",
  to: `${recieverMail}`,
  subject: `Monatsbericht abgeschlossen für - ${senderUser}`,
  text: `Monatsbericht aus der xxx App `,
  attachments:[{
    filename: "Monatsbericht_12-2022_xxx_xxx_Gxxx.pdf",
    path: `./${pathMonthLock}`,
    contentType: "application/pdf"
  }]
}

console.log("FileUri in the Backend/Nodemailer: " + pathMonthLock);

await transport.sendMail(message)
.catch(err => console.log("Error Mail: " + err ))

res.send("email send")
  })

The console.log gives me:

FileUri in the Backend/Nodemailer: `file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540xxx%252Fxxx/DocumentPicker/93136a82-823f-4b3d-9822-a693ab747576.pdf`

So as you can see it gets the right URI, however when the email actually gets send or tries to send it it gets an Error that looks like this:

Error Mail: Error: ENOENT: no such file or directory, open 'C:\Dev\Programmierung\xxx\xxx-xxx\file:\data\user\0\host.exp.exponent\cache\ExperienceData\%2540xxx%252Fxxx\DocumentPicker\93136a82-823f-4b3d-9822-a693ab747576.pdf'

So what I am seeing is that somehow the Project Structure gets appended infront of my actuall URI. Obviously there is no File inside my Project Structure therefore it cant be found. How can I tell nodemailer to take the correct URI/File?


问:
Why is my cDCGAN model behaving like this?
Training a cDCGAN model using PyTorch to generate Covid X-ray images at a resolution of 128x128. Currently limited to 2 classes over 500 epochs while developing.

Actual Losses Why does it behave like this?

Results

Class 0 - 6012 samples

Class 1 - 10,912 samples

Expected losses (testing with a Rock Paper Scissors dataset)

Results with Rock Paper Scissors Dataset

This is the behaviour of the same script trained on the rock paper scissors dataset, why is the model behaving so differently for the Covid Xray image dataset?

840 samples for each class


问:
Please guide me on how to implement Unit of Work Pattern in eShopOnWeb project?
I am developing an application in .NET Core 7 by following the eShopOnWeb Clean Architecture https://github.com/dotnet-architecture/eShopOnWeb. I found the application is missing implementation of UoW. I need to add UoW so that I could commit/roll back the transaction. Please guide me on how I could add the UoW pattern without compromising the structure of the clean architecture.

Thanks.


问:
Apache proxying and separate parts of application
I have application foo deployed on Tomcat. What I want to achieve is to separate root application and one part foo/context in a following way:

https://example.com/internal -> https://example.com/foo

https://example.com/public -> https://example.com/foo/context

I know how to proxy this, but the problem is that internal part needs to be visible only for certain IP addresses, and public part to all users.
If I restrict access to /foo, than it is not possible to access https://example.com/foo/context.

Is this even possible to achieve?


问:
Garbage summary generation using fine-tuned google-mt5 model
I am using "google/mt5-small" to fine-tune it on online available dataset "urdu_XLsum" to apply Abstractive Text Summarization technique.I took around 30,000 data for training and 3,000 data for validation.After fine-tuning it on 3 epochs. I used that fine-tuned model and tokenizer to generate summary on some testing examples. I got a summary which has some garbage words and some right words in it. To get a much better summary, I debugged my code and found that there are some words which are not present in the google mt5 tokenizer, So I made a list of those words and added them in the tokenizer through tokenizer.add_tokens(). With this tokenizer(having unknown tokens added) I again fine-tuned my model but this time , the summary which was generated was totally garbage and it is generating almost the same summary on different paragraphs.Why is it so?.How should I improve my summary? or Am I making any mistake?

I expect to get a perfect summary


问:
Convert xml to json then download json file
I am currently using xml parser to convert xml to json.i want to convert xml to json then download  json file. My xml is in the form of

```<code>    const xml1 = `<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.3.5">
  <bpmn:process id="Process_1" isExecutable="true">
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>
</code>```

Then my function

```<code>async function SaveJson()
    {

      var xmlj = new XMLParser().parseFromString(xml1);
      console.log(xmlj);
      const fileName = "my-file";
      let file = new Blob([xmlj], {
        type: "application/json"
    });

      const element = document.createElement("a");
      element.href = URL.createObjectURL(file);
      element.download = fileName + ".json";

      document.body.appendChild(element);
      element.click();
    }
</code>```

when i console.log(xmlj) output as

```<code> {name: 'bpmn:definitions', attributes: {…}, children: Array(2), value: '', getElementsByTagName: ƒ}
attributes
:
{xmlns:bpmn: 'http://www.omg.org/spec/BPMN/20100524/MODEL', xmlns:bpmndi: 'http://www.omg.org/spec/BPMN/20100524/DI', xmlns:dc: 'http://www.omg.org/spec/DD/20100524/DC', id: 'Definitions_1', targetNamespace: 'http://bpmn.io/schema/bpmn', …}
children
:
(2) [{…}, {…}]
getElementsByTagName
:
ƒ (e)
name
:
"bpmn:definitions"
value
:
""
[[Prototype]]
:
Object
</code>```

and the download the json file and open it shows

[object Object]

Any help would be highly appreciated

Body:
I am currently using xml parser to convert xml to json.i want to convert xml to json then download  json file. My xml is in the form of

    const xml1 = `<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.3.5">
  <bpmn:process id="Process_1" isExecutable="true">
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

Then my function

async function SaveJson()
    {

      var xmlj = new XMLParser().parseFromString(xml1);
      console.log(xmlj);
      const fileName = "my-file";
      let file = new Blob([xmlj], {
        type: "application/json"
    });

      const element = document.createElement("a");
      element.href = URL.createObjectURL(file);
      element.download = fileName + ".json";

      document.body.appendChild(element);
      element.click();
    }

when i console.log(xmlj) output as

 {name: 'bpmn:definitions', attributes: {…}, children: Array(2), value: '', getElementsByTagName: ƒ}
attributes
:
{xmlns:bpmn: 'http://www.omg.org/spec/BPMN/20100524/MODEL', xmlns:bpmndi: 'http://www.omg.org/spec/BPMN/20100524/DI', xmlns:dc: 'http://www.omg.org/spec/DD/20100524/DC', id: 'Definitions_1', targetNamespace: 'http://bpmn.io/schema/bpmn', …}
children
:
(2) [{…}, {…}]
getElementsByTagName
:
ƒ (e)
name
:
"bpmn:definitions"
value
:
""
[[Prototype]]
:
Object

and the download the json file and open it shows

[object Object]

Any help would be highly appreciated


问:
Hive query logic
Trying to write an hql which holds a contact_type filed having multiple values for same employee but i need to display any one of it

For example I'm getting the data generated like below and I want only one record with any one of the contact_type out of the below 3 need to be displayed for that Emp_id

```<code>Emp_id contact_type
111    T
111    M
111    F
</code>```

T - tel

M - mob

F - fax

I tried handling with case but we are not sure which contact types will come for each employee, it may come either 1 or more than 3

Title: Hive query logic

Body:
Trying to write an hql which holds a contact_type filed having multiple values for same employee but i need to display any one of it

For example I'm getting the data generated like below and I want only one record with any one of the contact_type out of the below 3 need to be displayed for that Emp_id

Emp_id contact_type
111    T
111    M
111    F

T - tel

M - mob

F - fax

I tried handling with case but we are not sure which contact types will come for each employee, it may come either 1 or more than 3


问:
Reduce input to zero by using given variables
I hope you can help me with my request.

I have an integer input from a client. Lets say 250. The goal is to calculate the input to exactly 0 by only using 3 variables. x = 30, y = 50 and z = 100 and output how often i used each of them.

The given rules are:

I have to use as less of them as possible. means, first the z's then the y's then the x's. So i have to use as much as possible of the variables with greater values.

Im allowed to use a maximum of 3 of each of them.

I have to count how often i used each of them.

If a combination is not possible, lets say 70 ( 70 - y = 20, 70 - x - x = 10 ), give a message to the client, "Invalid input!".

Few examples:

Input = 250

Output:
z = 2
y = 1

####################

Input = 170

Output: Invalid input!

Because i can only calculate to zero by using 4 x's and 1 y. See rule 2.
Other solutions are not possible.

i.e. Input - z - y = 20 => error
Input - y - y - y = also 20 => error

####################

Input = 90

Output:
x = 3

####################

Input = 120

Output: Invalid input!

Input - z = 20 => error

Input - 50 - 50 = 20 => error

Input - x - x - x - x => See rule 2.

####################

and so on....

And how it could be extended if a further value is added to the 3 variables. i.e. 40
So if thats the case it should be somehowe dynamically.

I tried to explain that as much as possible. If you miss infos, just let me know.

Thank you.

dagogi


问:
auth_user table created alongside accounts_user table in postgres(Django)
Using:

```<code>class User(AbstractBaseUser):
    pass #models here
</code>```

I added extra fields to my custom user model. This table is created successfully in postgres with absolutely no issues, however, whilst creating a superuser the credentials gets pushed to auth_user(default django user table) instead of account_user.

auth_user shouldn't even be created alongside accounts_user?! Even worse:

```<code>REQUIRED_FIELDS = ['username', 'first_name', 'last_name']
</code>```

which I set isn't required at all when creating superuser. It still uses default django configurations/fields.
These are in order if you're wondering: AUTH_USER_MODELS = 'accounts.User' and installed 'accounts' in INSTALLED_APPS=[ ]. What is happening?

Superuser credentials should be created in accounts_user table not auth_table in postgreSQL. REQUIRED_FIELDS = ['username', 'first_name', 'last_name'] should be requested whilst creating superuser.

Body:
Using:

class User(AbstractBaseUser):
    pass #models here

I added extra fields to my custom user model. This table is created successfully in postgres with absolutely no issues, however, whilst creating a superuser the credentials gets pushed to auth_user(default django user table) instead of account_user.

auth_user shouldn't even be created alongside accounts_user?! Even worse:

REQUIRED_FIELDS = ['username', 'first_name', 'last_name']

which I set isn't required at all when creating superuser. It still uses default django configurations/fields.
These are in order if you're wondering: AUTH_USER_MODELS = 'accounts.User' and installed 'accounts' in INSTALLED_APPS=[ ]. What is happening?

Superuser credentials should be created in accounts_user table not auth_table in postgreSQL. REQUIRED_FIELDS = ['username', 'first_name', 'last_name'] should be requested whilst creating superuser.


问:
why is my Whatsapp Chat Analyser ML Model showing an error?
Image 1

Image 2

I'm building a WhatsApp chat analyzer ML Model in jupyter notebook and I got some errors.
In the second image in the 3rd line, those rows are not placed in proper columns. two rows are combined in one row. Please help me out with this problem.

I tried changing the format but it didn't match and didn't work


问:
Can GitLab service access project directory?
So I have 2 services - A and B

I am trying to use A as a GitLab service in one of the jobs of B :

.gitlab-ci.yml

```<code>job1:
  stage: dummy
  services:
    - name: registry.gitlab.com/service_a
      alias: A
  script:
    - echo "hello"
</code>```

Now B has a file that service A has to access.

Is it possible that service A can access a file in the repository of B using CI_PROJECT_DIR GitLab variable?

Body:
So I have 2 services - A and B

I am trying to use A as a GitLab service in one of the jobs of B :

.gitlab-ci.yml

job1:
  stage: dummy
  services:
    - name: registry.gitlab.com/service_a
      alias: A
  script:
    - echo "hello"

Now B has a file that service A has to access.

Is it possible that service A can access a file in the repository of B using CI_PROJECT_DIR GitLab variable?


问:
How i can render my marked date with react native calendar?
i have an array of dates like this :

dateArray =["2023-01-07", "2023-01-08", "2023-01-14", "2023-01-15", "2023-01-21"]

i transform this one in an object to go on my marked dates

```<code>dateArray.forEach((day) => {
      newDaysObject = {
        ...newDaysObject,
        [day]: {
          selected: true,
          marked: true,
          color: "red",
        },
      };
    });
</code>```

and i have an object like this

newDaysObject = {"2023-01-07": {"color": "red", "marked": true, "selected": true}, "2023-01-08": {"color": "red", "marked": true, "selected": true}}

i call my variable inside my calendar

```<code><Calendar
                  markedDates={newDaysObject}
</code>```

but nothing happened :( i might forget something ?

Body:
i have an array of dates like this :

dateArray =["2023-01-07", "2023-01-08", "2023-01-14", "2023-01-15", "2023-01-21"]

i transform this one in an object to go on my marked dates

dateArray.forEach((day) => {
      newDaysObject = {
        ...newDaysObject,
        [day]: {
          selected: true,
          marked: true,
          color: "red",
        },
      };
    });

and i have an object like this

newDaysObject = {"2023-01-07": {"color": "red", "marked": true, "selected": true}, "2023-01-08": {"color": "red", "marked": true, "selected": true}}

i call my variable inside my calendar

<Calendar
                  markedDates={newDaysObject}

but nothing happened :( i might forget something ?


问:
Importing pymc3 leads to the following error: 'TheanoConfigParser' object has no attribute 'gcc__cxxflags'
As the title already mentions, I am trying to import pymc3. However, I keep getting confronted with the following error:

TheanoConfigParser' object has no attribute 'gcc__cxxflags

At the top of the error message it reads:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The installed Theano(-PyMC) version (1.0.5) does not match the PyMC3 requirements.
It was imported from ['C:\\Users\\caspe\\miniconda3\\envs\\precourse\\lib\\site-packages\\theano']
For PyMC3 to work, a compatible Theano-PyMC backend version must be installed.
See https://github.com/pymc-devs/pymc3/wiki for installation instructions.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
```

According to the error message, it seems that I did not install the correct Theano version. So I uninstalled Theano and installed theano-pymc instead. I tried to uninstall and reinstall theano-pymc and pymc3 and also delete the directories after uninstalling, but the error remains.

How can I successfully import pymc3?

Body:
As the title already mentions, I am trying to import pymc3. However, I keep getting confronted with the following error:

TheanoConfigParser' object has no attribute 'gcc__cxxflags

At the top of the error message it reads:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
The installed Theano(-PyMC) version (1.0.5) does not match the PyMC3 requirements.
It was imported from ['C:\\Users\\caspe\\miniconda3\\envs\\precourse\\lib\\site-packages\\theano']
For PyMC3 to work, a compatible Theano-PyMC backend version must be installed.
See https://github.com/pymc-devs/pymc3/wiki for installation instructions.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

According to the error message, it seems that I did not install the correct Theano version. So I uninstalled Theano and installed theano-pymc instead. I tried to uninstall and reinstall theano-pymc and pymc3 and also delete the directories after uninstalling, but the error remains.

How can I successfully import pymc3?


问:
stimulus diable auto log methods fired for one controller
I try disable auto log info abount all controllers.

this code

```<code>this.application.debug = false;
</code>```

disable for all controllers is possible to disable in one ?

i also found this

```<code>static get config() {
        return {
            debug: false,
        }
    }
</code>```

but this not working

Body:
I try disable auto log info abount all controllers.

this code

this.application.debug = false;

disable for all controllers is possible to disable in one ?

i also found this

static get config() {
        return {
            debug: false,
        }
    }

but this not working


问:
How to separate each JUnit result report in Jenkins?
My project is composed of several DLLs that I must test with different unit tests. I generate an XML file for each of the tests then I transform them into a JUnit format to be read by Jenkins. It works very well.
On the other hand, the test results are all in the same topic on the Jenkins interface and I would like to separate them for each DLL.  It is for a more practical aspect for the visualization of the tests. I haven't found the solution yet. That's why I'm asking you if there is a solution for this problem.

I tried several plugins like JUnit or Warning NG. But the result remains the same. The JUnit plugin puts all the results in the same section and makes no distinction and the Warning NG plugin fails to parse the XML report to display it in Jenkins.


问:
How to export types of an package?
I would like to be able to display the types and arguments of the function of my package that I created, when I use it on a react app. Like this example:
enter image description here
Does anyone have an idea how to do it?
Thanks in advance !

I've tried to export my types and to import like this : import * as my package from 'package' in my react app but it doesn't work

Title: How to export types of an package?


问:
best way for versioning external configuration for microservices?
We are in process of versioning microservice for parallel deployments.

During this process we are versioning the entire service by following git release branches i.e. cut release branches from main during the release and maintain release branches as supporting that specific release.

Now we have a problem we are trying to solve which is Spring Cloud configuration.

We have external config server deployed which gets the configuration from Git repo.

What is best way to version the configuration properties or yaml files?

We have brainstromed different ideas like

single git repo and multiple branches for different version for e.g. service-v1 gets config from v1 branch and service-v2  gets config from v2 branch

single git repo and single branch but use prefix key and suffix as version for e.g. key1.v1=v1, key1.v2=v2

Please let me know what is better/clean approach or any best practices for solving this versioning of of configuration.

Thanks


问:
Hover over image sections, display annotation and a box around section
I have an image, and I would like to divide it into different sections. When the mouse is hovered over each section, I would like that section to be highlighted with a red box and a text box of some annotations appear. Is such a thing possible?

For example, if the picture is some buildings side by side, when I hover over the middle building, I would like a rectangle to appear over that building, and a panel to appear with some text information.

If this was a graph, I know could do it using plotly. But it is not a graph, just an image. Can something similar still be done in python or will I have to switch to HTML/CSS/Javascript (which I am not familiar with)?

As a starting point, I have used Pillow/PIL to create the red box at specific sections, but this does not address the interactive component I want.

Any advice for a relative beginner is welcomed.


问:
Rasa 3.x deployed on docker cant connect to duckling server
I have rasa running in a container and duckling running in another docker container.

I can access duckling from browser as well as postman but in rasa logs I get this error:

```<code>`rasa4     | 2023-01-05 10:16:01 ERROR`
 rasa.nlu.extractors.duckling_entity_extractor  - Failed to connect to duckling http server. Make sure the duckling server is running/healthy/not stale and the proper host and port are set in the configuration.

More information on how to run the server can be found on github: https://github.com/facebook/duckling#quickstart Error: HTTPConnectionPool(host='localhost', port=8000): Max retries exceeded with url: /parse (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb33c0733a0>: Failed to establish a new connection: [Errno 111] Connection refused'))
</code>```

this is my config.yml file:

```<code># The config recipe.
# https://rasa.com/docs/rasa/model-configuration/
recipe: default.v1

# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en

pipeline:

# # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
# # If you'd like to customize it, uncomment and adjust the pipeline.
# # See https://rasa.com/docs/rasa/tuning-your-model for more information.
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
  analyzer: char_wb
  min_ngram: 1
  max_ngram: 4
- name: DIETClassifier
  epochs: 100
  constrain_similarities: true
- name: EntitySynonymMapper
- name: ResponseSelector
  epochs: 100
  constrain_similarities: true
- name: FallbackClassifier
  threshold: 0.3
  ambiguity_threshold: 0.1
- name: "DucklingHTTPExtractor"
  # url of the running duckling server
  url: "http://0.0.0.0:8000"
  # dimensions to extract
  dimensions: ["time", "number", "amount-of-money", "distance"]

# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
# # No configuration for policies was provided. The following default policies were used to train your model.
# # If you'd like to customize them, uncomment and adjust the policies.
# # See https://rasa.com/docs/rasa/policies for more information.
#   - name: MemoizationPolicy
#   - name: RulePolicy
#   - name: UnexpecTEDIntentPolicy
#     max_history: 5
#     epochs: 100
#   - name: TEDPolicy
#     max_history: 5
#     epochs: 100
#     constrain_similarities: true
</code>```

I have installed docker on linux and followed all steps mentioned in rasa docker installation instructions

Body:
I have rasa running in a container and duckling running in another docker container.

I can access duckling from browser as well as postman but in rasa logs I get this error:

`rasa4     | 2023-01-05 10:16:01 ERROR`
 rasa.nlu.extractors.duckling_entity_extractor  - Failed to connect to duckling http server. Make sure the duckling server is running/healthy/not stale and the proper host and port are set in the configuration.

More information on how to run the server can be found on github: https://github.com/facebook/duckling#quickstart Error: HTTPConnectionPool(host='localhost', port=8000): Max retries exceeded with url: /parse (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb33c0733a0>: Failed to establish a new connection: [Errno 111] Connection refused'))

this is my config.yml file:

# The config recipe.
# https://rasa.com/docs/rasa/model-configuration/
recipe: default.v1

# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en

pipeline:

# # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
# # If you'd like to customize it, uncomment and adjust the pipeline.
# # See https://rasa.com/docs/rasa/tuning-your-model for more information.
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
  analyzer: char_wb
  min_ngram: 1
  max_ngram: 4
- name: DIETClassifier
  epochs: 100
  constrain_similarities: true
- name: EntitySynonymMapper
- name: ResponseSelector
  epochs: 100
  constrain_similarities: true
- name: FallbackClassifier
  threshold: 0.3
  ambiguity_threshold: 0.1
- name: "DucklingHTTPExtractor"
  # url of the running duckling server
  url: "http://0.0.0.0:8000"
  # dimensions to extract
  dimensions: ["time", "number", "amount-of-money", "distance"]

# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
# # No configuration for policies was provided. The following default policies were used to train your model.
# # If you'd like to customize them, uncomment and adjust the policies.
# # See https://rasa.com/docs/rasa/policies for more information.
#   - name: MemoizationPolicy
#   - name: RulePolicy
#   - name: UnexpecTEDIntentPolicy
#     max_history: 5
#     epochs: 100
#   - name: TEDPolicy
#     max_history: 5
#     epochs: 100
#     constrain_similarities: true

I have installed docker on linux and followed all steps mentioned in rasa docker installation instructions


问:
How to set default NULL for tinyint(1) using JPA
I have an entity with a Boolean object. As Boolean gets converted to TINYINT(1) in MYSQL, the values stored in the column is either 1 or 0.

I declared the column in entity class as:

```<code>@Column(name="boo")
Boolean boo = false;
</code>```

Currently, it is storing 0 for all columns.
How do I set default to NULL to all values.

Does this will set default to null ?

```<code>@ColumnDefault(value="null")
@Column(name="boo")
Boolean boo;
</code>```

or this,

```<code>@ColumnDefault(value="NULL")
@Column(name="boo")
Boolean boo;
</code>```

If none, what else can be done.
Thanks.

Body:
I have an entity with a Boolean object. As Boolean gets converted to TINYINT(1) in MYSQL, the values stored in the column is either 1 or 0.

I declared the column in entity class as:

@Column(name="boo")
Boolean boo = false;

Currently, it is storing 0 for all columns.
How do I set default to NULL to all values.

Does this will set default to null ?

@ColumnDefault(value="null")
@Column(name="boo")
Boolean boo;

or this,

@ColumnDefault(value="NULL")
@Column(name="boo")
Boolean boo;

If none, what else can be done.
Thanks.


问:
MySQL : Can't update table 'gradepoint' in stored function/trigger because it is already used by statement which invoked this stored function/trigger
I created MySQL syntax with triggers. When entering totalpoint data, the indexpoint column is automatically filled in based on the gradestandardpoint column in the gradestandard table, but I found some problems as follows :

Can't update table 'gradepoint' in stored function/trigger because it is already used by statement which invoked this stored function/trigger

From Code

```<code>DELIMITER //

CREATE TRIGGER update_indexpoint_trigger
AFTER INSERT ON gradepoint
FOR EACH ROW
BEGIN
  UPDATE gradepoint
  SET indexpoint = (SELECT gradestandardpoint FROM gradestandard WHERE lowlimit <= NEW.totalpoint AND uplimit >= NEW.totalpoint)
  WHERE studentid = NEW.studentid AND courseid = NEW.courseid;
END;
//

DELIMITER ;
</code>```

I have created a temporary table to insert data but still can't

```<code>CREATE TRIGGER update_indexpoint_trigger
AFTER INSERT ON gradepoint
FOR EACH ROW
BEGIN
  CREATE TEMPORARY TABLE temp_gradepoint (
    studentid INT,
    courseid INT,
    indexpoint CHAR(1)
  );

  INSERT INTO temp_gradepoint (studentid, courseid, indexpoint)
  SELECT studentid, courseid, (SELECT gradestandardpoint FROM gradestandard WHERE lowlimit <= NEW.totalpoint AND uplimit >= NEW.totalpoint)
  FROM gradepoint
  WHERE studentid = NEW.studentid AND courseid = NEW.courseid;

  UPDATE gradepoint
  SET indexpoint = (SELECT indexpoint FROM temp_gradepoint WHERE studentid = NEW.studentid AND courseid = NEW.courseid)
  WHERE studentid = NEW.studentid AND courseid = NEW.courseid;

  DROP TEMPORARY TABLE temp_gradepoint;
END;
</code>```

Table Gradepoint Table Gradepoint

Table gradestandard
Table gradestandard

Body:
I created MySQL syntax with triggers. When entering totalpoint data, the indexpoint column is automatically filled in based on the gradestandardpoint column in the gradestandard table, but I found some problems as follows :

Can't update table 'gradepoint' in stored function/trigger because it is already used by statement which invoked this stored function/trigger

From Code

DELIMITER //

CREATE TRIGGER update_indexpoint_trigger
AFTER INSERT ON gradepoint
FOR EACH ROW
BEGIN
  UPDATE gradepoint
  SET indexpoint = (SELECT gradestandardpoint FROM gradestandard WHERE lowlimit <= NEW.totalpoint AND uplimit >= NEW.totalpoint)
  WHERE studentid = NEW.studentid AND courseid = NEW.courseid;
END;
//

DELIMITER ;

I have created a temporary table to insert data but still can't

CREATE TRIGGER update_indexpoint_trigger
AFTER INSERT ON gradepoint
FOR EACH ROW
BEGIN
  CREATE TEMPORARY TABLE temp_gradepoint (
    studentid INT,
    courseid INT,
    indexpoint CHAR(1)
  );

  INSERT INTO temp_gradepoint (studentid, courseid, indexpoint)
  SELECT studentid, courseid, (SELECT gradestandardpoint FROM gradestandard WHERE lowlimit <= NEW.totalpoint AND uplimit >= NEW.totalpoint)
  FROM gradepoint
  WHERE studentid = NEW.studentid AND courseid = NEW.courseid;

  UPDATE gradepoint
  SET indexpoint = (SELECT indexpoint FROM temp_gradepoint WHERE studentid = NEW.studentid AND courseid = NEW.courseid)
  WHERE studentid = NEW.studentid AND courseid = NEW.courseid;

  DROP TEMPORARY TABLE temp_gradepoint;
END;

Table Gradepoint Table Gradepoint

Table gradestandard
Table gradestandard