问:
How to get acf custom text fields from my WooCommerce product tag terms?
I am unable to get the acf text field to display in the woocommerce "Product Tag" admin dashboard.

I have tried the following code, along with many other different variations of looping through the products, retrieving their tags and returning the acf text field but no values are appearing in the columns.

The goal is to customize the Product Tag Admin Dashboard to display the acf text field term. I was able to achieve getting these text field terms in a different portion of code when I created a customize side bar that sections tags by categories that are different from the product categories. I tried that same code for the columns but that isn't working either.

```<code>add_filter( 'manage_edit-product_tag_columns', 'tag_category_column_admin', 9999 );
function tag_category_column_admin( $columns ){
  $columns['tag_category'] = 'Tag Category';
  return $columns;
}
add_action('manage_product_tag_custom_column', 'tag_category_column_admin_content', 10, 2);

 function tag_category_column_admin_content($column,$product_id){
  $product_tag_terms = wp_get_post_terms($product_id, 'product_tag');
  foreach($product_tag_terms as $term){
    $category_id = get_field('tag_category' , $term, true);
    return $category_id;
  }
  if($column == 'tag_category'){
    echo $category_id;
 }
}
</code>```

I have looked everywhere and cannot seem to find a solution to my problem. Please help!

Body:
I am unable to get the acf text field to display in the woocommerce "Product Tag" admin dashboard.

I have tried the following code, along with many other different variations of looping through the products, retrieving their tags and returning the acf text field but no values are appearing in the columns.

The goal is to customize the Product Tag Admin Dashboard to display the acf text field term. I was able to achieve getting these text field terms in a different portion of code when I created a customize side bar that sections tags by categories that are different from the product categories. I tried that same code for the columns but that isn't working either.

add_filter( 'manage_edit-product_tag_columns', 'tag_category_column_admin', 9999 );
function tag_category_column_admin( $columns ){
  $columns['tag_category'] = 'Tag Category';
  return $columns;
}
add_action('manage_product_tag_custom_column', 'tag_category_column_admin_content', 10, 2);

 function tag_category_column_admin_content($column,$product_id){
  $product_tag_terms = wp_get_post_terms($product_id, 'product_tag');
  foreach($product_tag_terms as $term){
    $category_id = get_field('tag_category' , $term, true);
    return $category_id;
  }
  if($column == 'tag_category'){
    echo $category_id;
 }
}

I have looked everywhere and cannot seem to find a solution to my problem. Please help!


来源: stackexchange

问:
How to solve CSRF verification faileld?
Request aborted.
Help

Reason given for failure:

Origin checking failed - https://teamsparrowpp-qrgen-production 6a43.up.railway.app does not match any trusted origins.

I have <form method="POST">{% csrf_token %} on my html.
I have tried adding on settings

```<code>CSRF_TRUSTED_ORIGINS = ['https://teamsparrowpp-qrgen-production-6a43.up.railway.app']
</code>```

But it's not working.

ContentLicense: CC BY-SA 4.0

Title: How to solve CSRF verification faileld?

Body:
Request aborted.
Help

Reason given for failure:

Origin checking failed - https://teamsparrowpp-qrgen-production 6a43.up.railway.app does not match any trusted origins.

I have <form method="POST">{% csrf_token %} on my html.
I have tried adding on settings

CSRF_TRUSTED_ORIGINS = ['https://teamsparrowpp-qrgen-production-6a43.up.railway.app']

But it's not working.


问:
Why won't my anaconda or command prompt open?
I followed this answer: https://stackoverflow.com/a/58211115/20736561

Now that I have done this, I cannot open my command prompt or anaconda prompt. When I try to open it, it will flash for half a second on the screen, and then close. Does anyone know how to fix this?

I have tried to fix it by using:

```<code>conda init --reverse
</code>```

However, this did not solve the problem.

Body:
I followed this answer: https://stackoverflow.com/a/58211115/20736561

Now that I have done this, I cannot open my command prompt or anaconda prompt. When I try to open it, it will flash for half a second on the screen, and then close. Does anyone know how to fix this?

I have tried to fix it by using:

conda init --reverse

However, this did not solve the problem.


问:
Is it possible to pass arguments to setup.py while creating own .whl file?
I often update my own libs using in my projects and i want to automate it so i wrote a script which calls command which builds a .whl lib by os.system and setup.py module gets build params by sys.argv but it returns as response:

```<code>invalid command name '1.0.9'
</code>```

command i call: python ./LoggerLib/setup.py bdist_wheel 1.0.9

sys.argv: ['./LoggerLib/setup.py', 'bdist_wheel', '1.0.9']

The only way i know at this moment is to write the data to other file and read it in setup.py but it isn't elegant.

Do you know how to do it in another way?

Body:
I often update my own libs using in my projects and i want to automate it so i wrote a script which calls command which builds a .whl lib by os.system and setup.py module gets build params by sys.argv but it returns as response:

invalid command name '1.0.9'

command i call: python ./LoggerLib/setup.py bdist_wheel 1.0.9

sys.argv: ['./LoggerLib/setup.py', 'bdist_wheel', '1.0.9']

The only way i know at this moment is to write the data to other file and read it in setup.py but it isn't elegant.

Do you know how to do it in another way?


问:
Custom Shopify "Close Preview" button
I'm wondering if there is a way to create a custom "Close Preview" button as seen when previewing a theme (image example below):

I tried looking around the Liquid documentation but can't seem to find anything

Title: Custom Shopify "Close Preview" button


问:
how to fix unable to get Charset 'cp720' for property 'sun.stdout.encoding', using default windows-1256 and continuing.?
the command line is always showing me this problem when I am trying to start spark. I tried to run it from Jupiter notebook and from command line. it gives the same problem.

```<code>Unable to get Charset 'cp720' for property 'sun.stdout.encoding', using default windows-1256 and continuing.
WARN NativeCodeLoader: Unable to load native-hadoop library for your platform.
ERROR SparkContext: Error initializing SparkContext.
</code>```

this is the error

Body:
the command line is always showing me this problem when I am trying to start spark. I tried to run it from Jupiter notebook and from command line. it gives the same problem.

Unable to get Charset 'cp720' for property 'sun.stdout.encoding', using default windows-1256 and continuing.
WARN NativeCodeLoader: Unable to load native-hadoop library for your platform.
ERROR SparkContext: Error initializing SparkContext.

this is the error


问:
How does snowflake route notifications to pipes knowing they share the same SQS queue?
When I run

```<code>SHOW PIPES
</code>```

I can see that all the snowpipes have the same notification_channel value. I'm using SQS to send event notifications to snowpipes, with filters on the file path.

But, even if all the snowpipes have the same notification_channel as I've mentionned above (which is basically the SQS quee ARN) and are using the same stage, every SNOWPIPE loads only the relevant files. I wonder how each SNOWPIPE ignore the notifications which are not addressed to it?

I'm asking because I'm working on moving SNOWPIPES from one schema to another (along with the tables), so wanted to understand if I create a SNOWPIPE and give the same value for notification channel, will it receive the right notifications?

Body:
When I run

SHOW PIPES

I can see that all the snowpipes have the same notification_channel value. I'm using SQS to send event notifications to snowpipes, with filters on the file path.

But, even if all the snowpipes have the same notification_channel as I've mentionned above (which is basically the SQS quee ARN) and are using the same stage, every SNOWPIPE loads only the relevant files. I wonder how each SNOWPIPE ignore the notifications which are not addressed to it?

I'm asking because I'm working on moving SNOWPIPES from one schema to another (along with the tables), so wanted to understand if I create a SNOWPIPE and give the same value for notification channel, will it receive the right notifications?


问:
How open a link in a PDF in flutter application?
I am using the PDFx package to display PDFs on flutter application. However, the links embedded in this PDF are not clickable.

How is it possible to make these links clickable an open it in external navigator ?


问:
Entity Framework 6 to add one-to-one association between a SalesOrder.CustomerID and Customer.Id
To everyone,

I'm trying to instantiate a SalesOrder Customer object so I can add the Customer's DisplayName to the SalesOrder.

I have this code in the SalesOrder class:

```<code>using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

#nullable disable

namespace DataLayer
{
    public partial class SalesOrder
    {
        public SalesOrder()
        {
            this.SalesOrderLineItems = new HashSet<SalesOrderLineItem>();

            //this.Customer = new Customer().;

        }

        public Guid Id { get; set; }
        public DateTime Date { get; set; }
        public Guid CustomerID { get; set; }
        public virtual ICollection<SalesOrderLineItem> SalesOrderLineItems { get; set; }
        public virtual Customer Customer { get; set; }
    }
}
</code>```

The SalesOrder does retrieve the SalesOrderLineItems. However, everything I try to fill  the instance of the Customer fails. I have the CustomerID FK on the SalesOrder object. I'm trying to use that PK/FK reference to the Customer row to bring in the instance of the customer which will allow me to reach the cust.DisplayName property. Just as I have with the SalesOrder.SalesOrderLineItems I want the Customer object to be properly attached to the SalesOrder object.

Here is the table structure which is normal PK/FK configuration between SalesOrder.CustomerID FK and Customer.Id PK.

Here is the code in the API controller that loads the SalesOrderLineItems to the SalesOrder object. This is all working perfectly...I think.

```<code>        public JsonResult GetSalesOrderByID(Guid salesorderid)
        {
            {

                var context = db.Set<SalesOrder>();
                SalesOrder sorder = context.First(s => s.Id == salesorderid);
                context.Entry(sorder).Collection(l => l.SalesOrderLineItems).Load();

                return new JsonResult(sorder);
            }
        }
</code>```
```<code>USE [Backend]
GO

/****** Object:  Table [dbo].[**SalesOrder**]    Script Date: 12/16/2022 9:20:54 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[SalesOrder](
    [ID] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
    [Date] [datetime] NOT NULL,
    [CustomerID] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_SalesOrder] PRIMARY KEY CLUSTERED
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[SalesOrder] ADD  CONSTRAINT [DF_SalesOrder_ID]  DEFAULT (newid()) FOR [ID]
GO

ALTER TABLE [dbo].[SalesOrder]  WITH CHECK ADD  CONSTRAINT [FK_SalesOrder_Customer] FOREIGN KEY([CustomerID])
REFERENCES [dbo].[Customer] ([ID])
GO

ALTER TABLE [dbo].[SalesOrder] CHECK CONSTRAINT [FK_SalesOrder_Customer]
GO
</code>```
```<code>USE [Backend]
GO

/****** Object:  Table [dbo].[Customer]    Script Date: 12/16/2022 9:29:17 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Customer](
    [ID] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
    [DisplayName] [nvarchar](max) NOT NULL,
    [FirstName] [nvarchar](50) NOT NULL,
    [LastName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[Customer] ADD  CONSTRAINT [DF_Customer_ID]  DEFAULT (newid()) FOR [ID]
GO
</code>```

