问:
Is there a way to update headers of Chime Messaging API of aws-sdk/clients/chimesdkmessaging in ReactJs?
I am using aws-sdk/clients/chimesdkmessaging to make requests to get/delete/send channel messages.

But the issue is that the temporary credentials are expired after 1 hour and I cannot use the services without renewing the credentials. I am able to renew them, but couldn't set them in the API Request header.

I tried to set the request header as :

```<code>request.httpRequest.headers["x-amz-security-token"] = NEW_TOKEN
</code>```

But it didn't work. Also, I couldn't find anything on adding a middleware to these API's.

Here's my code

```<code> const ChimeMessaging = require("aws-sdk/clients/chimesdkmessaging");

 const chimeMessaging = new ChimeMessaging();

 async function sendChannelMessage(
      channelArn,
      messageContent,
      persistence,
      type,
      member,
      options = null
 ) {
    const chimeBearerArn = createMemberArn(member.userId);

    const params = {
     ChimeBearer: chimeBearerArn,
     ChannelArn: channelArn,
     Content: messageContent,
     Persistence: persistence, // Allowed types are PERSISTENT and NON_PERSISTENT
     Type: type,
    };
   const request = (await chimeMessagingClient()).sendChannelMessage(params)

  request.on("complete", function (err, data) {
     request.httpRequest.headers["x-amz-security-token"] = NEW_TOKEN
  });
  const response = await request.promise();
  const sentMessage = {
     response: response,
     CreatedTimestamp: new Date(),
     Sender: { Arn: createMemberArn(member.userId), Name: member.username },
   };
 return sentMessage;
}
</code>```

Body:
I am using aws-sdk/clients/chimesdkmessaging to make requests to get/delete/send channel messages.

But the issue is that the temporary credentials are expired after 1 hour and I cannot use the services without renewing the credentials. I am able to renew them, but couldn't set them in the API Request header.

I tried to set the request header as :

request.httpRequest.headers["x-amz-security-token"] = NEW_TOKEN

But it didn't work. Also, I couldn't find anything on adding a middleware to these API's.

Here's my code

 const ChimeMessaging = require("aws-sdk/clients/chimesdkmessaging");

 const chimeMessaging = new ChimeMessaging();

 async function sendChannelMessage(
      channelArn,
      messageContent,
      persistence,
      type,
      member,
      options = null
 ) {
    const chimeBearerArn = createMemberArn(member.userId);

    const params = {
     ChimeBearer: chimeBearerArn,
     ChannelArn: channelArn,
     Content: messageContent,
     Persistence: persistence, // Allowed types are PERSISTENT and NON_PERSISTENT
     Type: type,
    };
   const request = (await chimeMessagingClient()).sendChannelMessage(params)

  request.on("complete", function (err, data) {
     request.httpRequest.headers["x-amz-security-token"] = NEW_TOKEN
  });
  const response = await request.promise();
  const sentMessage = {
     response: response,
     CreatedTimestamp: new Date(),
     Sender: { Arn: createMemberArn(member.userId), Name: member.username },
   };
 return sentMessage;
}


来源: stackexchange

问:
Send Request from server to ngrok server in PHP
So I want to send a request from my server to NGROK server and it return null.
but when I check the URL, it return something.

I've tried so many ways, but it still doesn't work for me

this is my code

```<code>$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
));

$response = curl_exec($curl);

curl_close($curl);
return $response;
</code>```

I also tried request to another server (not NGROK) with same code, and it works. this is only happen on ngrok

ContentLicense: CC BY-SA 4.0

Body:
So I want to send a request from my server to NGROK server and it return null.
but when I check the URL, it return something.

I've tried so many ways, but it still doesn't work for me

this is my code

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'GET',
));

$response = curl_exec($curl);

curl_close($curl);
return $response;

I also tried request to another server (not NGROK) with same code, and it works. this is only happen on ngrok


问:
In NebulaGraph database, how I can get the out-degree/the in-degree of all the vertices
I found the way to get the degree for a given vertex in the manual, i.e., https://docs.nebula-graph.io/3.3.0/20.appendix/0.FAQ/#how_to_get_the_out-degreethe_in-degree_of_a_vertex_with_a_given_name

But how can I get all the degrees for all the vertices?


问:
Uncaught TypeError: J.aq(...).gHG is not a function - Flutter Web
I created a Cloudflare Page an used the dart peanut package to deploy my flutter web app. While a function is checking the auth state, a new error shows up (shown at bottom of post). I found the line that it happens at but I don't know why it happens. There is no issue with the iOS Flutter app and this works locally, just not on the deployed version.

Line from main.dart.js:

```<code>if(p!=null)if(p.length!==0)s=r?m:J.aq(s,k).gHG()
</code>```

Function that this error happens in:

```<code>    if (user.email == null || photoURL == null || displayName == null || photoURL.isEmpty || displayName.isEmpty) {
      // Show edit profile screen
      if (kDebugMode) {
        print('edit profile');
      }

      if (user.email == null) {
        infoNeeded.add('email');
      }
///*THE IF STATEMENT BELOW IS WHERE THE ERROR OCCURS*
      if (photoURL == null || photoURL.isEmpty) {
        infoNeeded.add('photoURL');
      }
      if (displayName == null || displayName.isEmpty || user.userMetadata?['displayName'].isBlank) {
        infoNeeded.add('displayName');
      }
    }
</code>```

Error (in console):

```<code>Uncaught TypeError: J.aq(...).gHG is not a function
    at Object.a3O (main.dart.js:24498:44)
    at main.dart.js:85449:3
    at aCp.a (main.dart.js:5863:62)
    at aCp.$2 (main.dart.js:40208:14)
    at aBr.$1 (main.dart.js:40202:21)
    at ayQ.ard (main.dart.js:41067:34)
    at ayQ.IU (main.dart.js:41069:21)
    at auP.$0 (main.dart.js:40548:11)
    at Object.yi (main.dart.js:5952:40)
    at a2.rJ (main.dart.js:40481:3)
</code>```

Body:
I created a Cloudflare Page an used the dart peanut package to deploy my flutter web app. While a function is checking the auth state, a new error shows up (shown at bottom of post). I found the line that it happens at but I don't know why it happens. There is no issue with the iOS Flutter app and this works locally, just not on the deployed version.

Line from main.dart.js:

if(p!=null)if(p.length!==0)s=r?m:J.aq(s,k).gHG()

Function that this error happens in:

    if (user.email == null || photoURL == null || displayName == null || photoURL.isEmpty || displayName.isEmpty) {
      // Show edit profile screen
      if (kDebugMode) {
        print('edit profile');
      }

      if (user.email == null) {
        infoNeeded.add('email');
      }
///*THE IF STATEMENT BELOW IS WHERE THE ERROR OCCURS*
      if (photoURL == null || photoURL.isEmpty) {
        infoNeeded.add('photoURL');
      }
      if (displayName == null || displayName.isEmpty || user.userMetadata?['displayName'].isBlank) {
        infoNeeded.add('displayName');
      }
    }

Error (in console):

Uncaught TypeError: J.aq(...).gHG is not a function
    at Object.a3O (main.dart.js:24498:44)
    at main.dart.js:85449:3
    at aCp.a (main.dart.js:5863:62)
    at aCp.$2 (main.dart.js:40208:14)
    at aBr.$1 (main.dart.js:40202:21)
    at ayQ.ard (main.dart.js:41067:34)
    at ayQ.IU (main.dart.js:41069:21)
    at auP.$0 (main.dart.js:40548:11)
    at Object.yi (main.dart.js:5952:40)
    at a2.rJ (main.dart.js:40481:3)


问:
How to get value from the dynamically created textfields in a table in flutter

In the above design, the textfields are dynamically created. In the textfield, the user will enter the quantity for the products. Now when I get the value from the textfield, I want to associate it with the color, product, and size ID's respectively. In the web, the web devs used custom attributes to embed the ID's in the textfields itself, so when fetching the data, they can also get the Color, size and product ID's from the custom attributes of that textfield. How should I go about doing that in flutter?


问:
How do you update a value (derived from a remote source) that updates with state change, in a FutureBuilder?

Background

I have an image widget that loads an image remotely from the network.

Before/while the image is being retrieved I have a placeholder with a fixed height of 200.0 in its place.

Once the image is loaded, I update the Widget to display the image

The catch is I want to update the height of the container to the new height of the image.  This is done in synchrony with changes to a scroll position so I can't just let the image container auto-adjust, I need the specific height of the newly downloaded image just before its displayed on screen.

My setup

I have a FutureBuilder as follows:

```<code>       FutureBuilder(
          future: getData(image:image, width:widget.width, height:widget.height),
          builder: (ctx, snapshot) {

            if (snapshot.connectionState == ConnectionState.done) {
              // If we got an error
              if (snapshot.hasError) {
... placeholder

                // if we got our data
              } else if (snapshot.hasData) {
                // Extracting data from snapshot object

                final thisimage = snapshot.data as FutureImageTransporter;
                final imageheight = thisimage.height
                  /// Do some stuff with image height here

                return Container(
                    width: widget.width,
                    height:thisimage.height, ///This needs to have the height value retrieved when the image is downloaded
                    child: thisimage.imagewidget
                );
              }
            else {
... placeholder
              }

            }
            else
            {
... placeholder
            }

          },

        ),
</code>```

The future data retrieves data from getData, which is a sort of pass through to get the image from MyCustomImage which returns an image widget from the extended image package which is as follows:

```<code>Future<FutureImageTransporter> getData({image, width, height}) {
  return Future.delayed(Duration(seconds: 6), () async {

    var finalImageWidget = MyCustomImage(
                                   input: image,
                                   width:width,
                                   height:height,
                                   );

    return finalImageWidget;
  });
}

</code>```

I'm using my own class called FutureImageTransporter to house the data, which consists of the actual image Widget and the height data (double).

```<code>class FutureImageTransporter{
  late Widget imagewidget;
  late double height;
}
</code>```

The actual image widget is constructed as follows with MyCustomImage, and I also want to return back the height of the image, both pieces packaged in a FutureImageTransporter

```<code>FutureImageTransporter MyCustomImage ({
  required input,
  width,
  height,
}) {

  double _finalHeight = 0.0;

  Widget finalImageWidget =
      ExtendedImage.network(
        input,
        key: ValueKey(input),
        width: width
        height: height
        enableMemoryCache: false,
        handleLoadingProgress: true,
        loadStateChanged: (ExtendedImageState state) {

          switch (state.extendedImageLoadState) {
            case LoadState.loading: return Container();

            case LoadState.completed:
              _finalHeight = state.extendedImageInfo?.image.height.toDouble() ?? 0.0;
              debugPrint(_finalHeight.toString());  /// This is properly outputting the final height of the image

                return ExtendedRawImage(
                  image: state.extendedImageInfo?.image,
                  fit: BoxFit.cover,
                  width: width
                  height: height
                );

            case LoadState.failed: return Container();
          }
        },
      );

  FutureImageTransporter tempvar = FutureImageTransporter();
                         tempvar.imagewidget = finalImageWidget;
                         tempvar.height = _finalHeight;  ///This is not updating to the _finalHeight which updates above

                          return tempvar;

}

</code>```

The Problem/Question

With the above setup, I'm using a FutureBuilder to successfully retrieve an image and then update the widget in my widget tree with the new image widget which is an ExtendedImage.network widget, which is something analogous to Image.Network().