Here is the JSON response as of now:

```<code>{
   "id": "fea1996f-7569-4556-971c-ecb125a53b53",
   "date": "2022-10-30T00:00:00",
   "customerID": "23a85521-d834-47b9-be0a-2d34fde6c2dc",
   "salesOrderLineItems":    [
            {
         "id": "7ca18a2d-1c3c-4ab6-a583-aafe3342f3d2",
         "salesOrderID": "fea1996f-7569-4556-971c-ecb125a53b53",
         "productID": "a8ee410e-aba3-45dc-aec3-5be389d98f96",
         "productDisplayName": "Acme Soap",
         "quantity": 30,
         "price": 200
      },
            {
         "id": "286997cc-b552-44fd-b7dc-fb60cfe88b61",
         "salesOrderID": "fea1996f-7569-4556-971c-ecb125a53b53",
         "productID": "0c56a53a-25c2-4ebf-a859-591edefb2657",
         "productDisplayName": "Central Widget",
         "quantity": 200,
         "price": 1.05
      }
   ],
   "customer": null
}
</code>```

The ideal response would be:

```<code>{
   "id": "fea1996f-7569-4556-971c-ecb125a53b53",
   "date": "2022-10-30T00:00:00",
   "customerID": "23a85521-d834-47b9-be0a-2d34fde6c2dc",
   "CustomerDisplayName": "Jack Doe",
   "salesOrderLineItems":    [
            {
         "id": "7ca18a2d-1c3c-4ab6-a583-aafe3342f3d2",
         "salesOrderID": "fea1996f-7569-4556-971c-ecb125a53b53",
         "productID": "a8ee410e-aba3-45dc-aec3-5be389d98f96",
         "productDisplayName": "Acme Soap",
         "quantity": 30,
         "price": 200
      },
            {
         "id": "286997cc-b552-44fd-b7dc-fb60cfe88b61",
         "salesOrderID": "fea1996f-7569-4556-971c-ecb125a53b53",
         "productID": "0c56a53a-25c2-4ebf-a859-591edefb2657",
         "productDisplayName": "Central Widget",
         "quantity": 200,
         "price": 1.05
      }
   ]
}
</code>```

I'm trying to populate the full customer object to start with but that might not be necessary.

Ideally I'd just like the Customer.Display name to be added as a property of the SalesOrder. Then I wouldn't need the entire Customer object which is not necessary.

So maybe SalesOrder looks like this with just the CustomerDisplayName added. But I still need to reach the related Customer to derive the CustomerDisplayName.

```<code>namespace DataLayer
{
    public partial class SalesOrder
    {
        public SalesOrder()
        {
            this.SalesOrderLineItems = new HashSet<SalesOrderLineItem>();

            //this.Customer = new Customer().;

        }

        public Guid Id { get; set; }
        public DateTime Date { get; set; }
        public Guid CustomerID { get; set; }
        public virtual ICollection<SalesOrderLineItem> SalesOrderLineItems { get; set; }
        public virtual string CustomerDisplayName { get; set; }
    }
}
</code>```

Thanks for all your help in advance,
E

I tried to decorate the SalesOrder with the
[ForeignKey] attribute and define the CustomerID, but that didn't work.

I tried to load the Customer collection as I did with the SalesOrderLineItems, but of course the Customer doesn't have the SalesOrder relationship as the SalesOrderLineItem does. The Customer stands alone by itself and is referenced/associated in SalesOrder as a FK.

Body:
To everyone,

I'm trying to instantiate a SalesOrder Customer object so I can add the Customer's DisplayName to the SalesOrder.

I have this code in the SalesOrder class:

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

#nullable disable

namespace DataLayer
{
    public partial class SalesOrder
    {
        public SalesOrder()
        {
            this.SalesOrderLineItems = new HashSet<SalesOrderLineItem>();

            //this.Customer = new Customer().;

        }

        public Guid Id { get; set; }
        public DateTime Date { get; set; }
        public Guid CustomerID { get; set; }
        public virtual ICollection<SalesOrderLineItem> SalesOrderLineItems { get; set; }
        public virtual Customer Customer { get; set; }
    }
}

The SalesOrder does retrieve the SalesOrderLineItems. However, everything I try to fill  the instance of the Customer fails. I have the CustomerID FK on the SalesOrder object. I'm trying to use that PK/FK reference to the Customer row to bring in the instance of the customer which will allow me to reach the cust.DisplayName property. Just as I have with the SalesOrder.SalesOrderLineItems I want the Customer object to be properly attached to the SalesOrder object.

Here is the table structure which is normal PK/FK configuration between SalesOrder.CustomerID FK and Customer.Id PK.

Here is the code in the API controller that loads the SalesOrderLineItems to the SalesOrder object. This is all working perfectly...I think.

        public JsonResult GetSalesOrderByID(Guid salesorderid)
        {
            {

                var context = db.Set<SalesOrder>();
                SalesOrder sorder = context.First(s => s.Id == salesorderid);
                context.Entry(sorder).Collection(l => l.SalesOrderLineItems).Load();

                return new JsonResult(sorder);
            }
        }

USE [Backend]
GO

/****** Object:  Table [dbo].[**SalesOrder**]    Script Date: 12/16/2022 9:20:54 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[SalesOrder](
    [ID] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
    [Date] [datetime] NOT NULL,
    [CustomerID] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_SalesOrder] PRIMARY KEY CLUSTERED
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[SalesOrder] ADD  CONSTRAINT [DF_SalesOrder_ID]  DEFAULT (newid()) FOR [ID]
GO

ALTER TABLE [dbo].[SalesOrder]  WITH CHECK ADD  CONSTRAINT [FK_SalesOrder_Customer] FOREIGN KEY([CustomerID])
REFERENCES [dbo].[Customer] ([ID])
GO

ALTER TABLE [dbo].[SalesOrder] CHECK CONSTRAINT [FK_SalesOrder_Customer]
GO

USE [Backend]
GO

/****** Object:  Table [dbo].[Customer]    Script Date: 12/16/2022 9:29:17 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Customer](
    [ID] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
    [DisplayName] [nvarchar](max) NOT NULL,
    [FirstName] [nvarchar](50) NOT NULL,
    [LastName] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[Customer] ADD  CONSTRAINT [DF_Customer_ID]  DEFAULT (newid()) FOR [ID]
GO

Here is the JSON response as of now:

{
   "id": "fea1996f-7569-4556-971c-ecb125a53b53",
   "date": "2022-10-30T00:00:00",
   "customerID": "23a85521-d834-47b9-be0a-2d34fde6c2dc",
   "salesOrderLineItems":    [
            {
         "id": "7ca18a2d-1c3c-4ab6-a583-aafe3342f3d2",
         "salesOrderID": "fea1996f-7569-4556-971c-ecb125a53b53",
         "productID": "a8ee410e-aba3-45dc-aec3-5be389d98f96",
         "productDisplayName": "Acme Soap",
         "quantity": 30,
         "price": 200
      },
            {
         "id": "286997cc-b552-44fd-b7dc-fb60cfe88b61",
         "salesOrderID": "fea1996f-7569-4556-971c-ecb125a53b53",
         "productID": "0c56a53a-25c2-4ebf-a859-591edefb2657",
         "productDisplayName": "Central Widget",
         "quantity": 200,
         "price": 1.05
      }
   ],
   "customer": null
}

The ideal response would be:

{
   "id": "fea1996f-7569-4556-971c-ecb125a53b53",
   "date": "2022-10-30T00:00:00",
   "customerID": "23a85521-d834-47b9-be0a-2d34fde6c2dc",
   "CustomerDisplayName": "Jack Doe",
   "salesOrderLineItems":    [
            {
         "id": "7ca18a2d-1c3c-4ab6-a583-aafe3342f3d2",
         "salesOrderID": "fea1996f-7569-4556-971c-ecb125a53b53",
         "productID": "a8ee410e-aba3-45dc-aec3-5be389d98f96",
         "productDisplayName": "Acme Soap",
         "quantity": 30,
         "price": 200
      },
            {
         "id": "286997cc-b552-44fd-b7dc-fb60cfe88b61",
         "salesOrderID": "fea1996f-7569-4556-971c-ecb125a53b53",
         "productID": "0c56a53a-25c2-4ebf-a859-591edefb2657",
         "productDisplayName": "Central Widget",
         "quantity": 200,
         "price": 1.05
      }
   ]
}

I'm trying to populate the full customer object to start with but that might not be necessary.

Ideally I'd just like the Customer.Display name to be added as a property of the SalesOrder. Then I wouldn't need the entire Customer object which is not necessary.

So maybe SalesOrder looks like this with just the CustomerDisplayName added. But I still need to reach the related Customer to derive the CustomerDisplayName.

namespace DataLayer
{
    public partial class SalesOrder
    {
        public SalesOrder()
        {
            this.SalesOrderLineItems = new HashSet<SalesOrderLineItem>();

            //this.Customer = new Customer().;

        }

        public Guid Id { get; set; }
        public DateTime Date { get; set; }
        public Guid CustomerID { get; set; }
        public virtual ICollection<SalesOrderLineItem> SalesOrderLineItems { get; set; }
        public virtual string CustomerDisplayName { get; set; }
    }
}

Thanks for all your help in advance,
E

I tried to decorate the SalesOrder with the
[ForeignKey] attribute and define the CustomerID, but that didn't work.

I tried to load the Customer collection as I did with the SalesOrderLineItems, but of course the Customer doesn't have the SalesOrder relationship as the SalesOrderLineItem does. The Customer stands alone by itself and is referenced/associated in SalesOrder as a FK.


问:
Serverless throws "Can't Find Module" Error on all imported modules
Does anyone know why when using Serverless for AWS Lambda, I get a module not found error even though the module is in the correct place?

When trying to deploy the API onto AWS Lamdba  using serverless deploy - serverless throws errors complaining it can't find modules which are imported by the import statements.

In my specific case its resolvers and typeDefs.

Is there a way to get serverless to recognise imports?


问:
StoreKit2: Product.currentEntitlement vs. Transaction.currentEntitlements
I'm migrating from StoreKit to StoreKit2 and wondering, if there's a difference between these two following code-snippets. And of course, which one is preferred and why it is the preferred way.

```<code>    for await entitlement in Transaction.currentEntitlements {
        // Do something with the entitlement
    }

</code>```

or

```<code>    // `myProducts` contains a list of all products, that were received by call to Products.products(...) before.
    for product in myProducts {
        let entitlement = await product.currentEntitlement
        // Do something with the entitlement
    }
</code>```

Any thoughts? Both seem to work in sandbox, but what about production?

Note: I have only auto-renewable subscriptions as products in my App.

Body:
I'm migrating from StoreKit to StoreKit2 and wondering, if there's a difference between these two following code-snippets. And of course, which one is preferred and why it is the preferred way.

    for await entitlement in Transaction.currentEntitlements {
        // Do something with the entitlement
    }

or

    // `myProducts` contains a list of all products, that were received by call to Products.products(...) before.
    for product in myProducts {
        let entitlement = await product.currentEntitlement
        // Do something with the entitlement
    }

Any thoughts? Both seem to work in sandbox, but what about production?

Note: I have only auto-renewable subscriptions as products in my App.


问:
How to add event to control inside TemplatedControl
I have a TemplatedControl and some daughter controls inside it. I want to assign them some events. Initially axaml file cannot access C# module, but when I add x:Class="MyNamespace.MyTemplatedControl" to axaml, although C# code is seen from it, an error occurs:

MyTemplatedControl.axaml(9, 6): [XAMLIL] No Content property or any Add methods found for type MyDesktopApp:MyNamespace.MyTemplatedControl Line 9, position 6.

Looking for solution, all I have found was  this variant with Button and its Command property. But in this case I will be restricted only with click event, without opportunity to handle text changed, drag and drop, getting and loosing input focus and other popular actions.

MyTemplatedControl.axaml:

```<code><Styles xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:controls="using:MyNamespace"
        x:Class="MyNamespace.MyTemplatedControl">
    <Design.PreviewWith>
        <controls:MyTemplatedControl />
    </Design.PreviewWith>

    <Style Selector="controls|MyTemplatedControl">
        <!-- Set Defaults -->
        <Setter Property="Template">
            <ControlTemplate>
                <StackPanel>
                    <TextBlock
                        Text="Templated Control"
                        DoubleTapped="InputElement_OnTapped"/>
                    <TextBox
                        KeyDown="InputElement_OnKeyDown"/>
                </StackPanel>
            </ControlTemplate>
        </Setter>
    </Style>
</Styles>
</code>```

MyTmplatedControl.axaml.cs:

```<code>using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media;

namespace MyNamespace;

public class MyTemplatedControl : TemplatedControl
{
    private void InputElement_OnTapped(object? sender, RoutedEventArgs e)
    {
        (sender as TextBlock).Text = "DOUBLE TAPPED";
    }

    private void InputElement_OnKeyDown(object? sender, KeyEventArgs e)
    {
        (sender as TextBox).Background = new SolidColorBrush(Colors.Green);
    }
}
</code>```

PS. As a beginner, I also don't know yet, how to access controls from .axaml.cs to .axaml, help me, if it is possible, but I think, this is a topic for another issue.

Body:
I have a TemplatedControl and some daughter controls inside it. I want to assign them some events. Initially axaml file cannot access C# module, but when I add x:Class="MyNamespace.MyTemplatedControl" to axaml, although C# code is seen from it, an error occurs:

MyTemplatedControl.axaml(9, 6): [XAMLIL] No Content property or any Add methods found for type MyDesktopApp:MyNamespace.MyTemplatedControl Line 9, position 6.

Looking for solution, all I have found was  this variant with Button and its Command property. But in this case I will be restricted only with click event, without opportunity to handle text changed, drag and drop, getting and loosing input focus and other popular actions.

MyTemplatedControl.axaml:

</Styles>

MyTmplatedControl.axaml.cs:

using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media;

namespace MyNamespace;

public class MyTemplatedControl : TemplatedControl
{
    private void InputElement_OnTapped(object? sender, RoutedEventArgs e)
    {
        (sender as TextBlock).Text = "DOUBLE TAPPED";
    }

    private void InputElement_OnKeyDown(object? sender, KeyEventArgs e)
    {
        (sender as TextBox).Background = new SolidColorBrush(Colors.Green);
    }
}

PS. As a beginner, I also don't know yet, how to access controls from .axaml.cs to .axaml, help me, if it is possible, but I think, this is a topic for another issue.


问:
How can I add data to folders use Qt Installer Framework?
I want to install my program and add some data to other directories without deleting those directories, but installer, created by bynarycreator, wants to delete the directories before copying the new data.

Manually, I just copy the directories to the home directory, but the installer wants to remove all data from the directories.

```<code>/home/Desktop
/home/CompanyName
/home/Work
</code>```

Body:
I want to install my program and add some data to other directories without deleting those directories, but installer, created by bynarycreator, wants to delete the directories before copying the new data.

Manually, I just copy the directories to the home directory, but the installer wants to remove all data from the directories.

/home/Desktop
/home/CompanyName
/home/Work


问:
Returning a local pointer variable in C
I'm studying pointers and I've created this example:

```<code>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

int* f(){
    int n = 10;
    return &n;
}

int main() {
    printf("%d",*f());

}
</code>```

The expectation were it would not work, because the returned pointer is pointing to a automatic variable, which will be destroyed, and so we'll have a undefined behavior. And my expectations were correct, the program have crashed.

After it I created a similar example:

```<code>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

int* f(){
    int n = 10;
    int* ptr = &n;
    return ptr;
}

int main() {
    printf("%d",*f());

}
</code>```

The only difference in second example is that the function is returning a variable int* ptr which is of int pointer type, and the initial value of this variable is the address (pointer) of variable int n.

Before running it I thought it wouldn't work too (I thought it would crash again), but it works, the program don't crash and prints the value '10' at the terminal. My question is: Why the second example works if in theory it is pointing to a automatic variable that will be destroyed

[EDIT]

I've read the comments and I've understand that the second example actually is a undefined behaviour. But I'm still with a doubt: Is There any way to force a "fatal" error that demonstrates this example has an undefined behavior "behind the scenes"? I've created other examples like the second, and all of them have a behaviour that seams right (I know, its a undefined behaviour but nothing special have happened, like a crash your a message)

Title: Returning a local pointer variable in C

Body:
I'm studying pointers and I've created this example:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

int* f(){
    int n = 10;
    return &n;
}

int main() {
    printf("%d",*f());

}

The expectation were it would not work, because the returned pointer is pointing to a automatic variable, which will be destroyed, and so we'll have a undefined behavior. And my expectations were correct, the program have crashed.

After it I created a similar example:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

int* f(){
    int n = 10;
    int* ptr = &n;
    return ptr;
}

int main() {
    printf("%d",*f());

}

The only difference in second example is that the function is returning a variable int* ptr which is of int pointer type, and the initial value of this variable is the address (pointer) of variable int n.

Before running it I thought it wouldn't work too (I thought it would crash again), but it works, the program don't crash and prints the value '10' at the terminal. My question is: Why the second example works if in theory it is pointing to a automatic variable that will be destroyed

[EDIT]

I've read the comments and I've understand that the second example actually is a undefined behaviour. But I'm still with a doubt: Is There any way to force a "fatal" error that demonstrates this example has an undefined behavior "behind the scenes"? I've created other examples like the second, and all of them have a behaviour that seams right (I know, its a undefined behaviour but nothing special have happened, like a crash your a message)


问:
vaex and ipynb problems
I am new to vaex. Just started using it to speed up some groupby + agg.nunique operations on ~40 million rows Data Frame in jupyter notebook.
It works much faster than pandas, I am really excited to use it more often but sometimes I experience weird error:
executing some simple vaex notebook cell with simple filter code like:

```<code>vf[vf.Item_count >1]
</code>```

finishes under 1s but when I run the same cell again it can take several minutes and won't respond to keyboard interruption.

I run vaex and pandas inside VSCode on Win10 machine with 32GB of RAM.
My Data Frame in pandas takes around 1GB.

Could you please help me navigate around those slow downs ?

Title: vaex and ipynb problems

Body:
I am new to vaex. Just started using it to speed up some groupby + agg.nunique operations on ~40 million rows Data Frame in jupyter notebook.
It works much faster than pandas, I am really excited to use it more often but sometimes I experience weird error:
executing some simple vaex notebook cell with simple filter code like:

vf[vf.Item_count >1]

finishes under 1s but when I run the same cell again it can take several minutes and won't respond to keyboard interruption.

I run vaex and pandas inside VSCode on Win10 machine with 32GB of RAM.
My Data Frame in pandas takes around 1GB.

Could you please help me navigate around those slow downs ?


问:
Python formatting decimal points on specific columns which contain 'nan'
I am loading a dataframe from a csv file using,

```<code>df_c = pd.read_csv(os.path.join(dir_w, csv_c))
</code>```

Which gives me,

```<code>   SubCase        Row1   Row2    Row3   Row4
0  1003001          NaN     0     NaN   10.0
1  1003002          NaN     0     NaN   10.5
2  1003003          NaN     0     NaN   11.3
3  2000001     110001.0    10     1.0   9.81
4  2000002     110001.0    10     1.0   5.06
</code>```

For columns 'Row1' and 'Row2' I want to remove the decimal points, while keeping the decimal points in 'Row4'. So it looks like this,

```<code>   SubCase        Row1   Row2    Row3   Row4
0  1003001          NaN     0     NaN   10.0
1  1003002          NaN     0     NaN   10.5
2  1003003          NaN     0     NaN   11.3
3  2000001       110001    10       1   9.81
4  2000002       110001    10       1   5.06
</code>```

I have tried the following code with no luck,

```<code>na_mask = df_c['Row1'].notnull()
df_c.loc[na_mask, 'Row1'] = df_c.loc[na_mask, 'Row1'].round(decimals=0)
</code>```

and

```<code>na_mask = df_c['Row1'].notnull()
df_c.loc[na_mask, 'Row1'] = df_c.loc[na_mask, 'Row1'].astype(int)
</code>```

Any ideas? Thanks in advance for any help.

Body:
I am loading a dataframe from a csv file using,

df_c = pd.read_csv(os.path.join(dir_w, csv_c))

Which gives me,

   SubCase        Row1   Row2    Row3   Row4
0  1003001          NaN     0     NaN   10.0
1  1003002          NaN     0     NaN   10.5
2  1003003          NaN     0     NaN   11.3
3  2000001     110001.0    10     1.0   9.81
4  2000002     110001.0    10     1.0   5.06

For columns 'Row1' and 'Row2' I want to remove the decimal points, while keeping the decimal points in 'Row4'. So it looks like this,

   SubCase        Row1   Row2    Row3   Row4
0  1003001          NaN     0     NaN   10.0
1  1003002          NaN     0     NaN   10.5
2  1003003          NaN     0     NaN   11.3
3  2000001       110001    10       1   9.81
4  2000002       110001    10       1   5.06

I have tried the following code with no luck,

na_mask = df_c['Row1'].notnull()
df_c.loc[na_mask, 'Row1'] = df_c.loc[na_mask, 'Row1'].round(decimals=0)

and

na_mask = df_c['Row1'].notnull()
df_c.loc[na_mask, 'Row1'] = df_c.loc[na_mask, 'Row1'].astype(int)

Any ideas? Thanks in advance for any help.


问:
Why wont my HealthBar visual decrease when i interact with an enemy collider?
I have recently started creating a c# game due to it being a mandatory assignment in my computer science course however i am new to c# and have hit a bump. I have written a Healthbar script so that when my player collides with a gameobject tagged "Enemy" the players health should reduce by 20. However when i press play the health bar visual did not decrease as it should. Like i said i am new to c# so im not too sure how to fix it. I have searched many tutorials however they all gave me the same suggestion of checking to make sure the inspector window of my player and enemy is correct.

After making sure everyting is linked up properly including making the player box collider to " is trigger" and then adding a capsule collider so that it still interacts like a solid object, the code i wrote still didnt work, and whenever i hit my enemy which i tagged as "Enemy" the health bar visual did not change/decrease. I thought that maybe it was just the visual and my health was actually reducing, so to check this i added debugging code to produce a message in the console whether the OnTriggerEnter code was working properly and to my surprise it did not work. I added multiple other debugging code lines as well and none of them showed that anything was working.

This is my player script, giving my player health and allowing the TakeDamage code to run if i enter the enemies collider.

```<code>using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
public int maxHealth = 100;
public int currentHealth;

    public HealthBar healthBar;

    // Start is called before the first frame update
    void Start()
    {
        currentHealth = maxHealth;
        if (healthBar != null)
        {
            healthBar.SetMaxHealth(maxHealth);
        }
    }

    // Update is called once per frame
    void Update()
    {
    }

    void TakeDamage(int damage)
    {
        currentHealth -= damage;

        if (currentHealth < 0)
        {

            // Trigger game over event
            Debug.Log("Game over!");
        }

        healthBar.SetHealth(currentHealth);
    }

    // This function is called when the player collides with an enemy
    void OnTriggerEnter(Collider other)
    {
        Debug.Log("Collision detected!");
        if (other.gameObject.tag == "Enemy")
        {
            // Decrease the player's health by a certain amount
            TakeDamage(20);
        }
    }
}
</code>```

And this is my healthbar script which should update and decrease based on the value after the TakeDamage line is executed upon collding with the enemy, however no matter what i try, it doesnt seem to update, nor do any debug areas appear in my console, showing that the script isnt detecting the collision between me and my enemy.

```<code>using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class HealthBar : MonoBehaviour
{

    public Slider slider;
    public Gradient gradient;
    public Image fill;

    public void SetMaxHealth(int health)
    {
        slider.maxValue = health;
        slider.value = health;

        fill.color = gradient.Evaluate(1f);
    }

    public void SetHealth(int health)
    {
        slider.value = health;

        fill.color = gradient.Evaluate(slider.normalizedValue);
    }

}
</code>```

Body:
I have recently started creating a c# game due to it being a mandatory assignment in my computer science course however i am new to c# and have hit a bump. I have written a Healthbar script so that when my player collides with a gameobject tagged "Enemy" the players health should reduce by 20. However when i press play the health bar visual did not decrease as it should. Like i said i am new to c# so im not too sure how to fix it. I have searched many tutorials however they all gave me the same suggestion of checking to make sure the inspector window of my player and enemy is correct.

After making sure everyting is linked up properly including making the player box collider to " is trigger" and then adding a capsule collider so that it still interacts like a solid object, the code i wrote still didnt work, and whenever i hit my enemy which i tagged as "Enemy" the health bar visual did not change/decrease. I thought that maybe it was just the visual and my health was actually reducing, so to check this i added debugging code to produce a message in the console whether the OnTriggerEnter code was working properly and to my surprise it did not work. I added multiple other debugging code lines as well and none of them showed that anything was working.

This is my player script, giving my player health and allowing the TakeDamage code to run if i enter the enemies collider.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
public int maxHealth = 100;
public int currentHealth;

    public HealthBar healthBar;

    // Start is called before the first frame update
    void Start()
    {
        currentHealth = maxHealth;
        if (healthBar != null)
        {
            healthBar.SetMaxHealth(maxHealth);
        }
    }

    // Update is called once per frame
    void Update()
    {
    }

    void TakeDamage(int damage)
    {
        currentHealth -= damage;

        if (currentHealth < 0)
        {

            // Trigger game over event
            Debug.Log("Game over!");
        }

        healthBar.SetHealth(currentHealth);
    }

    // This function is called when the player collides with an enemy
    void OnTriggerEnter(Collider other)
    {
        Debug.Log("Collision detected!");
        if (other.gameObject.tag == "Enemy")
        {
            // Decrease the player's health by a certain amount
            TakeDamage(20);
        }
    }
}

And this is my healthbar script which should update and decrease based on the value after the TakeDamage line is executed upon collding with the enemy, however no matter what i try, it doesnt seem to update, nor do any debug areas appear in my console, showing that the script isnt detecting the collision between me and my enemy.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class HealthBar : MonoBehaviour
{

    public Slider slider;
    public Gradient gradient;
    public Image fill;

    public void SetMaxHealth(int health)
    {
        slider.maxValue = health;
        slider.value = health;

        fill.color = gradient.Evaluate(1f);
    }

    public void SetHealth(int health)
    {
        slider.value = health;

        fill.color = gradient.Evaluate(slider.normalizedValue);
    }

}


问:
Dealing with the "windows-1252 encoding" warning but keeping ISO-8859-1
I developed my web application and now I decided to clear the browser alerts to meet the required standards, but everything in my application uses the ISO-8859-1 charset by default and I'm having trouble satisfying the alert that says to use UTF-8.

My JSP pages have <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>, my  has <meta charset="ISO-8859-1">, no <form> has accept-charset="UTF-8" and so on.

A form was submitted in the windows-1252 encoding which cannot encode
all Unicode characters, so user input may get corrupted. To avoid this
problem, the page should be changed so that the form is submitted in
the UTF-8 encoding either by changing the encoding of the page itself
to UTF-8 or by specifying accept-charset=utf-8 on the form element.

I adapted the pages, which started sending corrupted characters to the servlets. So I adapted the servlets (response.setCharacterEncoding("UTF-8");), which started to send corrupted characters to the database. I thought about adapting the database (Oracle 10g), but that will probably corrupt the reading of the data for other applications that access this database.

Then it occurred to me that maybe it was best not to change anything. But this is a warning, which means that UTF-8 versus ISO-8859-1 is not a matter of choice, but of improvement or correction.

So is it possible for me to keep the standard and satisfy the alert? If yes, what can I do to clear it? Or should I really keep adapting everything to UTF-8? I fear that my co-workers' future projects may be affected by the change.


问:
List pull request comments using go-github
I am trying to retrieve list of comments for particular Pull Request using go-github.
I am interested in comments listed in the section Conversation not the review comments.

I tried to use PullRequests.ListComments, but it returns review comments

```<code>PullRequests.ListComments(ctx, ghOrgName, ghRepoName, *value.PullRequest.Number, &github.PullRequestListCommentsOptions{})
</code>```

I didnt find suitable function in the documentation

Thanks in advance

Body:
I am trying to retrieve list of comments for particular Pull Request using go-github.
I am interested in comments listed in the section Conversation not the review comments.

I tried to use PullRequests.ListComments, but it returns review comments

PullRequests.ListComments(ctx, ghOrgName, ghRepoName, *value.PullRequest.Number, &github.PullRequestListCommentsOptions{})

I didnt find suitable function in the documentation

Thanks in advance


问:
Openshift Angular Application S2I Build ImagePullBackOff
Trying to complete Openshift S2I build using NodeJS builder image, running into the error: npm ERR! enoent ENOENT: no such file or directory, open '/opt/app-root/src/package.json'.

Here are the logs of the build

```<code>Adding cluster TLS certificate authority to trust store
Cloning "https://dev.azure.com/westfieldgrp/PL/_git/rule_tool_frontend" ...
    Commit: 620bcb6c63dd479ffb4c73f72bea0d71eeb4ba55 (deleted files that have been moved)
    Author: D************ <D************@************.com>
    Date:   Fri Dec 16 09:39:09 2022 -0500
Adding cluster TLS certificate authority to trust store
Adding cluster TLS certificate authority to trust store
time="2022-12-16T14:40:04Z" level=info msg="Not using native diff for overlay, this may cause degraded performance for building images: kernel has CONFIG_OVERLAY_FS_REDIRECT_DIR enabled"
I1216 14:40:04.659698       1 defaults.go:102] Defaulting to storage driver "overlay" with options [mountopt=metacopy=on].
Caching blobs under "/var/cache/blobs".
Trying to pull image-registry.openshift-image-registry.svc:5000/openshift/nodejs@sha256:ec4bda6a4daaea3a28591ea97afc0ea52d06d881a5d966e18269f9c0d0c87892...
Getting image source signatures
Copying blob sha256:600dbb68a707d0370701a1985b053a56c1b71c054179497b8809f0bbdcf72fda
Copying blob sha256:2cf6011ee4f717c20cb7060fe612341720080cd81c52bcd32f54edb15af12991
Copying blob sha256:417723e2b937d59afc1be1bee1ba70a3952be0d1bc922efd8160e0a7060ff7d4
Copying config sha256:f6dc2bbf0dea77c31c3c5d0435fee81c1f52ab70ecdeb0092102b2ae86b0a1ef
Writing manifest to image destination
Storing signatures
Generating dockerfile with builder image image-registry.openshift-image-registry.svc:5000/openshift/nodejs@sha256:ec4bda6a4daaea3a28591ea97afc0ea52d06d881a5d966e18269f9c0d0c87892
Adding transient rw bind mount for /run/secrets/rhsm
STEP 1/9: FROM image-registry.openshift-image-registry.svc:5000/openshift/nodejs@sha256:ec4bda6a4daaea3a28591ea97afc0ea52d06d881a5d966e18269f9c0d0c87892
STEP 2/9: LABEL "io.openshift.build.commit.date"="Fri Dec 16 09:39:09 2022 -0500"       "io.openshift.build.commit.id"="620bcb6c63dd479ffb4c73f72bea0d71eeb4ba55"       "io.openshift.build.commit.ref"="main"       "io.openshift.build.commit.message"="deleted files that have been moved"       "io.openshift.build.source-context-dir"="/"       "io.openshift.build.image"="image-registry.openshift-image-registry.svc:5000/openshift/nodejs@sha256:ec4bda6a4daaea3a28591ea97afc0ea52d06d881a5d966e18269f9c0d0c87892"       "io.openshift.build.commit.author"="DominicRomano <DominicRomano@westfieldgrp.com>"
STEP 3/9: ENV OPENSHIFT_BUILD_NAME="rule-tool-frontend2-3"     OPENSHIFT_BUILD_NAMESPACE="rule-tool-webapp2"     OPENSHIFT_BUILD_SOURCE="https://************@dev.azure.com/************/**/_git/rule_tool_frontend"     OPENSHIFT_BUILD_COMMIT="620bcb6c63dd479ffb4c73f72bea0d71eeb4ba55"
STEP 4/9: USER root
STEP 5/9: COPY upload/src /tmp/src
STEP 6/9: RUN chown -R 1001:0 /tmp/src
STEP 7/9: USER 1001
STEP 8/9: RUN /usr/libexec/s2i/assemble
---> Installing application source ...
---> Installing all dependencies
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/app-root/src/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/opt/app-root/src/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /opt/app-root/src/.npm/_logs/2022-12-16T14_40_22_836Z-debug-0.log
error: build error: error building at STEP "RUN /usr/libexec/s2i/assemble": error while running runtime: exit status 254
</code>```

Here is the YAML

```<code>kind: Pod
apiVersion: v1
metadata:
  generateName: rule-tool-frontend2-f484544fb-
  annotations:
    k8s.ovn.org/pod-networks: >-
      {"default":{"ip_addresses":["**.***.*.**/**"],"mac_address":"**:**:**:**:**:**","gateway_ips":["**.***.*.*"],"ip_address":"**.***.*.**/**","gateway_ip":"**.***.*.*"}}
    k8s.v1.cni.cncf.io/network-status: |-
      [{
          "name": "ovn-kubernetes",
          "interface": "eth0",
          "ips": [
              "**.***.*.*"
          ],
          "mac": "**:**:**:**:**:**",
          "default": true,
          "dns": {}
      }]
    k8s.v1.cni.cncf.io/networks-status: |-
      [{
          "name": "ovn-kubernetes",
          "interface": "eth0",
          "ips": [
              "**.***.*.*"
          ],
          "mac": "**:**:**:**:**:**",
          "default": true,
          "dns": {}
      }]
    openshift.io/scc: restricted
  resourceVersion: '186661887'
  name: rule-tool-frontend2-f484544fb-sb24h
  uid: faf4501f-417f-481a-a05f-d57b411188b7
  creationTimestamp: '2022-12-16T13:54:49Z'
  managedFields:
    - manager: kube-controller-manager
      operation: Update
      apiVersion: v1
      time: '2022-12-16T13:54:49Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:generateName': {}
          'f:labels':
            .: {}
            'f:app': {}
            'f:deploymentconfig': {}
            'f:pod-template-hash': {}
          'f:ownerReferences':
            .: {}
            'k:{"uid":"19afb68c-c09d-4ced-97bf-a69cfeb3c05e"}': {}
        'f:spec':
          'f:containers':
            'k:{"name":"rule-tool-frontend2"}':
              .: {}
              'f:image': {}
              'f:imagePullPolicy': {}
              'f:name': {}
              'f:ports':
                .: {}
                'k:{"containerPort":8080,"protocol":"TCP"}':
                  .: {}
                  'f:containerPort': {}
                  'f:protocol': {}
              'f:resources': {}
              'f:terminationMessagePath': {}
              'f:terminationMessagePolicy': {}
          'f:dnsPolicy': {}
          'f:enableServiceLinks': {}
          'f:restartPolicy': {}
          'f:schedulerName': {}
          'f:securityContext': {}
          'f:terminationGracePeriodSeconds': {}
    - manager: svatwfldopnshft-2v2n5-master-0
      operation: Update
      apiVersion: v1
      time: '2022-12-16T13:54:49Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:annotations':
            'f:k8s.ovn.org/pod-networks': {}
    - manager: multus
      operation: Update
      apiVersion: v1
      time: '2022-12-16T13:54:51Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:annotations':
            'f:k8s.v1.cni.cncf.io/network-status': {}
            'f:k8s.v1.cni.cncf.io/networks-status': {}
      subresource: status
    - manager: Go-http-client
      operation: Update
      apiVersion: v1
      time: '2022-12-16T13:54:52Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:status':
          'f:conditions':
            'k:{"type":"ContainersReady"}':
              .: {}
              'f:lastProbeTime': {}
              'f:lastTransitionTime': {}
              'f:message': {}
              'f:reason': {}
              'f:status': {}
              'f:type': {}
            'k:{"type":"Initialized"}':
              .: {}
              'f:lastProbeTime': {}
              'f:lastTransitionTime': {}
              'f:status': {}
              'f:type': {}
            'k:{"type":"Ready"}':
              .: {}
              'f:lastProbeTime': {}
              'f:lastTransitionTime': {}
              'f:message': {}
              'f:reason': {}
              'f:status': {}
              'f:type': {}
          'f:containerStatuses': {}
          'f:hostIP': {}
          'f:podIP': {}
          'f:podIPs':
            .: {}
            'k:{"ip":"**.***.*.*"}':
              .: {}
              'f:ip': {}
          'f:startTime': {}
      subresource: status
  namespace: rule-tool-webapp2
  ownerReferences:
    - apiVersion: apps/v1
      kind: ReplicaSet
      name: rule-tool-frontend2-f484544fb
      uid: 19afb68c-c09d-4ced-97bf-a69cfeb3c05e
      controller: true
      blockOwnerDeletion: true
  labels:
    app: rule-tool-frontend2
    deploymentconfig: rule-tool-frontend2
    pod-template-hash: f484544fb