Within ExtendedImage.network, the height of the image is successfully calculated _finalHeight = state.extendedImageInfo?.image.height.toDouble() ?? 0.0;.

However, which the widget does properly debugPrint the value of the image height, it never actually properly returns the value to my FutureBuilder.  The FutureBuilder only sees the originally initialized value of 0.0 double _finalHeight = 0.0; (or whatever default value I stick in there).

This problem seems to have to do with how Im retrieving data from a future and setting it up to pass between the widgets, but I can't understand where I went wrong, or if this is simply impossible?   This ends up being a TON of code, but what I originally thought would be a simple task.  Any ideas?

Body:
Background

I have an image widget that loads an image remotely from the network.

Before/while the image is being retrieved I have a placeholder with a fixed height of 200.0 in its place.

Once the image is loaded, I update the Widget to display the image

The catch is I want to update the height of the container to the new height of the image.  This is done in synchrony with changes to a scroll position so I can't just let the image container auto-adjust, I need the specific height of the newly downloaded image just before its displayed on screen.

My setup

I have a FutureBuilder as follows:

       FutureBuilder(
          future: getData(image:image, width:widget.width, height:widget.height),
          builder: (ctx, snapshot) {

            if (snapshot.connectionState == ConnectionState.done) {
              // If we got an error
              if (snapshot.hasError) {
... placeholder

                // if we got our data
              } else if (snapshot.hasData) {
                // Extracting data from snapshot object

                final thisimage = snapshot.data as FutureImageTransporter;
                final imageheight = thisimage.height
                  /// Do some stuff with image height here

                return Container(
                    width: widget.width,
                    height:thisimage.height, ///This needs to have the height value retrieved when the image is downloaded
                    child: thisimage.imagewidget
                );
              }
            else {
... placeholder
              }

            }
            else
            {
... placeholder
            }

          },

        ),

The future data retrieves data from getData, which is a sort of pass through to get the image from MyCustomImage which returns an image widget from the extended image package which is as follows:

Future<FutureImageTransporter> getData({image, width, height}) {
  return Future.delayed(Duration(seconds: 6), () async {

    var finalImageWidget = MyCustomImage(
                                   input: image,
                                   width:width,
                                   height:height,
                                   );

    return finalImageWidget;
  });
}

I'm using my own class called FutureImageTransporter to house the data, which consists of the actual image Widget and the height data (double).

class FutureImageTransporter{
  late Widget imagewidget;
  late double height;
}

The actual image widget is constructed as follows with MyCustomImage, and I also want to return back the height of the image, both pieces packaged in a FutureImageTransporter

FutureImageTransporter MyCustomImage ({
  required input,
  width,
  height,
}) {

  double _finalHeight = 0.0;

  Widget finalImageWidget =
      ExtendedImage.network(
        input,
        key: ValueKey(input),
        width: width
        height: height
        enableMemoryCache: false,
        handleLoadingProgress: true,
        loadStateChanged: (ExtendedImageState state) {

          switch (state.extendedImageLoadState) {
            case LoadState.loading: return Container();

            case LoadState.completed:
              _finalHeight = state.extendedImageInfo?.image.height.toDouble() ?? 0.0;
              debugPrint(_finalHeight.toString());  /// This is properly outputting the final height of the image

                return ExtendedRawImage(
                  image: state.extendedImageInfo?.image,
                  fit: BoxFit.cover,
                  width: width
                  height: height
                );

            case LoadState.failed: return Container();
          }
        },
      );

  FutureImageTransporter tempvar = FutureImageTransporter();
                         tempvar.imagewidget = finalImageWidget;
                         tempvar.height = _finalHeight;  ///This is not updating to the _finalHeight which updates above

                          return tempvar;

}

The Problem/Question

With the above setup, I'm using a FutureBuilder to successfully retrieve an image and then update the widget in my widget tree with the new image widget which is an ExtendedImage.network widget, which is something analogous to Image.Network().

Within ExtendedImage.network, the height of the image is successfully calculated _finalHeight = state.extendedImageInfo?.image.height.toDouble() ?? 0.0;.

However, which the widget does properly debugPrint the value of the image height, it never actually properly returns the value to my FutureBuilder.  The FutureBuilder only sees the originally initialized value of 0.0 double _finalHeight = 0.0; (or whatever default value I stick in there).

This problem seems to have to do with how Im retrieving data from a future and setting it up to pass between the widgets, but I can't understand where I went wrong, or if this is simply impossible?   This ends up being a TON of code, but what I originally thought would be a simple task.  Any ideas?


问:
MudTable.Items is null even row has data
I have a expenses MudTable table.

I want to display the total expense of the row data.

```<code><MudTable Loading="@loading" Class="mt-15"
    ServerData="@(new Func<TableState, Task<TableData<InvoiceVm>>>(GetServerData))" @ref="_table">
    <HeaderContent >
        <MudTh>Invoice no</MudTh>
        <MudTh>Date</MudTh>
    </HeaderContent>
    <RowTemplate>
        <MudTd DataLabel="Invoice No">@context.InvoiceNo</MudTd>
        <MudTd DataLabel="Date">@context.DateTime</MudTd>

    </RowTemplate>
        <FooterContent>
                  <MudTd colspan="6"><strong> Total expenses :</strong>  @_table.Items?.Sum((e) => (e.InvoiceDetails.Sum(x => (x.ProductPrice * x.Quantity))))</MudTd>
        </FooterContent>
</MudTable>
</code>```

Here @_table.Items? is null that is why I could not print the total expenses.
But the table row has data.

Why @_table.Items is null?

```<code>    private async Task<TableData<InvoiceVm>> GetServerData(TableState state)
    {
       // removed rest
        return new TableData<InvoiceVm>() { Items = response.Data, TotalItems = response.MetaData.TotalCount };

    }
</code>```

Body:
I have a expenses MudTable table.

I want to display the total expense of the row data.

<MudTable Loading="@loading" Class="mt-15"
    ServerData="@(new Func<TableState, Task<TableData<InvoiceVm>>>(GetServerData))" @ref="_table">
    <HeaderContent >
        <MudTh>Invoice no</MudTh>
        <MudTh>Date</MudTh>
    </HeaderContent>
    <RowTemplate>
        <MudTd DataLabel="Invoice No">@context.InvoiceNo</MudTd>
        <MudTd DataLabel="Date">@context.DateTime</MudTd>

    </RowTemplate>
        <FooterContent>
                  <MudTd colspan="6"> Total expenses :  @_table.Items?.Sum((e) => (e.InvoiceDetails.Sum(x => (x.ProductPrice * x.Quantity))))</MudTd>
        </FooterContent>
</MudTable>

Here @_table.Items? is null that is why I could not print the total expenses.
But the table row has data.

Why @_table.Items is null?

    private async Task<TableData<InvoiceVm>> GetServerData(TableState state)
    {
       // removed rest
        return new TableData<InvoiceVm>() { Items = response.Data, TotalItems = response.MetaData.TotalCount };

    }


问:
Keras ConvLSTM InvalidArgumentError
I'm new enough to TensorFlow and Keras that I might be missing something obvious, but this is driving me nuts. I inherited an app that trains a custom convolutional LSTM, and I just spent the last two months or so straightening out some really atrocious data wrangling, only to discover I can't get the model to train properly.

Here's the model definition (with hard values substituted for the variables in my actual code):

```<code>inputs = layers.Input(shape = (2, 23, 23, 10))
outputs = layers.ConvLSTM2D(filters = 32,
                        kernel_size = (5,5),
                        padding = "same",
                        return_sequences = True,
                        stateful = False,
                        activation = "relu")(inputs)
outputs = layers.BatchNormalization()(outputs)
outputs = layers.ConvLSTM2D(filters = 32,
                            kernel_size = (3,3),
                            padding = "same",
                            return_sequences = True,
                            stateful = False,
                            activation = "relu")(outputs)
outputs = layers.ConvLSTM2D(filters = 32,
                            kernel_size = (3,3),
                            padding = "same",
                            return_sequences = True,
                            stateful = False,
                            activation = "relu")(outputs)
outputs = layers.Conv3D(filters = 1,
                        kernel_size = (3, 3, 3),
                        padding = "same",
                        activation = "sigmoid")(outputs)
</code>```

If something looks squirrely there, let me know--I didn't create this model (though I did change the input grid from 100 x 100 to 23 x 23, if that makes a difference). The idea is to predict the intensity of a particular weather phenomenon (that's a single number for each grid point at each time).

Here's the model summary produced after the model is defined:

```<code>Model: "model"
_________________________________________________________________
 Layer (type)                Output Shape              Param #
=================================================================
 input_1 (InputLayer)        [(None, 2, 23, 23, 10)]   0

 conv_lstm2d (ConvLSTM2D)    (None, 2, 23, 23, 32)     134528

 batch_normalization (BatchN  (None, 2, 23, 23, 32)    128
 ormalization)

 conv_lstm2d_1 (ConvLSTM2D)  (None, 2, 23, 23, 32)     73856

 conv_lstm2d_2 (ConvLSTM2D)  (None, 2, 23, 23, 32)     73856

 conv3d (Conv3D)             (None, 2, 23, 23, 1)      865

=================================================================
Total params: 283,233
Trainable params: 283,169
Non-trainable params: 64
_________________________________________________________________
</code>```

The model is fit using data from a custom Sequence sub-class, which produces X input of shape ([batch size], 2, 23, 23, 10) and Y input of shape ([batch size], 2, 23, 23, 1). The batch size is usually 8, but because of the way the data is lazily loaded, the last batch in a particular block of files may be smaller, which is why I don't specify a batch size in model definition.   For the record, the original coders had a constant batch size, though, as with mine, it wasn't specified in the model definition.

When I try to fit the model, I get a crash pretty quickly, with this traceback:

```<code>Traceback (most recent call last):
  File "C:/code/Python/edapts/ConvLSTM2D.py", line 175, in <module>
    history = model.fit(training_data,
  File "C:\Python\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "C:\Python\lib\site-packages\tensorflow\python\eager\execute.py", line 54, in quick_execute
    tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InvalidArgumentError: Graph execution error:

Detected at node 'gradient_tape/model/conv_lstm2d/transpose_1/transpose' defined at (most recent call last):
    File "C:/code/Python/edapts/ConvLSTM2D.py", line 175, in <module>
      history = model.fit(training_data,
    File "C:\Python\lib\site-packages\keras\utils\traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "C:\Python\lib\site-packages\keras\engine\training.py", line 1409, in fit
      tmp_logs = self.train_function(iterator)
    File "C:\Python\lib\site-packages\keras\engine\training.py", line 1051, in train_function
      return step_function(self, iterator)
    File "C:\Python\lib\site-packages\keras\engine\training.py", line 1040, in step_function
      outputs = model.distribute_strategy.run(run_step, args=(data,))
    File "C:\Python\lib\site-packages\keras\engine\training.py", line 1030, in run_step
      outputs = model.train_step(data)
    File "C:\Python\lib\site-packages\keras\engine\training.py", line 893, in train_step
      self.optimizer.minimize(loss, self.trainable_variables, tape=tape)
    File "C:\Python\lib\site-packages\keras\optimizers\optimizer_v2\optimizer_v2.py", line 537, in minimize
      grads_and_vars = self._compute_gradients(
    File "C:\Python\lib\site-packages\keras\optimizers\optimizer_v2\optimizer_v2.py", line 590, in _compute_gradients
      grads_and_vars = self._get_gradients(tape, loss, var_list, grad_loss)
    File "C:\Python\lib\site-packages\keras\optimizers\optimizer_v2\optimizer_v2.py", line 471, in _get_gradients
      grads = tape.gradient(loss, var_list, grad_loss)
Node: 'gradient_tape/model/conv_lstm2d/transpose_1/transpose'
transpose expects a vector of size 4. But input(1) is a vector of size 5
     [[{{node gradient_tape/model/conv_lstm2d/transpose_1/transpose}}]] [Op:__inference_train_function_9880]
</code>```