spec:
  restartPolicy: Always
  serviceAccountName: default
  imagePullSecrets:
    - name: default-dockercfg-g9tqv
  priority: 0
  schedulerName: default-scheduler
  enableServiceLinks: true
  terminationGracePeriodSeconds: 30
  preemptionPolicy: PreemptLowerPriority
  nodeName: svatwfldopnshft-2v2n5-worker-kmk85
  securityContext:
    seLinuxOptions:
      level: 's0:c28,c12'
    fsGroup: 1000780000
  containers:
    - resources: {}
      terminationMessagePath: /dev/termination-log
      name: rule-tool-frontend2
      securityContext:
        capabilities:
          drop:
            - KILL
            - MKNOD
            - SETGID
            - SETUID
        runAsUser: 1000780000
      ports:
        - containerPort: 8080
          protocol: TCP
      imagePullPolicy: Always
      volumeMounts:
        - name: kube-api-access-k2tzb
          readOnly: true
          mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      terminationMessagePolicy: File
      image: >-
        image-registry.openshift-image-registry.svc:5000/rule-tool-webapp2/rule-tool-frontend2:latest
  serviceAccount: default
  volumes:
    - name: kube-api-access-k2tzb
      projected:
        sources:
          - serviceAccountToken:
              expirationSeconds: 3607
              path: token
          - configMap:
              name: kube-root-ca.crt
              items:
                - key: ca.crt
                  path: ca.crt
          - downwardAPI:
              items:
                - path: namespace
                  fieldRef:
                    apiVersion: v1
                    fieldPath: metadata.namespace
          - configMap:
              name: openshift-service-ca.crt
              items:
                - key: service-ca.crt
                  path: service-ca.crt
        defaultMode: 420
  dnsPolicy: ClusterFirst
  tolerations:
    - key: node.kubernetes.io/not-ready
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
    - key: node.kubernetes.io/unreachable
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
status:
  phase: Pending
  conditions:
    - type: Initialized
      status: 'True'
      lastProbeTime: null
      lastTransitionTime: '2022-12-16T13:54:49Z'
    - type: Ready
      status: 'False'
      lastProbeTime: null
      lastTransitionTime: '2022-12-16T13:54:49Z'
      reason: ContainersNotReady
      message: 'containers with unready status: [rule-tool-frontend2]'
    - type: ContainersReady
      status: 'False'
      lastProbeTime: null
      lastTransitionTime: '2022-12-16T13:54:49Z'
      reason: ContainersNotReady
      message: 'containers with unready status: [rule-tool-frontend2]'
    - type: PodScheduled
      status: 'True'
      lastProbeTime: null
      lastTransitionTime: '2022-12-16T13:54:49Z'
  hostIP: **.***.*.*
  podIP: **.***.*.*
  podIPs:
    - ip: **.***.*.*
  startTime: '2022-12-16T13:54:49Z'
  containerStatuses:
    - name: rule-tool-frontend2
      state:
        waiting:
          reason: ImagePullBackOff
          message: >-
            Back-off pulling image
            "image-registry.openshift-image-registry.svc:5000/rule-tool-webapp2/rule-tool-frontend2:latest"
      lastState: {}
      ready: false
      restartCount: 0
      image: >-
        image-registry.openshift-image-registry.svc:5000/rule-tool-webapp2/rule-tool-frontend2:latest
      imageID: ''
      started: false
  qosClass: BestEffort
</code>```

package.json is located in rule_tool_frontend/src, how do I change where NPM is looking for package.json? Is this something that should be edited in the build YAML?

Thank you for any help.

Tried to complete the Openshift S2I build using NodeJS builder image, expecting a successful build. Got the described error instead.

Body:
Trying to complete Openshift S2I build using NodeJS builder image, running into the error: npm ERR! enoent ENOENT: no such file or directory, open '/opt/app-root/src/package.json'.

Here are the logs of the build

Adding cluster TLS certificate authority to trust store
Cloning "https://dev.azure.com/westfieldgrp/PL/_git/rule_tool_frontend" ...
    Commit: 620bcb6c63dd479ffb4c73f72bea0d71eeb4ba55 (deleted files that have been moved)
    Author: D************ <D************@************.com>
    Date:   Fri Dec 16 09:39:09 2022 -0500
Adding cluster TLS certificate authority to trust store
Adding cluster TLS certificate authority to trust store
time="2022-12-16T14:40:04Z" level=info msg="Not using native diff for overlay, this may cause degraded performance for building images: kernel has CONFIG_OVERLAY_FS_REDIRECT_DIR enabled"
I1216 14:40:04.659698       1 defaults.go:102] Defaulting to storage driver "overlay" with options [mountopt=metacopy=on].
Caching blobs under "/var/cache/blobs".
Trying to pull image-registry.openshift-image-registry.svc:5000/openshift/nodejs@sha256:ec4bda6a4daaea3a28591ea97afc0ea52d06d881a5d966e18269f9c0d0c87892...
Getting image source signatures
Copying blob sha256:600dbb68a707d0370701a1985b053a56c1b71c054179497b8809f0bbdcf72fda
Copying blob sha256:2cf6011ee4f717c20cb7060fe612341720080cd81c52bcd32f54edb15af12991
Copying blob sha256:417723e2b937d59afc1be1bee1ba70a3952be0d1bc922efd8160e0a7060ff7d4
Copying config sha256:f6dc2bbf0dea77c31c3c5d0435fee81c1f52ab70ecdeb0092102b2ae86b0a1ef
Writing manifest to image destination
Storing signatures
Generating dockerfile with builder image image-registry.openshift-image-registry.svc:5000/openshift/nodejs@sha256:ec4bda6a4daaea3a28591ea97afc0ea52d06d881a5d966e18269f9c0d0c87892
Adding transient rw bind mount for /run/secrets/rhsm
STEP 1/9: FROM image-registry.openshift-image-registry.svc:5000/openshift/nodejs@sha256:ec4bda6a4daaea3a28591ea97afc0ea52d06d881a5d966e18269f9c0d0c87892
STEP 2/9: LABEL "io.openshift.build.commit.date"="Fri Dec 16 09:39:09 2022 -0500"       "io.openshift.build.commit.id"="620bcb6c63dd479ffb4c73f72bea0d71eeb4ba55"       "io.openshift.build.commit.ref"="main"       "io.openshift.build.commit.message"="deleted files that have been moved"       "io.openshift.build.source-context-dir"="/"       "io.openshift.build.image"="image-registry.openshift-image-registry.svc:5000/openshift/nodejs@sha256:ec4bda6a4daaea3a28591ea97afc0ea52d06d881a5d966e18269f9c0d0c87892"       "io.openshift.build.commit.author"="DominicRomano <DominicRomano@westfieldgrp.com>"
STEP 3/9: ENV OPENSHIFT_BUILD_NAME="rule-tool-frontend2-3"     OPENSHIFT_BUILD_NAMESPACE="rule-tool-webapp2"     OPENSHIFT_BUILD_SOURCE="https://************@dev.azure.com/************/**/_git/rule_tool_frontend"     OPENSHIFT_BUILD_COMMIT="620bcb6c63dd479ffb4c73f72bea0d71eeb4ba55"
STEP 4/9: USER root
STEP 5/9: COPY upload/src /tmp/src
STEP 6/9: RUN chown -R 1001:0 /tmp/src
STEP 7/9: USER 1001
STEP 8/9: RUN /usr/libexec/s2i/assemble
---> Installing application source ...
---> Installing all dependencies
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /opt/app-root/src/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/opt/app-root/src/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /opt/app-root/src/.npm/_logs/2022-12-16T14_40_22_836Z-debug-0.log
error: build error: error building at STEP "RUN /usr/libexec/s2i/assemble": error while running runtime: exit status 254

Here is the YAML

kind: Pod
apiVersion: v1
metadata:
  generateName: rule-tool-frontend2-f484544fb-
  annotations:
    k8s.ovn.org/pod-networks: >-
      {"default":{"ip_addresses":["**.***.*.**/**"],"mac_address":"**:**:**:**:**:**","gateway_ips":["**.***.*.*"],"ip_address":"**.***.*.**/**","gateway_ip":"**.***.*.*"}}
    k8s.v1.cni.cncf.io/network-status: |-
      [{
          "name": "ovn-kubernetes",
          "interface": "eth0",
          "ips": [
              "**.***.*.*"
          ],
          "mac": "**:**:**:**:**:**",
          "default": true,
          "dns": {}
      }]
    k8s.v1.cni.cncf.io/networks-status: |-
      [{
          "name": "ovn-kubernetes",
          "interface": "eth0",
          "ips": [
              "**.***.*.*"
          ],
          "mac": "**:**:**:**:**:**",
          "default": true,
          "dns": {}
      }]
    openshift.io/scc: restricted
  resourceVersion: '186661887'
  name: rule-tool-frontend2-f484544fb-sb24h
  uid: faf4501f-417f-481a-a05f-d57b411188b7
  creationTimestamp: '2022-12-16T13:54:49Z'
  managedFields:
    - manager: kube-controller-manager
      operation: Update
      apiVersion: v1
      time: '2022-12-16T13:54:49Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:generateName': {}
          'f:labels':
            .: {}
            'f:app': {}
            'f:deploymentconfig': {}
            'f:pod-template-hash': {}
          'f:ownerReferences':
            .: {}
            'k:{"uid":"19afb68c-c09d-4ced-97bf-a69cfeb3c05e"}': {}
        'f:spec':
          'f:containers':
            'k:{"name":"rule-tool-frontend2"}':
              .: {}
              'f:image': {}
              'f:imagePullPolicy': {}
              'f:name': {}
              'f:ports':
                .: {}
                'k:{"containerPort":8080,"protocol":"TCP"}':
                  .: {}
                  'f:containerPort': {}
                  'f:protocol': {}
              'f:resources': {}
              'f:terminationMessagePath': {}
              'f:terminationMessagePolicy': {}
          'f:dnsPolicy': {}
          'f:enableServiceLinks': {}
          'f:restartPolicy': {}
          'f:schedulerName': {}
          'f:securityContext': {}
          'f:terminationGracePeriodSeconds': {}
    - manager: svatwfldopnshft-2v2n5-master-0
      operation: Update
      apiVersion: v1
      time: '2022-12-16T13:54:49Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:annotations':
            'f:k8s.ovn.org/pod-networks': {}
    - manager: multus
      operation: Update
      apiVersion: v1
      time: '2022-12-16T13:54:51Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:metadata':
          'f:annotations':
            'f:k8s.v1.cni.cncf.io/network-status': {}
            'f:k8s.v1.cni.cncf.io/networks-status': {}
      subresource: status
    - manager: Go-http-client
      operation: Update
      apiVersion: v1
      time: '2022-12-16T13:54:52Z'
      fieldsType: FieldsV1
      fieldsV1:
        'f:status':
          'f:conditions':
            'k:{"type":"ContainersReady"}':
              .: {}
              'f:lastProbeTime': {}
              'f:lastTransitionTime': {}
              'f:message': {}
              'f:reason': {}
              'f:status': {}
              'f:type': {}
            'k:{"type":"Initialized"}':
              .: {}
              'f:lastProbeTime': {}
              'f:lastTransitionTime': {}
              'f:status': {}
              'f:type': {}
            'k:{"type":"Ready"}':
              .: {}
              'f:lastProbeTime': {}
              'f:lastTransitionTime': {}
              'f:message': {}
              'f:reason': {}
              'f:status': {}
              'f:type': {}
          'f:containerStatuses': {}
          'f:hostIP': {}
          'f:podIP': {}
          'f:podIPs':
            .: {}
            'k:{"ip":"**.***.*.*"}':
              .: {}
              'f:ip': {}
          'f:startTime': {}
      subresource: status
  namespace: rule-tool-webapp2
  ownerReferences:
    - apiVersion: apps/v1
      kind: ReplicaSet
      name: rule-tool-frontend2-f484544fb
      uid: 19afb68c-c09d-4ced-97bf-a69cfeb3c05e
      controller: true
      blockOwnerDeletion: true
  labels:
    app: rule-tool-frontend2
    deploymentconfig: rule-tool-frontend2
    pod-template-hash: f484544fb
spec:
  restartPolicy: Always
  serviceAccountName: default
  imagePullSecrets:
    - name: default-dockercfg-g9tqv
  priority: 0
  schedulerName: default-scheduler
  enableServiceLinks: true
  terminationGracePeriodSeconds: 30
  preemptionPolicy: PreemptLowerPriority
  nodeName: svatwfldopnshft-2v2n5-worker-kmk85
  securityContext:
    seLinuxOptions:
      level: 's0:c28,c12'
    fsGroup: 1000780000
  containers:
    - resources: {}
      terminationMessagePath: /dev/termination-log
      name: rule-tool-frontend2
      securityContext:
        capabilities:
          drop:
            - KILL
            - MKNOD
            - SETGID
            - SETUID
        runAsUser: 1000780000
      ports:
        - containerPort: 8080
          protocol: TCP
      imagePullPolicy: Always
      volumeMounts:
        - name: kube-api-access-k2tzb
          readOnly: true
          mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      terminationMessagePolicy: File
      image: >-
        image-registry.openshift-image-registry.svc:5000/rule-tool-webapp2/rule-tool-frontend2:latest
  serviceAccount: default
  volumes:
    - name: kube-api-access-k2tzb
      projected:
        sources:
          - serviceAccountToken:
              expirationSeconds: 3607
              path: token
          - configMap:
              name: kube-root-ca.crt
              items:
                - key: ca.crt
                  path: ca.crt
          - downwardAPI:
              items:
                - path: namespace
                  fieldRef:
                    apiVersion: v1
                    fieldPath: metadata.namespace
          - configMap:
              name: openshift-service-ca.crt
              items:
                - key: service-ca.crt
                  path: service-ca.crt
        defaultMode: 420
  dnsPolicy: ClusterFirst
  tolerations:
    - key: node.kubernetes.io/not-ready
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
    - key: node.kubernetes.io/unreachable
      operator: Exists
      effect: NoExecute
      tolerationSeconds: 300
status:
  phase: Pending
  conditions:
    - type: Initialized
      status: 'True'
      lastProbeTime: null
      lastTransitionTime: '2022-12-16T13:54:49Z'
    - type: Ready
      status: 'False'
      lastProbeTime: null
      lastTransitionTime: '2022-12-16T13:54:49Z'
      reason: ContainersNotReady
      message: 'containers with unready status: [rule-tool-frontend2]'
    - type: ContainersReady
      status: 'False'
      lastProbeTime: null
      lastTransitionTime: '2022-12-16T13:54:49Z'
      reason: ContainersNotReady
      message: 'containers with unready status: [rule-tool-frontend2]'
    - type: PodScheduled
      status: 'True'
      lastProbeTime: null
      lastTransitionTime: '2022-12-16T13:54:49Z'
  hostIP: **.***.*.*
  podIP: **.***.*.*
  podIPs:
    - ip: **.***.*.*
  startTime: '2022-12-16T13:54:49Z'
  containerStatuses:
    - name: rule-tool-frontend2
      state:
        waiting:
          reason: ImagePullBackOff
          message: >-
            Back-off pulling image
            "image-registry.openshift-image-registry.svc:5000/rule-tool-webapp2/rule-tool-frontend2:latest"
      lastState: {}
      ready: false
      restartCount: 0
      image: >-
        image-registry.openshift-image-registry.svc:5000/rule-tool-webapp2/rule-tool-frontend2:latest
      imageID: ''
      started: false
  qosClass: BestEffort

package.json is located in rule_tool_frontend/src, how do I change where NPM is looking for package.json? Is this something that should be edited in the build YAML?

Thank you for any help.

Tried to complete the Openshift S2I build using NodeJS builder image, expecting a successful build. Got the described error instead.


问:
How to send a transaction with MethodID
I am trying to send a transaction using the MethodID which I am getting in metamask.

What is the request? How can I send a transaction of this kind - via web3 python.

enter image description hereenter image description here

From what I did:

```<code>some_contract_address = Web3.toChecksumAddress('0x10ed43c718714eb63d5aa57b78b54704e256024e')