I'm so lost. The only thing I can think of is that the original coders made the X and Y features the same, whereas I'm only trying to predict 1 of the 10 (there's not actually a reason to predict the others--not sure why they were trying to). If that's the problem, how do I redefine the model to take account of the different output shape?

EDIT: Well, that's interesting. I just compared the model definition from the original team with the model definition used by the co-worker I inherited the code from. Said co-worker seems to have inserted an extra layer in the outputs, duplicating the ConvLSTM2D with 32 filters and kernel size (3,3). When I remove one of those duplicates, everything runs just fine....

Great, so it's "fixed". But is there someone who can explain why it wasn't working in the first place? My level of understanding the issue at this point is to cross myself and throw salt over my shoulder.

EDIT #2: Does the problem result from having such a small grid (23 x 23)? So either a bigger grid or smaller kernels would solve the problem without deleting a layer? That seems intuitively likely, but I'd like to know the match to calculate how the outputs from each layer match up with the definition of the next layer.

Title: Keras ConvLSTM InvalidArgumentError

Body:
I'm new enough to TensorFlow and Keras that I might be missing something obvious, but this is driving me nuts. I inherited an app that trains a custom convolutional LSTM, and I just spent the last two months or so straightening out some really atrocious data wrangling, only to discover I can't get the model to train properly.

Here's the model definition (with hard values substituted for the variables in my actual code):

inputs = layers.Input(shape = (2, 23, 23, 10))
outputs = layers.ConvLSTM2D(filters = 32,
                        kernel_size = (5,5),
                        padding = "same",
                        return_sequences = True,
                        stateful = False,
                        activation = "relu")(inputs)
outputs = layers.BatchNormalization()(outputs)
outputs = layers.ConvLSTM2D(filters = 32,
                            kernel_size = (3,3),
                            padding = "same",
                            return_sequences = True,
                            stateful = False,
                            activation = "relu")(outputs)
outputs = layers.ConvLSTM2D(filters = 32,
                            kernel_size = (3,3),
                            padding = "same",
                            return_sequences = True,
                            stateful = False,
                            activation = "relu")(outputs)
outputs = layers.Conv3D(filters = 1,
                        kernel_size = (3, 3, 3),
                        padding = "same",
                        activation = "sigmoid")(outputs)

If something looks squirrely there, let me know--I didn't create this model (though I did change the input grid from 100 x 100 to 23 x 23, if that makes a difference). The idea is to predict the intensity of a particular weather phenomenon (that's a single number for each grid point at each time).

Here's the model summary produced after the model is defined:

Model: "model"
_________________________________________________________________
 Layer (type)                Output Shape              Param #
=================================================================
 input_1 (InputLayer)        [(None, 2, 23, 23, 10)]   0

 conv_lstm2d (ConvLSTM2D)    (None, 2, 23, 23, 32)     134528

 batch_normalization (BatchN  (None, 2, 23, 23, 32)    128
 ormalization)

 conv_lstm2d_1 (ConvLSTM2D)  (None, 2, 23, 23, 32)     73856

 conv_lstm2d_2 (ConvLSTM2D)  (None, 2, 23, 23, 32)     73856

 conv3d (Conv3D)             (None, 2, 23, 23, 1)      865

=================================================================
Total params: 283,233
Trainable params: 283,169
Non-trainable params: 64
_________________________________________________________________

The model is fit using data from a custom Sequence sub-class, which produces X input of shape ([batch size], 2, 23, 23, 10) and Y input of shape ([batch size], 2, 23, 23, 1). The batch size is usually 8, but because of the way the data is lazily loaded, the last batch in a particular block of files may be smaller, which is why I don't specify a batch size in model definition.   For the record, the original coders had a constant batch size, though, as with mine, it wasn't specified in the model definition.

When I try to fit the model, I get a crash pretty quickly, with this traceback:

Traceback (most recent call last):
  File "C:/code/Python/edapts/ConvLSTM2D.py", line 175, in <module>
    history = model.fit(training_data,
  File "C:\Python\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "C:\Python\lib\site-packages\tensorflow\python\eager\execute.py", line 54, in quick_execute
    tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InvalidArgumentError: Graph execution error:

Detected at node 'gradient_tape/model/conv_lstm2d/transpose_1/transpose' defined at (most recent call last):
    File "C:/code/Python/edapts/ConvLSTM2D.py", line 175, in <module>
      history = model.fit(training_data,
    File "C:\Python\lib\site-packages\keras\utils\traceback_utils.py", line 64, in error_handler
      return fn(*args, **kwargs)
    File "C:\Python\lib\site-packages\keras\engine\training.py", line 1409, in fit
      tmp_logs = self.train_function(iterator)
    File "C:\Python\lib\site-packages\keras\engine\training.py", line 1051, in train_function
      return step_function(self, iterator)
    File "C:\Python\lib\site-packages\keras\engine\training.py", line 1040, in step_function
      outputs = model.distribute_strategy.run(run_step, args=(data,))
    File "C:\Python\lib\site-packages\keras\engine\training.py", line 1030, in run_step
      outputs = model.train_step(data)
    File "C:\Python\lib\site-packages\keras\engine\training.py", line 893, in train_step
      self.optimizer.minimize(loss, self.trainable_variables, tape=tape)
    File "C:\Python\lib\site-packages\keras\optimizers\optimizer_v2\optimizer_v2.py", line 537, in minimize
      grads_and_vars = self._compute_gradients(
    File "C:\Python\lib\site-packages\keras\optimizers\optimizer_v2\optimizer_v2.py", line 590, in _compute_gradients
      grads_and_vars = self._get_gradients(tape, loss, var_list, grad_loss)
    File "C:\Python\lib\site-packages\keras\optimizers\optimizer_v2\optimizer_v2.py", line 471, in _get_gradients
      grads = tape.gradient(loss, var_list, grad_loss)
Node: 'gradient_tape/model/conv_lstm2d/transpose_1/transpose'
transpose expects a vector of size 4. But input(1) is a vector of size 5
     [[{{node gradient_tape/model/conv_lstm2d/transpose_1/transpose}}]] [Op:__inference_train_function_9880]

I'm so lost. The only thing I can think of is that the original coders made the X and Y features the same, whereas I'm only trying to predict 1 of the 10 (there's not actually a reason to predict the others--not sure why they were trying to). If that's the problem, how do I redefine the model to take account of the different output shape?

EDIT: Well, that's interesting. I just compared the model definition from the original team with the model definition used by the co-worker I inherited the code from. Said co-worker seems to have inserted an extra layer in the outputs, duplicating the ConvLSTM2D with 32 filters and kernel size (3,3). When I remove one of those duplicates, everything runs just fine....

Great, so it's "fixed". But is there someone who can explain why it wasn't working in the first place? My level of understanding the issue at this point is to cross myself and throw salt over my shoulder.

EDIT #2: Does the problem result from having such a small grid (23 x 23)? So either a bigger grid or smaller kernels would solve the problem without deleting a layer? That seems intuitively likely, but I'd like to know the match to calculate how the outputs from each layer match up with the definition of the next layer.


问:
Pandas, fillin the empty time-series with a charging battery pattern
I want to simulate battery charging data.

Imagine there is a battery with a constant capacity. e.g. 30000, in the real world a person will charge it at random times at 18:00-18:30, so sometimes the he starts at 18:29 some times start at 18:00, so the half hourly value will be varied by the start charging time. But the total amount won't be changed.

```<code>index   value
0   2021-01-01 00:00:00 0
1   2021-01-01 00:30:00 0
2   2021-01-01 01:00:00 0
3   2021-01-01 01:30:00 0
4   2021-01-01 02:00:00 0
... ... ...
995 2021-01-21 17:30:00 0
996 2021-01-21 18:00:00 0
997 2021-01-21 18:30:00 0
998 2021-01-21 19:00:00 0
999 2021-01-21 19:30:00 0
1000    2021-01-21 20:00:00 0

</code>```

So, if the charging speed is 5000 per half hour, it sometimes likes:[10,5000,5000,5000,5000,5000,4990], and sometimes [2500,5000,5000,5000,5000,2500].
And I want to generate such a pattern and insert it into a given time.

```<code>index   value
0   2021-01-01 00:00:00 0
1   2021-01-01 00:30:00 0
2   2021-01-01 01:00:00 0
3   2021-01-01 01:30:00 0
4   2021-01-01 02:00:00 0
... ... ...
995 2021-01-21 17:30:00 0
996 2021-01-21 18:00:00 2500
997 2021-01-21 18:30:00 5000
998 2021-01-21 19:00:00 5000
999 2021-01-21 19:30:00 5000
1000    2021-01-21 20:00:00 5000
1001    2021-01-01 20:30:00 2500
1002    2021-01-01 21:00:00 0

</code>```

Assume he charging around the time defined by start parameter. If the start is '2021-01-01 18:00' it will start charging between 18:00 to 18:30.
The function I want:

def insertPattern(emptyTimeseriesDF, capacity, speed, start) :

    return dfWithInsertedPattern

```
<p>Empty ts generated by:</p>
```index = pd.date_range(datetime.datetime(2021,1,1), periods=1000, freq='30min')
columns = ['value']

df = pd.DataFrame(index=index, columns=columns)
df = df.fillna(0)
df = df.reset_index()
df
```

Body:
I want to simulate battery charging data.

Imagine there is a battery with a constant capacity. e.g. 30000, in the real world a person will charge it at random times at 18:00-18:30, so sometimes the he starts at 18:29 some times start at 18:00, so the half hourly value will be varied by the start charging time. But the total amount won't be changed.

index   value
0   2021-01-01 00:00:00 0
1   2021-01-01 00:30:00 0
2   2021-01-01 01:00:00 0
3   2021-01-01 01:30:00 0
4   2021-01-01 02:00:00 0
... ... ...
995 2021-01-21 17:30:00 0
996 2021-01-21 18:00:00 0
997 2021-01-21 18:30:00 0
998 2021-01-21 19:00:00 0
999 2021-01-21 19:30:00 0
1000    2021-01-21 20:00:00 0

So, if the charging speed is 5000 per half hour, it sometimes likes:[10,5000,5000,5000,5000,5000,4990], and sometimes [2500,5000,5000,5000,5000,2500].
And I want to generate such a pattern and insert it into a given time.

index   value
0   2021-01-01 00:00:00 0
1   2021-01-01 00:30:00 0
2   2021-01-01 01:00:00 0
3   2021-01-01 01:30:00 0
4   2021-01-01 02:00:00 0
... ... ...
995 2021-01-21 17:30:00 0
996 2021-01-21 18:00:00 2500
997 2021-01-21 18:30:00 5000
998 2021-01-21 19:00:00 5000
999 2021-01-21 19:30:00 5000
1000    2021-01-21 20:00:00 5000
1001    2021-01-01 20:30:00 2500
1002    2021-01-01 21:00:00 0

Assume he charging around the time defined by start parameter. If the start is '2021-01-01 18:00' it will start charging between 18:00 to 18:30.
The function I want:

def insertPattern(emptyTimeseriesDF, capacity, speed, start) :

    return dfWithInsertedPattern

Empty ts generated by:

index = pd.date_range(datetime.datetime(2021,1,1), periods=1000, freq='30min')
columns = ['value']

df = pd.DataFrame(index=index, columns=columns)
df = df.fillna(0)
df = df.reset_index()
df


问:
'Flutter/Flutter.h' file not found

Hello Folks,

When I try to run my project either in xcode or in Android studio in iOS 16.1 device then it says like  "error: 'Flutter/Flutter.h' file not found" and "error: failed to emit precompiled header ios/Runner/Runner-Bridging-Header.h".

Following are my current details:

MacOS: 13.0.1 Ventura
Flutter: 3.3.8
Dart: 2.18.4
Android Studion Chipmunk

If anyone have any valid solution to this issue which actually works then it will be very helpful.

Thanks.

I did try following solutions:

https://stackoverflow.com/questions/64973346/error-flutter-flutter-h-file-not-found-when-flutter-run-on-ios

Tried deleting ios flutter and regenerate it.

Tried Flutter clean, pub get, cd ios, pod install, pod update but nothing worked.

Title: 'Flutter/Flutter.h' file not found


问:
How to create multiple Treeview window with same format/layout upon clicking a button in Python Tkinter?
Currently I have one window that displays two Treeview frames(festo and transformer) that of identical layout. These treeview layout should display different user data from txt files. Hence, the no of Treeview windows are dynamic based on the no txt files in a folder. Is it possible to create/generate multiple pop-up Treeview windows of the same layout upon a button click?

```class HomePage(Tk):
    def __init__(self, *args, **kwargs):
        Tk.__init__(self, *args, **kwargs)
        self.notebook = ttk.Notebook()  # Create a notebook widget
        self.add_tab1()
        #self.add_tab2()
        self.notebook.grid(row=0)
        self.notebook.pack(expand=1, fill="both")

    def add_tab1(self):
        tab1 = tab_one(self.notebook)
        self.notebook.add(tab1, text="Home")

    def add_tab2(self):
        tab2 = ttk.Notebook()
        self.notebook.add(tab2, text="Reports")

class data_table(object):
    def __init__(self, site, panels_count, tev_count):
        self.site = site
        self.panels_count = panels_count
        self.tev_count = tev_count

class tab_one(Frame):
    def __init__(self, *args, **kwargs):
        Frame.__init__(self, *args, **kwargs)
        # Creating frames on the window/canvas for the first tab
        frame_selectfile = tk.LabelFrame(self, text="Step 1: Zip File Extraction ", bd=6)  # Frame1 on the window/canvas
        frame_selectfile.grid(column=0, row=0, padx=10, pady=10, sticky='NSEW')  # Positioning frame1
        frame_selectfile.configure(borderwidth=1)
        self.grid_columnconfigure(0, weight=1)  # Configuring the column for the main window/canvas
        self.grid_rowconfigure(0, weight=1)  # Configuring the row for the main window/canvas

        frame_checkpd = tk.LabelFrame(self, text="Step 2: Check PD ", bd=6)  # Frame2 on the window/canvas
        frame_checkpd.grid(column=1, row=0, padx=10, pady=10, sticky='NSEW')  # Positioning frame2
        frame_checkpd.configure(borderwidth=1)
        self.grid_columnconfigure(1, weight=1)  # Configuring the column for the main window/canvas
        self.grid_rowconfigure(1, weight=1)  # Configuring the row for the main window/canvas

        frame_festo = tk.LabelFrame(self, text="Festo: ", bd=6)  # Frame1 on the window/canvas
        frame_festo.grid(column=0, row=1, padx=10, pady=10, sticky='NSEW')  # Positioning frame1
        frame_festo.configure(borderwidth=1)
        self.grid_columnconfigure(1, weight=1)  # Configuring the column for the main window/canvas
        self.grid_rowconfigure(1, weight=1)  # Configuring the row for the main window/canvas

        frame_transform = tk.LabelFrame(self, text="Transformer: ", bd=6)  # Frame1 on the window/canvas
        frame_transform.grid(column=1, row=1, padx=10, pady=10, sticky='NSEW')  # Positioning frame1
        frame_transform.configure(borderwidth=1)
        self.grid_columnconfigure(1, weight=1)  # Configuring the column for the main window/canvas
        self.grid_rowconfigure(1, weight=1)  # Configuring the row for the main window/canvas

        # Initializing all variables in frame_selectfile
        file_ID = tk.StringVar()
        file_ID2 = tk.StringVar()
        location_id = tk.StringVar()
        location_id2 = tk.StringVar()
        unzip_status = tk.StringVar()
        tmpdir = tempfile.TemporaryDirectory().name
        #self.create_dir_ifnot_exist(tmpdir)
        zip_filename = tk.StringVar()
        site_id = tk.StringVar()
        site_id.set("0")
        data_table_list = []
        file_counter = tk.StringVar()

        # Initializing all variables in frame_festo
        festo_date_id = tk.StringVar()
        festo_job_id = tk.StringVar()
        festo_engineer_id = tk.StringVar()
        festo_station_id = tk.StringVar()
        festo_voltage_id = tk.StringVar()
        festo_db_id = tk.StringVar()
        festo_pd_id = tk.StringVar()

        # Initializing all variables in frame_transform
        transform_date_id = tk.StringVar()
        transform_job_id = tk.StringVar()
        transform_engineer_id = tk.StringVar()
        transform_station_id = tk.StringVar()
        transform_voltage_id = tk.StringVar()
        transform_db_id = tk.StringVar()
        transform_pd_id = tk.StringVar()

        topframe = tk.LabelFrame(frame_festo, bd=0)

        topframe_transform = tk.LabelFrame(frame_transform, bd=0)

        middleframe = tk.LabelFrame(frame_selectfile, bd=5)

        databaseView = ttk.Treeview(middleframe, selectmode="browse")

        #label_filename = tk.Label(frame_selectfile, text=" ", width=10, relief='flat').grid(column=0, row=1, padx=5, pady=5, sticky='NW')
        label_filelocation = tk.Label(frame_selectfile, text="File Location:", width=12, relief='flat').grid(column=0, row=0, padx=5, pady=5, sticky='NW')

        filename_Entry = tk.Label(frame_selectfile, width=52, textvariable=file_ID)
        filename_Entry.grid(column=1, row=0, padx=5, pady=5, sticky='NW')
        filename_Entry.configure(state='normal')

        filelocation_Entry = tk.Entry(frame_selectfile, width=60, textvariable=location_id)
        filelocation_Entry.grid(column=1, row=0, padx=5, pady=5, sticky='W')
        filelocation_Entry.configure(background='palegreen', foreground='black')

        middleframe2 = tk.LabelFrame(frame_festo, bd=5)
        databaseView2 = ttk.Treeview(middleframe2, selectmode="browse")

        transform_middle_frame = tk.LabelFrame(frame_transform, bd=5)

        transformView = ttk.Treeview(transform_middle_frame, selectmode="browse")
        #label_filename2 = tk.Label(topframe, text=" ", width=10, relief='flat').grid(column=0, row=1, padx=5, pady=5, sticky='NW')

        #label_filelocation2 = tk.Label(topframe, text="File Location:", width=12, relief='flat').grid(column=0, row=2, padx=5, pady=5, sticky='NW')

        label_festo_date_id = tk.Label(topframe, text="Scanned Date:", width=12, relief='flat').grid(column=0, row=0, padx=5, pady=5, sticky='NW')
        label_festo_job_id = tk.Label(topframe, text="Job No:", width=12, relief='flat').grid(column=2, row=0, padx=5, pady=5, sticky='NW')
        label_festo_engineer_id = tk.Label(topframe, text="Engineer:", width=12, relief='flat').grid(column=4, row=0, padx=5, pady=5, sticky='NW')
        label_festo_station_id = tk.Label(topframe, text="Station:", width=12, relief='flat').grid(column=0, row=1, padx=5, pady=5, sticky='W')
        label_festo_voltage_id = tk.Label(topframe, text="Operating Voltage(kV):", width=18, relief='flat').grid(column=2, row=1, padx=5, pady=5, sticky='NW')
        label_festo_db_id = tk.Label(topframe, text="Max dB:", width=12, relief='flat').grid(column=4, row=1, padx=5, pady=5, sticky='NW')
        #label_festo_pd_id = tk.Label(topframe, text="Max PD:", width=12, relief='flat').grid(column=0, row=2, padx=5, pady=5, sticky='NW')

        festo_date_id_Entry = tk.Entry(topframe, width=15, textvariable=festo_date_id)
        festo_date_id_Entry.grid(column=1, row=0, padx=5, pady=5, sticky='NW')
        festo_date_id_Entry.configure(state='normal')

        festo_job_id_Entry = tk.Entry(topframe, width=15, textvariable=festo_job_id)
        festo_job_id_Entry.grid(column=3, row=0, padx=5, pady=5, sticky='NW')
        festo_job_id_Entry.configure(state='normal')

        festo_engineer_id_Entry = tk.Entry(topframe, width=15, textvariable=festo_engineer_id)
        festo_engineer_id_Entry.grid(column=5, row=0, padx=5, pady=5, sticky='NW')
        festo_engineer_id_Entry.configure(state='normal')

        festo_station_id_Entry = tk.Entry(topframe, width=15, textvariable=festo_station_id)
        festo_station_id_Entry.grid(column=1, row=1, padx=5, pady=5, sticky='NW')
        festo_station_id_Entry.configure(state='normal')

        festo_voltage_id_Entry = tk.Entry(topframe, width=15, textvariable=festo_voltage_id)
        festo_voltage_id_Entry.grid(column=3, row=1, padx=5, pady=5, sticky='NW')
        festo_voltage_id_Entry.configure(state='normal')

        festo_db_id_Entry = tk.Entry(topframe, width=15, textvariable=festo_db_id)
        festo_db_id_Entry.grid(column=5, row=1, padx=5, pady=5, sticky='NW')
        festo_db_id_Entry.configure(state='normal')

        label_transform_date_id = tk.Label(topframe_transform, text="Scanned Date:", width=12, relief='flat').grid(column=0, row=0, padx=5, pady=5, sticky='NW')
        label_transform_job_id = tk.Label(topframe_transform, text="Job No:", width=12, relief='flat').grid(column=2, row=0, padx=5, pady=5, sticky='NW')
        label_transform_engineer_id = tk.Label(topframe_transform, text="Engineer:", width=12, relief='flat').grid(column=4, row=0, padx=5, pady=5, sticky='NW')
        label_transform_station_id = tk.Label(topframe_transform, text="Station:", width=12, relief='flat').grid(column=0, row=1, padx=5, pady=5, sticky='NW')
        label_transform_voltage_id = tk.Label(topframe_transform, text="Operating Voltage(kV):", width=18, relief='flat').grid(column=2, row=1, padx=5, pady=5, sticky='NW')
        label_transform_db_id = tk.Label(topframe_transform, text="Max dB:", width=12, relief='flat').grid(column=4, row=1, padx=5, pady=5, sticky='NW')
        #label_transform_pd_id = tk.Label(topframe, text="Max PD:", width=12, relief='flat').grid(column=0, row=2, padx=5, pady=5, sticky='NW')

        transform_date_id_Entry = tk.Entry(topframe_transform, width=15, textvariable=transform_date_id)
        transform_date_id_Entry.grid(column=1, row=0, padx=5, pady=5, sticky='NW')
        transform_date_id_Entry.configure(state='normal')

        transform_job_id_Entry = tk.Entry(topframe_transform, width=15, textvariable=transform_job_id)
        transform_job_id_Entry.grid(column=3, row=0, padx=5, pady=5, sticky='NW')
        transform_job_id_Entry.configure(state='normal')

        transform_engineer_id_Entry = tk.Entry(topframe_transform, width=15, textvariable=transform_engineer_id)
        transform_engineer_id_Entry.grid(column=5, row=0, padx=5, pady=5, sticky='NW')
        transform_engineer_id_Entry.configure(state='normal')

        transform_station_id_Entry = tk.Entry(topframe_transform, width=15, textvariable=transform_station_id)
        transform_station_id_Entry.grid(column=1, row=1, padx=5, pady=5, sticky='NW')
        transform_station_id_Entry.configure(state='normal')

        transform_voltage_id_Entry = tk.Entry(topframe_transform, width=15, textvariable=transform_voltage_id)
        transform_voltage_id_Entry.grid(column=3, row=1, padx=5, pady=5, sticky='NW')
        transform_voltage_id_Entry.configure(state='normal')

        transform_db_id_Entry = tk.Entry(topframe_transform, width=15, textvariable=transform_db_id)
        transform_db_id_Entry.grid(column=5, row=1, padx=5, pady=5, sticky='NW')
        transform_db_id_Entry.configure(state='normal')

        unzip_status.set("")
        label_unzipstatus = tk.Label(frame_selectfile, width=20, relief='flat', textvariable=unzip_status)
        label_unzipstatus.grid(column=1, row=5, padx=5, pady=5, sticky='NSEW')

        selectzip_button = tk.Button(frame_selectfile, width=20, text="Select Zip File", command=lambda: self.upload_action(location_id, zip_filename, tmpdir))
        selectzip_button.grid(column=1, row=3, padx=5, pady=3, ipady=3, sticky='SW')

        unzip_button = tk.Button(frame_selectfile, width=20, text="Extract", command=lambda: self.extract_nested_zip(databaseView, data_table_list, location_id.get(), tmpdir, zip_filename, site_id, False))
        unzip_button.grid(column=1, row=3, padx=5, pady=3, ipady=3, sticky='NE')

        # Creating LabelFrame in frame_unzip
        upperframe = tk.LabelFrame(frame_selectfile, bd=0)
        frame_selectfile.rowconfigure(0, weight=1)
        frame_selectfile.columnconfigure(2, weight=1)
        upperframe.grid(column=0, row=6, columnspan=2, sticky='W')

        # middleframe = tk.LabelFrame(frame_selectfile, bd=5)
        middleframe.configure(borderwidth=1)
        frame_selectfile.columnconfigure(2, weight=1)
        frame_selectfile.rowconfigure(1, weight=1)
        middleframe.grid(column=0, row=7, columnspan=2, sticky="NSEW")

        middleframe2.configure(borderwidth=1)
        frame_festo.columnconfigure(2, weight=1)
        frame_festo.rowconfigure(1, weight=1)
        middleframe2.grid(column=0, row=1, columnspan=2, sticky="NSEW")

        transform_middle_frame.configure(borderwidth=1)
        frame_transform.columnconfigure(2, weight=1)
        frame_transform.rowconfigure(1, weight=1)
        transform_middle_frame.grid(column=0, row=1, columnspan=2, sticky="NSEW")

#         lowerframe = tk.LabelFrame(frame_selectfile, bd=0)
#         lowerframe.grid(column=0, row=7)
#         frame_selectfile.columnconfigure(2, weight=1)
#         frame_selectfile.rowconfigure(2, weight=0)

        topframe.configure(borderwidth=1)
        frame_festo.columnconfigure(2, weight=1)
        frame_festo.rowconfigure(1, weight=1)
        topframe.grid(column=0, row=0, columnspan=2, sticky="NSEW")

        topframe_transform.configure(borderwidth=1)
        frame_transform.columnconfigure(2, weight=1)
        frame_transform.rowconfigure(1, weight=1)
        topframe_transform.grid(column=0, row=0, columnspan=2, sticky="NSEW")

        # Labels in frame_unzip
        label18 = tk.Label(upperframe, text="Number of sites:", relief='flat')
        label18.grid(column=0, row=0, padx=5, pady=5, sticky='W')

        site_Entry = tk.Entry(upperframe, width=45, textvariable=site_id)
        site_Entry.grid(column=1, row=0, padx=10, pady=5, sticky='E')
        site_Entry.configure(state='normal', background='palegreen', foreground='black')

        # Button Widgets in frame_unzip
        #unzip_btn = tk.Button(upperframe, width=10, text="Unzip File", command=lambda: Unzip(databaseview))
        #unzip_btn.grid(column=2, row=0, padx=0, pady=5, ipady=2, sticky='E')

#         label_details = tk.Label(upperframe, text=" ", relief='flat')
#         label_details.grid(column=0, row=2, padx=5, pady=0, sticky='W')
        # Combobox Widgets in frame_unzip

        # initializing treeview in frame_unzip
        # databaseView = ttk.Treeview(middleframe, selectmode="browse")
        databaseView.columnconfigure(2, weight=1)
        databaseView.grid(column=0, row=0, columnspan=2, sticky="NSEW")

        databaseView2.columnconfigure(2, weight=1)
        databaseView2.grid(column=0, row=0, columnspan=2, sticky="NSEW")

        transformView.columnconfigure(2, weight=1)
        transformView.grid(column=0, row=0, columnspan=2, sticky="NSEW")

        # Creating treeview in frame_unzip
        vsb = Scrollbar(middleframe, orient="vertical", command=databaseView.yview())
        hsb = Scrollbar(middleframe, orient="horizontal")

        vsb = Scrollbar(middleframe2, orient="vertical", command=databaseView2.yview())
        hsb = Scrollbar(middleframe2, orient="horizontal")

        vsb = Scrollbar(transform_middle_frame, orient="vertical", command=transformView.yview())
        hsb = Scrollbar(transform_middle_frame, orient="horizontal")

        middleframe.columnconfigure(0, weight=1)
        middleframe.rowconfigure(0, weight=1)
        databaseView["show"] = "headings"
        databaseView["columns"] = ("site", "panels", "tevs")
        vsb.configure(command=databaseView.yview)
        # hsb.configure(command=databaseView.xview)
        vsb.grid(column=1, row=0, sticky="NS")
        # hsb.grid(column=0, row=1, sticky="WE")

        middleframe2.columnconfigure(0, weight=1)
        middleframe2.rowconfigure(0, weight=1)
        databaseView2["show"] = "headings"
        databaseView2["columns"] = ("num", "name", "component", "location", "phase", "db", "prpd", "pulse", "pd")
        vsb.configure(command=databaseView2.yview)
        # hsb.configure(command=databaseView.xview)
        vsb.grid(column=1, row=0, sticky="NS")

        transform_middle_frame.columnconfigure(0, weight=1)
        transform_middle_frame.rowconfigure(0, weight=1)
        transformView["show"] = "headings"
        transformView["columns"] = ("num", "name", "component", "location", "phase", "db", "prpd", "pulse", "pd")
        vsb.configure(command=transformView.yview)
        # hsb.configure(command=databaseView.xview)
        vsb.grid(column=1, row=0, sticky="NS")

        # Treeview column headings
        databaseView.heading("site", text="Site")
        databaseView.column("site", anchor='w', width=250)
        databaseView.heading("panels", text="Number of Panels")
        databaseView.column("panels", anchor='center', width=100)
        databaseView.heading("tevs", text="Number of TEVs")
        databaseView.column("tevs", anchor='center', width=100)

        # Treeview column headings festo
        databaseView2.heading("num", text="Panel")
        databaseView2.column("num", anchor='w', width=100)
        databaseView2.heading("name", text="Tev")
        databaseView2.column("name", anchor='center', width=150)
        databaseView2.heading("component", text="Component")
        databaseView2.column("component", anchor='center', width=150)
        databaseView2.heading("location", text="Sublocation")
        databaseView2.column("location", anchor='w', width=100)
        databaseView2.heading("phase", text="Phase Ref Lock")
        databaseView2.column("phase", anchor='center', width=100)
        databaseView2.heading("db", text="dB")
        databaseView2.column("db", anchor='center', width=100)
        databaseView2.heading("prpd", text="PRPD")
        databaseView2.column("prpd", anchor='w', width=100)
        databaseView2.heading("pulse", text="Pulse Wave")
        databaseView2.column("pulse", anchor='center', width=100)
        databaseView2.heading("pd", text="PD%")
        databaseView2.column("pd", anchor='center', width=100)

        # Treeview column headings transform
        transformView.heading("num", text="Panel")
        transformView.column("num", anchor='w', width=100)
        transformView.heading("name", text="Tev")
        transformView.column("name", anchor='center', width=150)
        transformView.heading("component", text="Component")
        transformView.column("component", anchor='center', width=150)
        transformView.heading("location", text="Sublocation")
        transformView.column("location", anchor='w', width=100)
        transformView.heading("phase", text="Phase Ref Lock")
        transformView.column("phase", anchor='center', width=100)
        transformView.heading("db", text="dB")
        transformView.column("db", anchor='center', width=100)
        transformView.heading("prpd", text="PRPD")
        transformView.column("prpd", anchor='w', width=100)
        transformView.heading("pulse", text="Pulse Wave")
        transformView.column("pulse", anchor='center', width=100)
        transformView.heading("pd", text="PD%")
        transformView.column("pd", anchor='center', width=100)

        # Widgets in Frame 3
        #label_checkstatus = tk.Label(frame_checkpd, text="Status", width=5, relief='flat').grid(column=2, row=0, padx=5, pady=5, sticky='E')
        #label_checkstatuscolour = tk.Label(frame_checkpd, text=" ", bg="limegreen", width=5, relief='flat').grid(column=2, row=1, padx=5, pady=5, sticky='E')

        findpd_btn = tk.Button(frame_checkpd, width=20, text="Find PDs", command=lambda: self.run_pd_model_exe(tmpdir, zip_filename))
        findpd_btn.grid(column=1, row=1, padx=5, pady=5, sticky='E')
        export_pdf_btn = tk.Button(frame_checkpd, width=20, text="Export to PDF",
                               command=lambda: self.export_to_pdf(tmpdir, zip_filename))
        export_pdf_btn.grid(column=2, row=1, padx=5, pady=5, sticky='E')

        file_counter = 0

        find_files_btn = tk.Button(frame_checkpd, width=20, text="Check Files", command=lambda: self.check_files(file_counter, find_files_btn))
        find_files_btn.grid(column=3, row=1, padx=5, pady=5, sticky='NSEW')

        print(file_counter)

        file_counter = 0

        #selectzip_button.grid(column=1, row=3, padx=5, pady=3, ipady=3, sticky='SW')

    def check_files(self, counter, btn):

        # folder path
        dir_path = r'C:\Users\Documents\GUI\input_folder'
        count = 0
        # Iterate directory
        for path in os.listdir(dir_path):
        # check if current path is a file
            if os.path.isfile(os.path.join(dir_path, path)):
                count += 1
        print('File count:', count)
        return count
```

Body:
Currently I have one window that displays two Treeview frames(festo and transformer) that of identical layout. These treeview layout should display different user data from txt files. Hence, the no of Treeview windows are dynamic based on the no txt files in a folder. Is it possible to create/generate multiple pop-up Treeview windows of the same layout upon a button click?

class HomePage(Tk):
    def __init__(self, *args, **kwargs):
        Tk.__init__(self, *args, **kwargs)
        self.notebook = ttk.Notebook()  # Create a notebook widget
        self.add_tab1()
        #self.add_tab2()
        self.notebook.grid(row=0)
        self.notebook.pack(expand=1, fill="both")

    def add_tab1(self):
        tab1 = tab_one(self.notebook)
        self.notebook.add(tab1, text="Home")

    def add_tab2(self):
        tab2 = ttk.Notebook()
        self.notebook.add(tab2, text="Reports")

class data_table(object):
    def __init__(self, site, panels_count, tev_count):
        self.site = site
        self.panels_count = panels_count
        self.tev_count = tev_count

class tab_one(Frame):
    def __init__(self, *args, **kwargs):
        Frame.__init__(self, *args, **kwargs)
        # Creating frames on the window/canvas for the first tab
        frame_selectfile = tk.LabelFrame(self, text="Step 1: Zip File Extraction ", bd=6)  # Frame1 on the window/canvas
        frame_selectfile.grid(column=0, row=0, padx=10, pady=10, sticky='NSEW')  # Positioning frame1
        frame_selectfile.configure(borderwidth=1)
        self.grid_columnconfigure(0, weight=1)  # Configuring the column for the main window/canvas
        self.grid_rowconfigure(0, weight=1)  # Configuring the row for the main window/canvas

        frame_checkpd = tk.LabelFrame(self, text="Step 2: Check PD ", bd=6)  # Frame2 on the window/canvas
        frame_checkpd.grid(column=1, row=0, padx=10, pady=10, sticky='NSEW')  # Positioning frame2
        frame_checkpd.configure(borderwidth=1)
        self.grid_columnconfigure(1, weight=1)  # Configuring the column for the main window/canvas
        self.grid_rowconfigure(1, weight=1)  # Configuring the row for the main window/canvas

        frame_festo = tk.LabelFrame(self, text="Festo: ", bd=6)  # Frame1 on the window/canvas
        frame_festo.grid(column=0, row=1, padx=10, pady=10, sticky='NSEW')  # Positioning frame1
        frame_festo.configure(borderwidth=1)
        self.grid_columnconfigure(1, weight=1)  # Configuring the column for the main window/canvas
        self.grid_rowconfigure(1, weight=1)  # Configuring the row for the main window/canvas

        frame_transform = tk.LabelFrame(self, text="Transformer: ", bd=6)  # Frame1 on the window/canvas
        frame_transform.grid(column=1, row=1, padx=10, pady=10, sticky='NSEW')  # Positioning frame1
        frame_transform.configure(borderwidth=1)
        self.grid_columnconfigure(1, weight=1)  # Configuring the column for the main window/canvas
        self.grid_rowconfigure(1, weight=1)  # Configuring the row for the main window/canvas

        # Initializing all variables in frame_selectfile
        file_ID = tk.StringVar()
        file_ID2 = tk.StringVar()
        location_id = tk.StringVar()
        location_id2 = tk.StringVar()
        unzip_status = tk.StringVar()
        tmpdir = tempfile.TemporaryDirectory().name
        #self.create_dir_ifnot_exist(tmpdir)
        zip_filename = tk.StringVar()
        site_id = tk.StringVar()
        site_id.set("0")
        data_table_list = []
        file_counter = tk.StringVar()

        # Initializing all variables in frame_festo
        festo_date_id = tk.StringVar()
        festo_job_id = tk.StringVar()
        festo_engineer_id = tk.StringVar()
        festo_station_id = tk.StringVar()
        festo_voltage_id = tk.StringVar()
        festo_db_id = tk.StringVar()
        festo_pd_id = tk.StringVar()

        # Initializing all variables in frame_transform
        transform_date_id = tk.StringVar()
        transform_job_id = tk.StringVar()
        transform_engineer_id = tk.StringVar()
        transform_station_id = tk.StringVar()
        transform_voltage_id = tk.StringVar()
        transform_db_id = tk.StringVar()
        transform_pd_id = tk.StringVar()

        topframe = tk.LabelFrame(frame_festo, bd=0)

        topframe_transform = tk.LabelFrame(frame_transform, bd=0)

        middleframe = tk.LabelFrame(frame_selectfile, bd=5)

        databaseView = ttk.Treeview(middleframe, selectmode="browse")

        #label_filename = tk.Label(frame_selectfile, text=" ", width=10, relief='flat').grid(column=0, row=1, padx=5, pady=5, sticky='NW')
        label_filelocation = tk.Label(frame_selectfile, text="File Location:", width=12, relief='flat').grid(column=0, row=0, padx=5, pady=5, sticky='NW')

        filename_Entry = tk.Label(frame_selectfile, width=52, textvariable=file_ID)
        filename_Entry.grid(column=1, row=0, padx=5, pady=5, sticky='NW')
        filename_Entry.configure(state='normal')

        filelocation_Entry = tk.Entry(frame_selectfile, width=60, textvariable=location_id)
        filelocation_Entry.grid(column=1, row=0, padx=5, pady=5, sticky='W')
        filelocation_Entry.configure(background='palegreen', foreground='black')

        middleframe2 = tk.LabelFrame(frame_festo, bd=5)
        databaseView2 = ttk.Treeview(middleframe2, selectmode="browse")

        transform_middle_frame = tk.LabelFrame(frame_transform, bd=5)

        transformView = ttk.Treeview(transform_middle_frame, selectmode="browse")
        #label_filename2 = tk.Label(topframe, text=" ", width=10, relief='flat').grid(column=0, row=1, padx=5, pady=5, sticky='NW')

        #label_filelocation2 = tk.Label(topframe, text="File Location:", width=12, relief='flat').grid(column=0, row=2, padx=5, pady=5, sticky='NW')

        label_festo_date_id = tk.Label(topframe, text="Scanned Date:", width=12, relief='flat').grid(column=0, row=0, padx=5, pady=5, sticky='NW')
        label_festo_job_id = tk.Label(topframe, text="Job No:", width=12, relief='flat').grid(column=2, row=0, padx=5, pady=5, sticky='NW')
        label_festo_engineer_id = tk.Label(topframe, text="Engineer:", width=12, relief='flat').grid(column=4, row=0, padx=5, pady=5, sticky='NW')
        label_festo_station_id = tk.Label(topframe, text="Station:", width=12, relief='flat').grid(column=0, row=1, padx=5, pady=5, sticky='W')
        label_festo_voltage_id = tk.Label(topframe, text="Operating Voltage(kV):", width=18, relief='flat').grid(column=2, row=1, padx=5, pady=5, sticky='NW')
        label_festo_db_id = tk.Label(topframe, text="Max dB:", width=12, relief='flat').grid(column=4, row=1, padx=5, pady=5, sticky='NW')
        #label_festo_pd_id = tk.Label(topframe, text="Max PD:", width=12, relief='flat').grid(column=0, row=2, padx=5, pady=5, sticky='NW')

        festo_date_id_Entry = tk.Entry(topframe, width=15, textvariable=festo_date_id)
        festo_date_id_Entry.grid(column=1, row=0, padx=5, pady=5, sticky='NW')
        festo_date_id_Entry.configure(state='normal')

        festo_job_id_Entry = tk.Entry(topframe, width=15, textvariable=festo_job_id)
        festo_job_id_Entry.grid(column=3, row=0, padx=5, pady=5, sticky='NW')
        festo_job_id_Entry.configure(state='normal')

        festo_engineer_id_Entry = tk.Entry(topframe, width=15, textvariable=festo_engineer_id)
        festo_engineer_id_Entry.grid(column=5, row=0, padx=5, pady=5, sticky='NW')
        festo_engineer_id_Entry.configure(state='normal')

        festo_station_id_Entry = tk.Entry(topframe, width=15, textvariable=festo_station_id)
        festo_station_id_Entry.grid(column=1, row=1, padx=5, pady=5, sticky='NW')
        festo_station_id_Entry.configure(state='normal')

        festo_voltage_id_Entry = tk.Entry(topframe, width=15, textvariable=festo_voltage_id)
        festo_voltage_id_Entry.grid(column=3, row=1, padx=5, pady=5, sticky='NW')
        festo_voltage_id_Entry.configure(state='normal')

        festo_db_id_Entry = tk.Entry(topframe, width=15, textvariable=festo_db_id)
        festo_db_id_Entry.grid(column=5, row=1, padx=5, pady=5, sticky='NW')
        festo_db_id_Entry.configure(state='normal')

        label_transform_date_id = tk.Label(topframe_transform, text="Scanned Date:", width=12, relief='flat').grid(column=0, row=0, padx=5, pady=5, sticky='NW')
        label_transform_job_id = tk.Label(topframe_transform, text="Job No:", width=12, relief='flat').grid(column=2, row=0, padx=5, pady=5, sticky='NW')
        label_transform_engineer_id = tk.Label(topframe_transform, text="Engineer:", width=12, relief='flat').grid(column=4, row=0, padx=5, pady=5, sticky='NW')
        label_transform_station_id = tk.Label(topframe_transform, text="Station:", width=12, relief='flat').grid(column=0, row=1, padx=5, pady=5, sticky='NW')
        label_transform_voltage_id = tk.Label(topframe_transform, text="Operating Voltage(kV):", width=18, relief='flat').grid(column=2, row=1, padx=5, pady=5, sticky='NW')
        label_transform_db_id = tk.Label(topframe_transform, text="Max dB:", width=12, relief='flat').grid(column=4, row=1, padx=5, pady=5, sticky='NW')
        #label_transform_pd_id = tk.Label(topframe, text="Max PD:", width=12, relief='flat').grid(column=0, row=2, padx=5, pady=5, sticky='NW')

        transform_date_id_Entry = tk.Entry(topframe_transform, width=15, textvariable=transform_date_id)
        transform_date_id_Entry.grid(column=1, row=0, padx=5, pady=5, sticky='NW')
        transform_date_id_Entry.configure(state='normal')

        transform_job_id_Entry = tk.Entry(topframe_transform, width=15, textvariable=transform_job_id)
        transform_job_id_Entry.grid(column=3, row=0, padx=5, pady=5, sticky='NW')
        transform_job_id_Entry.configure(state='normal')

        transform_engineer_id_Entry = tk.Entry(topframe_transform, width=15, textvariable=transform_engineer_id)
        transform_engineer_id_Entry.grid(column=5, row=0, padx=5, pady=5, sticky='NW')
        transform_engineer_id_Entry.configure(state='normal')

        transform_station_id_Entry = tk.Entry(topframe_transform, width=15, textvariable=transform_station_id)
        transform_station_id_Entry.grid(column=1, row=1, padx=5, pady=5, sticky='NW')
        transform_station_id_Entry.configure(state='normal')

        transform_voltage_id_Entry = tk.Entry(topframe_transform, width=15, textvariable=transform_voltage_id)
        transform_voltage_id_Entry.grid(column=3, row=1, padx=5, pady=5, sticky='NW')
        transform_voltage_id_Entry.configure(state='normal')

        transform_db_id_Entry = tk.Entry(topframe_transform, width=15, textvariable=transform_db_id)
        transform_db_id_Entry.grid(column=5, row=1, padx=5, pady=5, sticky='NW')
        transform_db_id_Entry.configure(state='normal')

        unzip_status.set("")
        label_unzipstatus = tk.Label(frame_selectfile, width=20, relief='flat', textvariable=unzip_status)
        label_unzipstatus.grid(column=1, row=5, padx=5, pady=5, sticky='NSEW')

        selectzip_button = tk.Button(frame_selectfile, width=20, text="Select Zip File", command=lambda: self.upload_action(location_id, zip_filename, tmpdir))
        selectzip_button.grid(column=1, row=3, padx=5, pady=3, ipady=3, sticky='SW')

        unzip_button = tk.Button(frame_selectfile, width=20, text="Extract", command=lambda: self.extract_nested_zip(databaseView, data_table_list, location_id.get(), tmpdir, zip_filename, site_id, False))
        unzip_button.grid(column=1, row=3, padx=5, pady=3, ipady=3, sticky='NE')

        # Creating LabelFrame in frame_unzip
        upperframe = tk.LabelFrame(frame_selectfile, bd=0)
        frame_selectfile.rowconfigure(0, weight=1)
        frame_selectfile.columnconfigure(2, weight=1)
        upperframe.grid(column=0, row=6, columnspan=2, sticky='W')

        # middleframe = tk.LabelFrame(frame_selectfile, bd=5)
        middleframe.configure(borderwidth=1)
        frame_selectfile.columnconfigure(2, weight=1)
        frame_selectfile.rowconfigure(1, weight=1)
        middleframe.grid(column=0, row=7, columnspan=2, sticky="NSEW")

        middleframe2.configure(borderwidth=1)
        frame_festo.columnconfigure(2, weight=1)
        frame_festo.rowconfigure(1, weight=1)
        middleframe2.grid(column=0, row=1, columnspan=2, sticky="NSEW")

        transform_middle_frame.configure(borderwidth=1)
        frame_transform.columnconfigure(2, weight=1)
        frame_transform.rowconfigure(1, weight=1)
        transform_middle_frame.grid(column=0, row=1, columnspan=2, sticky="NSEW")

#         lowerframe = tk.LabelFrame(frame_selectfile, bd=0)
#         lowerframe.grid(column=0, row=7)
#         frame_selectfile.columnconfigure(2, weight=1)
#         frame_selectfile.rowconfigure(2, weight=0)

        topframe.configure(borderwidth=1)
        frame_festo.columnconfigure(2, weight=1)
        frame_festo.rowconfigure(1, weight=1)
        topframe.grid(column=0, row=0, columnspan=2, sticky="NSEW")

        topframe_transform.configure(borderwidth=1)
        frame_transform.columnconfigure(2, weight=1)
        frame_transform.rowconfigure(1, weight=1)
        topframe_transform.grid(column=0, row=0, columnspan=2, sticky="NSEW")

        # Labels in frame_unzip
        label18 = tk.Label(upperframe, text="Number of sites:", relief='flat')
        label18.grid(column=0, row=0, padx=5, pady=5, sticky='W')

        site_Entry = tk.Entry(upperframe, width=45, textvariable=site_id)
        site_Entry.grid(column=1, row=0, padx=10, pady=5, sticky='E')
        site_Entry.configure(state='normal', background='palegreen', foreground='black')

        # Button Widgets in frame_unzip
        #unzip_btn = tk.Button(upperframe, width=10, text="Unzip File", command=lambda: Unzip(databaseview))
        #unzip_btn.grid(column=2, row=0, padx=0, pady=5, ipady=2, sticky='E')

#         label_details = tk.Label(upperframe, text=" ", relief='flat')
#         label_details.grid(column=0, row=2, padx=5, pady=0, sticky='W')
        # Combobox Widgets in frame_unzip

        # initializing treeview in frame_unzip
        # databaseView = ttk.Treeview(middleframe, selectmode="browse")
        databaseView.columnconfigure(2, weight=1)
        databaseView.grid(column=0, row=0, columnspan=2, sticky="NSEW")

        databaseView2.columnconfigure(2, weight=1)
        databaseView2.grid(column=0, row=0, columnspan=2, sticky="NSEW")

        transformView.columnconfigure(2, weight=1)
        transformView.grid(column=0, row=0, columnspan=2, sticky="NSEW")

        # Creating treeview in frame_unzip
        vsb = Scrollbar(middleframe, orient="vertical", command=databaseView.yview())
        hsb = Scrollbar(middleframe, orient="horizontal")

        vsb = Scrollbar(middleframe2, orient="vertical", command=databaseView2.yview())
        hsb = Scrollbar(middleframe2, orient="horizontal")

        vsb = Scrollbar(transform_middle_frame, orient="vertical", command=transformView.yview())
        hsb = Scrollbar(transform_middle_frame, orient="horizontal")

        middleframe.columnconfigure(0, weight=1)
        middleframe.rowconfigure(0, weight=1)
        databaseView["show"] = "headings"
        databaseView["columns"] = ("site", "panels", "tevs")
        vsb.configure(command=databaseView.yview)
        # hsb.configure(command=databaseView.xview)
        vsb.grid(column=1, row=0, sticky="NS")
        # hsb.grid(column=0, row=1, sticky="WE")

        middleframe2.columnconfigure(0, weight=1)
        middleframe2.rowconfigure(0, weight=1)
        databaseView2["show"] = "headings"
        databaseView2["columns"] = ("num", "name", "component", "location", "phase", "db", "prpd", "pulse", "pd")
        vsb.configure(command=databaseView2.yview)
        # hsb.configure(command=databaseView.xview)
        vsb.grid(column=1, row=0, sticky="NS")

        transform_middle_frame.columnconfigure(0, weight=1)
        transform_middle_frame.rowconfigure(0, weight=1)
        transformView["show"] = "headings"
        transformView["columns"] = ("num", "name", "component", "location", "phase", "db", "prpd", "pulse", "pd")
        vsb.configure(command=transformView.yview)
        # hsb.configure(command=databaseView.xview)
        vsb.grid(column=1, row=0, sticky="NS")

        # Treeview column headings
        databaseView.heading("site", text="Site")
        databaseView.column("site", anchor='w', width=250)
        databaseView.heading("panels", text="Number of Panels")
        databaseView.column("panels", anchor='center', width=100)
        databaseView.heading("tevs", text="Number of TEVs")
        databaseView.column("tevs", anchor='center', width=100)

        # Treeview column headings festo
        databaseView2.heading("num", text="Panel")
        databaseView2.column("num", anchor='w', width=100)
        databaseView2.heading("name", text="Tev")
        databaseView2.column("name", anchor='center', width=150)
        databaseView2.heading("component", text="Component")
        databaseView2.column("component", anchor='center', width=150)
        databaseView2.heading("location", text="Sublocation")
        databaseView2.column("location", anchor='w', width=100)
        databaseView2.heading("phase", text="Phase Ref Lock")
        databaseView2.column("phase", anchor='center', width=100)
        databaseView2.heading("db", text="dB")
        databaseView2.column("db", anchor='center', width=100)
        databaseView2.heading("prpd", text="PRPD")
        databaseView2.column("prpd", anchor='w', width=100)
        databaseView2.heading("pulse", text="Pulse Wave")
        databaseView2.column("pulse", anchor='center', width=100)
        databaseView2.heading("pd", text="PD%")
        databaseView2.column("pd", anchor='center', width=100)

        # Treeview column headings transform
        transformView.heading("num", text="Panel")
        transformView.column("num", anchor='w', width=100)
        transformView.heading("name", text="Tev")
        transformView.column("name", anchor='center', width=150)
        transformView.heading("component", text="Component")
        transformView.column("component", anchor='center', width=150)
        transformView.heading("location", text="Sublocation")
        transformView.column("location", anchor='w', width=100)
        transformView.heading("phase", text="Phase Ref Lock")
        transformView.column("phase", anchor='center', width=100)
        transformView.heading("db", text="dB")
        transformView.column("db", anchor='center', width=100)
        transformView.heading("prpd", text="PRPD")
        transformView.column("prpd", anchor='w', width=100)
        transformView.heading("pulse", text="Pulse Wave")
        transformView.column("pulse", anchor='center', width=100)
        transformView.heading("pd", text="PD%")
        transformView.column("pd", anchor='center', width=100)

        # Widgets in Frame 3
        #label_checkstatus = tk.Label(frame_checkpd, text="Status", width=5, relief='flat').grid(column=2, row=0, padx=5, pady=5, sticky='E')
        #label_checkstatuscolour = tk.Label(frame_checkpd, text=" ", bg="limegreen", width=5, relief='flat').grid(column=2, row=1, padx=5, pady=5, sticky='E')

        findpd_btn = tk.Button(frame_checkpd, width=20, text="Find PDs", command=lambda: self.run_pd_model_exe(tmpdir, zip_filename))
        findpd_btn.grid(column=1, row=1, padx=5, pady=5, sticky='E')
        export_pdf_btn = tk.Button(frame_checkpd, width=20, text="Export to PDF",
                               command=lambda: self.export_to_pdf(tmpdir, zip_filename))
        export_pdf_btn.grid(column=2, row=1, padx=5, pady=5, sticky='E')

        file_counter = 0

        find_files_btn = tk.Button(frame_checkpd, width=20, text="Check Files", command=lambda: self.check_files(file_counter, find_files_btn))
        find_files_btn.grid(column=3, row=1, padx=5, pady=5, sticky='NSEW')

        print(file_counter)

        file_counter = 0

        #selectzip_button.grid(column=1, row=3, padx=5, pady=3, ipady=3, sticky='SW')

    def check_files(self, counter, btn):

        # folder path
        dir_path = r'C:\Users\Documents\GUI\input_folder'
        count = 0
        # Iterate directory
        for path in os.listdir(dir_path):
        # check if current path is a file
            if os.path.isfile(os.path.join(dir_path, path)):
                count += 1
        print('File count:', count)
        return count


问:
Installing dependencies of rasa framework & tenserflow version mismatch. installing tenserflow--2.3.4 & rasa==2.4.3 & python==3.7.9 on linux(ubuntu)
I a deploying the Rasa chatbot on Linux(Ubuntu==20.04) while Installing dependencies of the rasa framework & TensorFlow version mismatch. installing TensorFlow--2.3.4 & rasa==2.4.3 & python==3.7.9 on Linux(ubuntu)

I have tried with a different version of python(3.6.9,3.7.9,3.8.5) & also tried to download TensorFlow in anaconda3.i have also tried with different lts of ubuntu(16.04lts,18.04lts,20.04).


问:
Array is duplicated on every refresh using ExpressJS and NodeJS
I have been trying to send the var logtraceArr = []; value to the browser using Expressjs but one first call empty array is displayed on 2nd call array is filled with first called function and on 3rd call array is appended with the same element.

I want the content to be displayed on the first.

```<code>var express = require("express");
var router = express.Router();
const fs = require("fs");
const path = require("path");
const readline = require('readline');
const directoryPath = path.resolve(__dirname,"../logtrace-filestore/edepoze-logs");
var logtraceArr = [];
router.get("/",function(req,res,next){
    const fetchFileContentParsed = async (fileContentObj) => {

        var logtraceObj = {
            Direction : '',
            FromServer: '',
            ToServer:''
          };
        var pipearray = fileContentObj.toString().split("|");
                for( i=0;i<pipearray.length;i++){
                    var Direction = new Array();
                    Direction = pipearray[5].split("::");
                    if (Direction.length == 2) {
                        logtraceObj.Direction = Direction[1];
                    } else {
                        logtraceObj.Direction = "";
                    }

                }
                logtraceArr.push(logtraceObj);

        return {
            logtraceArr
          }
    }
    // Iterates all users and returns their Github info.
    const getfileContent = async (files) => {
            const fileContent = files.map((file) => {
                const filePath = path.join(directoryPath,file);
                //console.log("filePath ----->",filePath);
                const readStream =  fs.createReadStream(filePath);
                const fileContent = readline.createInterface({
                input: readStream
                });
                fileContent.on('line', function(line) {
                    const regExp = /\[Event([^]+\])/g
                    var matchedContent;
                    if ((matchedContent = line.match(regExp)) != null){
                        return fetchFileContentParsed(matchedContent) // Async function that fetches the user info.
                    .then((a) => {return a })
                    }
                })
            })
            return Promise.all(fileContent) // Waiting for all the requests to get resolved.
    }
    function readFiles(dirname) {
        //console.log(dirname);
        fs.readdir(dirname, async function (err,filenames)
            getfileContent(filenames).then((a) => {return a })
        });
    }
    res.header("Access-Control-Allow-Origin", "*");
    res.contentType('application/json');
    //console.log(readFiles(directoryPath))
    readFiles(directoryPath,logtraceArr);
    res.send(logtraceArr);
});
module.exports = router;
</code>```

i want the content to be loaded and print the array only once on refresh of the page

Body:
I have been trying to send the var logtraceArr = []; value to the browser using Expressjs but one first call empty array is displayed on 2nd call array is filled with first called function and on 3rd call array is appended with the same element.

I want the content to be displayed on the first.

var express = require("express");
var router = express.Router();
const fs = require("fs");
const path = require("path");
const readline = require('readline');
const directoryPath = path.resolve(__dirname,"../logtrace-filestore/edepoze-logs");
var logtraceArr = [];
router.get("/",function(req,res,next){
    const fetchFileContentParsed = async (fileContentObj) => {

        var logtraceObj = {
            Direction : '',
            FromServer: '',
            ToServer:''
          };
        var pipearray = fileContentObj.toString().split("|");
                for( i=0;i<pipearray.length;i++){
                    var Direction = new Array();
                    Direction = pipearray[5].split("::");
                    if (Direction.length == 2) {
                        logtraceObj.Direction = Direction[1];
                    } else {
                        logtraceObj.Direction = "";
                    }

                }
                logtraceArr.push(logtraceObj);

        return {
            logtraceArr
          }
    }
    // Iterates all users and returns their Github info.
    const getfileContent = async (files) => {
            const fileContent = files.map((file) => {
                const filePath = path.join(directoryPath,file);
                //console.log("filePath ----->",filePath);
                const readStream =  fs.createReadStream(filePath);
                const fileContent = readline.createInterface({
                input: readStream
                });
                fileContent.on('line', function(line) {
                    const regExp = /\[Event([^]+\])/g
                    var matchedContent;
                    if ((matchedContent = line.match(regExp)) != null){
                        return fetchFileContentParsed(matchedContent) // Async function that fetches the user info.
                    .then((a) => {return a })
                    }
                })
            })
            return Promise.all(fileContent) // Waiting for all the requests to get resolved.
    }
    function readFiles(dirname) {
        //console.log(dirname);
        fs.readdir(dirname, async function (err,filenames)
            getfileContent(filenames).then((a) => {return a })
        });
    }
    res.header("Access-Control-Allow-Origin", "*");
    res.contentType('application/json');
    //console.log(readFiles(directoryPath))
    readFiles(directoryPath,logtraceArr);
    res.send(logtraceArr);
});
module.exports = router;

i want the content to be loaded and print the array only once on refresh of the page


问:
Open Street Maps (OSM) Adding and Updating Map Data in Android Apps
I am trying to create an Android App

for our field sales men to be able to Add and Updating Map Data using Android Apps to
Open Street Maps (OSM)

Can you kindly point me to the appropriate OSM Android Classes to be able to do the same

Thanks a lot in Advance

I am trying randomly with the OSM classes

I am relatively new and not able to figure it out from the online documentation


问:
Scaling images in html and scroll
Good afternoon. I have a large picture of 6000x3000px which I scale using scale(0.3). It is required that the image is scaled to a certain point, different each time.

I implemented first scaled, and then scrollTo scroll, but it looks crooked and the picture jumps. how can this be implemented easier and more correctly. React TS HTML CSS stack

```<code>
    useEffect(() => {
        const x = selectedSection?.dot?.position.x ? selectedSection?.dot.position.x - 1440 : 1430
        const y = selectedSection?.dot?.position.y ? selectedSection?.dot.position.y - 540 : 1820

        isZoom ? containerRef.current?.scrollTo(x, y) : containerRef.current?.scrollTo(0, 0)
    }, [isZoom, selectedSection])

</code>```

Title: Scaling images in html and scroll

Body:
Good afternoon. I have a large picture of 6000x3000px which I scale using scale(0.3). It is required that the image is scaled to a certain point, different each time.

I implemented first scaled, and then scrollTo scroll, but it looks crooked and the picture jumps. how can this be implemented easier and more correctly. React TS HTML CSS stack

    useEffect(() => {
        const x = selectedSection?.dot?.position.x ? selectedSection?.dot.position.x - 1440 : 1430
        const y = selectedSection?.dot?.position.y ? selectedSection?.dot.position.y - 540 : 1820

        isZoom ? containerRef.current?.scrollTo(x, y) : containerRef.current?.scrollTo(0, 0)
    }, [isZoom, selectedSection])


问:
Kendo UI dropdowns are taking a lot of time to load data in ASP.NET MVC
I am using Kendo UI with ASP.NET MVC. There are 6 dropdowns on the home page, taking a lot of time to load the data, nearly 45 seconds. Data is not large.

This is how all the dropdown are written:

```<code>@(Html.Kendo().ComboBoxFor(model => model.ProductId)
  .Name("GreenProduct")
  .DataTextField("Name")
  .DataValueField("ProductId")
  .AutoBind(false)
  .DataSource(datasource => datasource
  .Read(read => read
       .Action("GetProductForProject", "Product")
       .Data("hierarchy.filterProduct")
       .Type(HttpVerbs.Post)
        )
       .ServerFiltering(true)
        )
  .Filter(FilterType.Contains)
  .Suggest(false)
  .Delay(0)
  .HtmlAttributes(new { style = "width:100%" })
  )
</code>```

This is the loading screenshot:

I don't want to load data on dropdowns on page load and API's are also not calling on page load. I checked it by keeping breakpoint, but Process circle right side to the dropdowns keeps running. How can I fix this ?

Body:
I am using Kendo UI with ASP.NET MVC. There are 6 dropdowns on the home page, taking a lot of time to load the data, nearly 45 seconds. Data is not large.

This is how all the dropdown are written:

@(Html.Kendo().ComboBoxFor(model => model.ProductId)
  .Name("GreenProduct")
  .DataTextField("Name")
  .DataValueField("ProductId")
  .AutoBind(false)
  .DataSource(datasource => datasource
  .Read(read => read
       .Action("GetProductForProject", "Product")
       .Data("hierarchy.filterProduct")
       .Type(HttpVerbs.Post)
        )
       .ServerFiltering(true)
        )
  .Filter(FilterType.Contains)
  .Suggest(false)
  .Delay(0)
  .HtmlAttributes(new { style = "width:100%" })
  )

This is the loading screenshot:

I don't want to load data on dropdowns on page load and API's are also not calling on page load. I checked it by keeping breakpoint, but Process circle right side to the dropdowns keeps running. How can I fix this ?


问:
Bootstrap grid not filling parent height
I have a bootstrap grid that is the UI of a calculator, and it is nested in a div that is sized at 100vw and 100vh. I set the size properties of the bootstrap container to height: 50% and width: 20%, but the content is only filling the width I set, not the height.

I want the height of the grid to resize dynamically so that it is 50% of it's container always.

https://gyazo.com/940d7d3aa77c464e351970bdbd5271b7 (the black line is the border that I am wanting the grid to fill to)

`

```<code>return (
      <div
        style={{ width: "100vw", height: "100vh" }}
        class="d-flex align-items-center"
      >
        <div style={{ height: "50%", width: "20%"}} class="container">
          <div class="row">
            <div class="col col-6">
              <p>AC</p>
            </div>
            <div class=" col col-3">
              <p>/</p>
            </div>
            <div class="col col-3">
              <p>x</p>
            </div>
          </div>
          <div class="row">
            <div class="col">
              <p>7</p>
            </div>
            <div class="col">
              <p>8</p>
            </div>
            <div class="col">
              <p>9</p>
            </div>
            <div class="col">
              <p>-</p>
            </div>
          </div>
          <div class="row">
            <div class="col">
              <p>4</p>
            </div>
            <div class="col">
              <p>5</p>
            </div>
            <div class="col">
              <p>6</p>
            </div>
            <div class="col">
              <p>+</p>
            </div>
          </div>

          <div class="row">
            <div class="col col-9">
              <div class="row">
                <div class="col col-4">
                  <p>1</p>
                </div>

                <div class="col col-4">
                  <p>2</p>
                </div>

                <div class="col col-4">
                  <p>3</p>
                </div>

                <div class="col col-8">
                  <p>0</p>
                </div>

                <div class="col col-4">
                  <p>.</p>
                </div>
              </div>
            </div>

            <div class="col col-3">
              <p>=</p>
            </div>
          </div>
        </div>
      </div>
    );
  }
}
</code>```

`

Body:
I have a bootstrap grid that is the UI of a calculator, and it is nested in a div that is sized at 100vw and 100vh. I set the size properties of the bootstrap container to height: 50% and width: 20%, but the content is only filling the width I set, not the height.

I want the height of the grid to resize dynamically so that it is 50% of it's container always.

https://gyazo.com/940d7d3aa77c464e351970bdbd5271b7 (the black line is the border that I am wanting the grid to fill to)

`

return (

AC

/

x

7

8

9

-

4

5

6

+

1

2

3

0

.

=

    );
  }
}

`


问:
PostgreSQL crashing repeatedly
My PostgreSQL DB crashing repeatedly for running only 5-10 min. and below log prints:

```<code>LOG:  database system was shut down at 2022-12-12 09:40:32 PKT
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
LOG:  server process (PID 10780) exited with exit code 255
LOG:  terminating any other active server processes
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
LOG:  all server processes terminated; reinitializing
FATAL:  pre-existing shared memory block is still in use
HINT:  Check if there are any old server processes still running, and terminate them.
</code>```

Tried to restart the JasperreportsPostgreSQL service but it only run for 5-10 min.

Title: PostgreSQL crashing repeatedly

Body:
My PostgreSQL DB crashing repeatedly for running only 5-10 min. and below log prints:

LOG:  database system was shut down at 2022-12-12 09:40:32 PKT
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started
LOG:  server process (PID 10780) exited with exit code 255
LOG:  terminating any other active server processes
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
LOG:  all server processes terminated; reinitializing
FATAL:  pre-existing shared memory block is still in use
HINT:  Check if there are any old server processes still running, and terminate them.

Tried to restart the JasperreportsPostgreSQL service but it only run for 5-10 min.