dict_transaction = {
    'chainId': web3.eth.chain_id,
    'gas': 60000,
    'gasPrice': web3.eth.gas_price,
    'nonce': web3.eth.getTransactionCount(receiver),
}

approve_amount = 2 ** 256 - 1

print(contract.all_functions())

transaction = contract.functions.approve(
    some_contract_address, approve_amount
).buildTransaction(dict_transaction)

signed_txn = web3.eth.account.signTransaction(transaction, private_key_donor)

txn_hash = web3.eth.sendRawTransaction(signed_txn.rawTransaction)
</code>```

I tried to repeat the approve principle with this function (failed)
I tried to send tokens to the contract address using SWAP EXACT TOKENS FOR E T H. (success, but not quite what I need. I want to automate not only the swap, but any transaction sending knowing the contract address and bytes260 MethodID)

Title: How to send a transaction with MethodID

Body:
I am trying to send a transaction using the MethodID which I am getting in metamask.

What is the request? How can I send a transaction of this kind - via web3 python.

enter image description hereenter image description here

From what I did:

some_contract_address = Web3.toChecksumAddress('0x10ed43c718714eb63d5aa57b78b54704e256024e')

dict_transaction = {
    'chainId': web3.eth.chain_id,
    'gas': 60000,
    'gasPrice': web3.eth.gas_price,
    'nonce': web3.eth.getTransactionCount(receiver),
}

approve_amount = 2 ** 256 - 1

print(contract.all_functions())

transaction = contract.functions.approve(
    some_contract_address, approve_amount
).buildTransaction(dict_transaction)

signed_txn = web3.eth.account.signTransaction(transaction, private_key_donor)

txn_hash = web3.eth.sendRawTransaction(signed_txn.rawTransaction)

I tried to repeat the approve principle with this function (failed)
I tried to send tokens to the contract address using SWAP EXACT TOKENS FOR E T H. (success, but not quite what I need. I want to automate not only the swap, but any transaction sending knowing the contract address and bytes260 MethodID)


问:
How to download created PDF without @RequestMapping
I'm creating a PDF file with some info from a grid. In particular, the user selects from a grid an allele, all the info is displayed in a form that can be modified and then, when clicked on the button "save", all the modified info is stored in the database and a PDF with all the info is created.

I managed in creating it, but I don't understand how to download it.
Because of the structure of the project I cannot use the spring @RequestMapping since I want to trigger the download when clicking on a button and not when entering a specific URI.

Here's the code for the PDF, the function "createPDF" is called when the user click on the save button in the main view:

```<code>package eu.demo;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Date;

import com.vaadin.ui.Notification;

import eu.demo.model.Alleles;

import com.itextpdf.text.Anchor;
import com.itextpdf.text.BadElementException;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Chapter;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.List;
import com.itextpdf.text.ListItem;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.Section;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;

public class PDFCreator {

    private static Font catFont = new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD);
    private static Font redFont = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.RED);
    private static Font subFont = new Font(Font.FontFamily.TIMES_ROMAN, 16, Font.BOLD);
    private static Font smallBold = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);

    public static void createPDF(Alleles selected) {

        try {
            Paragraph preface = new Paragraph();

            Document doc = new Document();

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            //OutputStream outputStream = new FileOutputStream(new File("Test.pdf"));

            PdfWriter.getInstance(doc, baos);

            doc.open();
            doc.add(new Paragraph("Your allele info:\n", catFont));
            doc.add(new Paragraph(selected.getName()+"\n"));
            doc.add(new Paragraph(selected.getAllsForm()+"\n"));
            doc.add(new Paragraph(selected.getAlleleType()+"\n"));
            doc.add(new Paragraph(selected.getMgiRef()+"\n"));
            doc.add(new Paragraph("\n\n"));
            doc.close();

            //outputStream.close();
            baos.close();
            Notification.show("PDF created");

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
</code>```

Body:
I'm creating a PDF file with some info from a grid. In particular, the user selects from a grid an allele, all the info is displayed in a form that can be modified and then, when clicked on the button "save", all the modified info is stored in the database and a PDF with all the info is created.

I managed in creating it, but I don't understand how to download it.
Because of the structure of the project I cannot use the spring @RequestMapping since I want to trigger the download when clicking on a button and not when entering a specific URI.

Here's the code for the PDF, the function "createPDF" is called when the user click on the save button in the main view:

package eu.demo;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Date;

import com.vaadin.ui.Notification;

import eu.demo.model.Alleles;

import com.itextpdf.text.Anchor;
import com.itextpdf.text.BadElementException;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Chapter;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.List;
import com.itextpdf.text.ListItem;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.Section;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;

public class PDFCreator {

    private static Font catFont = new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD);
    private static Font redFont = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL, BaseColor.RED);
    private static Font subFont = new Font(Font.FontFamily.TIMES_ROMAN, 16, Font.BOLD);
    private static Font smallBold = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);

    public static void createPDF(Alleles selected) {

        try {
            Paragraph preface = new Paragraph();

            Document doc = new Document();

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            //OutputStream outputStream = new FileOutputStream(new File("Test.pdf"));

            PdfWriter.getInstance(doc, baos);

            doc.open();
            doc.add(new Paragraph("Your allele info:\n", catFont));
            doc.add(new Paragraph(selected.getName()+"\n"));
            doc.add(new Paragraph(selected.getAllsForm()+"\n"));
            doc.add(new Paragraph(selected.getAlleleType()+"\n"));
            doc.add(new Paragraph(selected.getMgiRef()+"\n"));
            doc.add(new Paragraph("\n\n"));
            doc.close();

            //outputStream.close();
            baos.close();
            Notification.show("PDF created");

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}


问:
How to tell entity framework to use different property not the primary key in order to join
I have two entities and I want to tell entity framework to use the field "OldGroupId" in order to join the two tables, but in the same time use Id as primary unique key</p>
```<code>    public class Group
    {
        [Key]
        public string Id{ get; set; }
        public string OldGroupId {get;set}
        public List<Department> Departments { get; set; }
    }

    public class Department
    {
        [Key]
        public string Id{ get; set; }
        public string GroupId{ get; set; }
        public Group Group{ get; set; }
    }
</code>```

Body:
I have two entities and I want to tell entity framework to use the field "OldGroupId" in order to join the two tables, but in the same time use Id as primary unique key

    public class Group
    {
        [Key]
        public string Id{ get; set; }
        public string OldGroupId {get;set}
        public List<Department> Departments { get; set; }
    }

    public class Department
    {
        [Key]
        public string Id{ get; set; }
        public string GroupId{ get; set; }
        public Group Group{ get; set; }
    }


问:
Limiting number of API call from each browser/client/machine
I have a publically exposed API, this is kind of a demo API.
I want to limit access from browser/client/machine to just 2 calls.

I was thinking to use IP to uniquely identify the client and limit it but CGNAT could be an issue so a lot of users can be denied the access if any one user under that IP uses it.

What are other way to achieve it?

API is in AWS.

Tried IP based solution but found CGNAT can be a issue.


问:
The following assertion was thrown while looking for parent data.: Incorrect use of ParentDataWidget
```<code>Widget build(
  BuildContext context, {
  WillHandleCTA? willHandleCTA,
}) {
  return super.embedChild(
    GestureDetector(
      child: Container(
        padding: EdgeInsets.all(8),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: WidgetUtility.spreadWidgets(
            [_getProductImageAndQuantity(), _getPriceView()],
            interItemSpace: 8,
          ),
        ),
      ),
    ),
    handleMarginPaddingBackground: true,
  );
}

Widget _getPriceView() {
  List<Widget> children = WidgetUtility.spreadWidgets(
    [
      _getTitle(
        productDetails.finalPrice,
        TextAlign.right,
        13,
      ),
    ],
    interItemSpace: 8,
  );
  bool hasProductImage = StringUtils.isValidString(productImageUrl);
  return Container(
    child: Expanded(
      flex: 5,
      child: hasProductImage ? Column(children: children) : Row(children: children),
    ),
  );
}

Widget _getProductImageAndQuantity() {
  return Expanded(
    flex: 6,
    child: Row(
      children: WidgetUtility.spreadWidgets(
        [
          if (StringUtils.isValidString(productImageUrl)) _getIconView(productImageUrl!),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Row(
                  children: [
                    if (StringUtils.isValidString(productName)) _getTitle(productName!, TextAlign.left, 14),
                    if (StringUtils.isValidString(sku)) _getTitle(sku!, TextAlign.left, 14),
                  ],
                ),
                if (StringUtils.isValidString(productDetails.currentSelectedQuantity.toString())) _getTitle(productDetails.currentSelectedQuantity.toString(), TextAlign.left, 14),
              ],
            ),
          ),
        ],
        interItemSpace: 4,
      ),
    ),
  );
}

Widget _getIconView(String icon) {
  return Container(
    height: _ICON_SIZE,
    width: _ICON_SIZE,
    child: GenericImage.icon(
      path: icon,
      fit: BoxFit.cover,
      placeholder: Image.asset(
        StaticAssets.images.icGenericImagePlaceholder,
        fit: BoxFit.contain,
      ),
    ),
  );
}

Widget _getTitle(
  String title,
  TextAlign textAlign,
  double fontSize,
) {
  return TextUtility.customText(
    title,
    TextStyles.subtitleTextStyle as CustomTextStyle,
    textAlign: textAlign,
  );
}
</code>```

I am new to flutter and unable to identify the issue here.
Below is the detailed stack trace

The following ParentDataWidgets are providing parent data to the same RenderObject:

Flexible(flex: 1) (typically placed directly inside a Flex widget)

Expanded(flex: 100) (typically placed directly inside a Flex widget)
However, a RenderObject can only receive parent data from at most one ParentDataWidget.

Usually, this indicates that at least one of the offending ParentDataWidgets listed above is not placed directly inside a compatible ancestor widget.

The ownership chain for the RenderObject that received the parent data was:
ConstrainedBox ← Container ← Flexible ← AppButton ← AFSAppButton ← ViewInflator ← Expanded ← Row ← ConstrainedBox ← Container ← ⋯
When the exception was thrown, this was the stack:
#0      RenderObjectElement._findAncestorParentDataElement. (package:flutter/src/widgets/framework.dart:5715:11)

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

Body:
Widget build(
  BuildContext context, {
  WillHandleCTA? willHandleCTA,
}) {
  return super.embedChild(
    GestureDetector(
      child: Container(
        padding: EdgeInsets.all(8),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: WidgetUtility.spreadWidgets(
            [_getProductImageAndQuantity(), _getPriceView()],
            interItemSpace: 8,
          ),
        ),
      ),
    ),
    handleMarginPaddingBackground: true,
  );
}

Widget _getPriceView() {
  List<Widget> children = WidgetUtility.spreadWidgets(
    [
      _getTitle(
        productDetails.finalPrice,
        TextAlign.right,
        13,
      ),
    ],
    interItemSpace: 8,
  );
  bool hasProductImage = StringUtils.isValidString(productImageUrl);
  return Container(
    child: Expanded(
      flex: 5,
      child: hasProductImage ? Column(children: children) : Row(children: children),
    ),
  );
}

Widget _getProductImageAndQuantity() {
  return Expanded(
    flex: 6,
    child: Row(
      children: WidgetUtility.spreadWidgets(
        [
          if (StringUtils.isValidString(productImageUrl)) _getIconView(productImageUrl!),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Row(
                  children: [
                    if (StringUtils.isValidString(productName)) _getTitle(productName!, TextAlign.left, 14),
                    if (StringUtils.isValidString(sku)) _getTitle(sku!, TextAlign.left, 14),
                  ],
                ),
                if (StringUtils.isValidString(productDetails.currentSelectedQuantity.toString())) _getTitle(productDetails.currentSelectedQuantity.toString(), TextAlign.left, 14),
              ],
            ),
          ),
        ],
        interItemSpace: 4,
      ),
    ),
  );
}

Widget _getIconView(String icon) {
  return Container(
    height: _ICON_SIZE,
    width: _ICON_SIZE,
    child: GenericImage.icon(
      path: icon,
      fit: BoxFit.cover,
      placeholder: Image.asset(
        StaticAssets.images.icGenericImagePlaceholder,
        fit: BoxFit.contain,
      ),
    ),
  );
}

Widget _getTitle(
  String title,
  TextAlign textAlign,
  double fontSize,
) {
  return TextUtility.customText(
    title,
    TextStyles.subtitleTextStyle as CustomTextStyle,
    textAlign: textAlign,
  );
}

I am new to flutter and unable to identify the issue here.
Below is the detailed stack trace

The following ParentDataWidgets are providing parent data to the same RenderObject:

Flexible(flex: 1) (typically placed directly inside a Flex widget)

Expanded(flex: 100) (typically placed directly inside a Flex widget)
However, a RenderObject can only receive parent data from at most one ParentDataWidget.

Usually, this indicates that at least one of the offending ParentDataWidgets listed above is not placed directly inside a compatible ancestor widget.

The ownership chain for the RenderObject that received the parent data was:
ConstrainedBox ← Container ← Flexible ← AppButton ← AFSAppButton ← ViewInflator ← Expanded ← Row ← ConstrainedBox ← Container ← ⋯
When the exception was thrown, this was the stack:
#0      RenderObjectElement._findAncestorParentDataElement. (package:flutter/src/widgets/framework.dart:5715:11)


问:
Question about Angular Library dependencies
I have made an angular library (in Angular 12.2.12) which is importing CSS files from node_modules, but when I use it on my application, I got this error:

```<code>GET http://localhost:60435/~@progress/kendo-theme-material/dist/all.css
</code>```

Here is the structure of my workspace:

```<code> | - root
    | - common-libraries
        | - node_modules
            | - @progress
                - [...]
        | - projects
            | - my-library
                | - src
                    | - assets
                        | - style.css // Compiled css file from below
                | - styles.scss // This file is importing all files from common-libraries/src/sass
        | - src
            | - sass
                | - overrided
                    | - override_progress.scss // This file is importing css file from common-libraries/node_modules
                | - file1.scss
                | - file2.scss
                | - file3.scss

    | -  front-app
        | - node_modules
            | - my-library
        | - src
            | - sass
                | - styles.scss // This file is importing ~my-library/
</code>```

I'd like to import a CSS file from common-libraries/node_modules, something like common-libraries/node_modules/@progress/kendo-theme-material/dist/all.css. How should I do it ?

In front-app/src/sass/styles.scss, I'm importing ~my-lib/src/assets/style.css, which leads to the error above

Body:
I have made an angular library (in Angular 12.2.12) which is importing CSS files from node_modules, but when I use it on my application, I got this error:

GET http://localhost:60435/~@progress/kendo-theme-material/dist/all.css

Here is the structure of my workspace:

 | - root
    | - common-libraries
        | - node_modules
            | - @progress
                - [...]
        | - projects
            | - my-library
                | - src
                    | - assets
                        | - style.css // Compiled css file from below
                | - styles.scss // This file is importing all files from common-libraries/src/sass
        | - src
            | - sass
                | - overrided
                    | - override_progress.scss // This file is importing css file from common-libraries/node_modules
                | - file1.scss
                | - file2.scss
                | - file3.scss

    | -  front-app
        | - node_modules
            | - my-library
        | - src
            | - sass
                | - styles.scss // This file is importing ~my-library/

I'd like to import a CSS file from common-libraries/node_modules, something like common-libraries/node_modules/@progress/kendo-theme-material/dist/all.css. How should I do it ?

In front-app/src/sass/styles.scss, I'm importing ~my-lib/src/assets/style.css, which leads to the error above


问:
elastic exporter - connection refused
trying to set up elastic exporter for a local stack :
https://github.com/prometheus-community/elasticsearch_exporter

I get a connection refused when running with a docker even when xpack security is disabled.

```<code>xpack.license.self_generated.type: basic
xpack.security.enabled: false
xpack.monitoring.collection.enabled: true
xpack.monitoring.exporters.my_local_exporter:
  type: local

bootstrap.memory_lock: true
search.allow_expensive_queries: true
indices.memory.index_buffer_size: 30%
</code>```

I use elastic 8.1.2 :

```<code>{
  "name" : "0a166124ca20",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "xxxxxxxxxxxxxxx",
  "version" : {
    "number" : "8.1.2",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "xxxxxxxxxxxxxxx",
    "build_date" : "2022-03-29T21:18:59.991429448Z",
    "build_snapshot" : false,
    "lucene_version" : "9.0.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}
</code>```

I get limited amount of metrics but missing the majoriy
for example --> elasticsearch_node_stats_up 0

here is my docker-compose:

```<code>elasticsearch_exporter:
    image: quay.io/prometheuscommunity/elasticsearch-exporter:latest
    command:
    - '--es.uri=http://localhost:9200'
    - '--es.ssl-skip-verify'
    - '--es.all'
    restart: always
    environment:
    - 'ES_API_KEY=Apikey xxxxxxxxxx'
    ports:
    - "9114:9114"
</code>```

Title: elastic exporter - connection refused

Body:
trying to set up elastic exporter for a local stack :
https://github.com/prometheus-community/elasticsearch_exporter

I get a connection refused when running with a docker even when xpack security is disabled.

xpack.license.self_generated.type: basic
xpack.security.enabled: false
xpack.monitoring.collection.enabled: true
xpack.monitoring.exporters.my_local_exporter:
  type: local

bootstrap.memory_lock: true
search.allow_expensive_queries: true
indices.memory.index_buffer_size: 30%

I use elastic 8.1.2 :

{
  "name" : "0a166124ca20",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "xxxxxxxxxxxxxxx",
  "version" : {
    "number" : "8.1.2",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "xxxxxxxxxxxxxxx",
    "build_date" : "2022-03-29T21:18:59.991429448Z",
    "build_snapshot" : false,
    "lucene_version" : "9.0.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

I get limited amount of metrics but missing the majoriy
for example --> elasticsearch_node_stats_up 0

here is my docker-compose:

elasticsearch_exporter:
    image: quay.io/prometheuscommunity/elasticsearch-exporter:latest
    command:
    - '--es.uri=http://localhost:9200'
    - '--es.ssl-skip-verify'
    - '--es.all'
    restart: always
    environment:
    - 'ES_API_KEY=Apikey xxxxxxxxxx'
    ports:
    - "9114:9114"


问:
No vertical scrollbar in react-tabulator, even the height is set to fixed value
I'm using tabulator in a plain HTML/Javascript website with thousands of rows. The virtual DOM ist great and as I have set the height of the table, I have the vertical scrollbar inside the table.

Now I want to redesign the website using React. From the documentation I've found the React component of tabulator but there is no vertical scrollbar, even when I set the height (as descriped in documentation).

Here is the code of my minimal working example (see it on Codesandbox):

import React from "react";
import { render } from "react-dom";

import "react-tabulator/lib/styles.css"; // default theme
import "react-tabulator/css/bootstrap/tabulator_bootstrap.min.css"; // use Theme(s)
import { ReactTabulator } from "react-tabulator";

const columns = [{ title: "Name", field: "name" }];
const data = ["A", "B", "C", "D", "E", "F", "G"].map((e) => {
  return { name: e };
});
const options = {
  height: 150
};

const BasicExample = () => {
  return (

      <ReactTabulator columns={columns} data={data} options={options} />

  );
};

render(<BasicExample />, document.getElementById("root"));
```

I've tried to set the height of parent div element or using style attribute. I've also changed  data or options to redraw the table -> but no vertical scrollbar :-/

Any ideas?

Body:
I'm using tabulator in a plain HTML/Javascript website with thousands of rows. The virtual DOM ist great and as I have set the height of the table, I have the vertical scrollbar inside the table.

Now I want to redesign the website using React. From the documentation I've found the React component of tabulator but there is no vertical scrollbar, even when I set the height (as descriped in documentation).

Here is the code of my minimal working example (see it on Codesandbox):

import React from "react";
import { render } from "react-dom";

import "react-tabulator/lib/styles.css"; // default theme
import "react-tabulator/css/bootstrap/tabulator_bootstrap.min.css"; // use Theme(s)
import { ReactTabulator } from "react-tabulator";

const columns = [{ title: "Name", field: "name" }];
const data = ["A", "B", "C", "D", "E", "F", "G"].map((e) => {
  return { name: e };
});
const options = {
  height: 150
};

const BasicExample = () => {
  return (

      <ReactTabulator columns={columns} data={data} options={options} />

  );
};

render(<BasicExample />, document.getElementById("root"));

I've tried to set the height of parent div element or using style attribute. I've also changed  data or options to redraw the table -> but no vertical scrollbar :-/

Any ideas?