问:
Problem with I2C communication with sensor TSL2572 and the board STM32L152C-DISCOVERY
I'm trying to communicate between board and sensor with i2c but I can't quite figure out how to do it. in the datasheet i checked all the registers and how to access them and the address of the sensor. once this was done I retrieved the HAL_I2C_Mem_Write and HAL_I2C_Mem_Read functions from the HAL library for reading and configuration. for example, to enable the sensor clock and make the ADC work I have to write raise the last two bits of the byte of the register 0x00, so I wrote the following line:

buf[0]=0x03;

HAL_I2C_Mem_Write(&i2c2, address, 0x00, 1, buf, 1, 1000);

then when I go to read the register with HAL_I2C_Mem_Read I get the value 0. the same goes for the others, for example if I read the register 0x12 I get the decimal value of 0x12 and not its content. Where am I doing wrong?

I add that I have checked the correctness of the hardware connections between the card and the sensor.


来源: stackexchange

问:
Deprecation warning: `np.float` is a deprecated alias for the builtin `float`

Does anyone know why when I convert to float, X is still called as numpy.float as it is giving me deprecation issues when I try to run X through the elbow method for K-Means Clustering

ContentLicense: CC BY-SA 4.0


问:
How can I have in an datagridcomboboxcolumn get the Checked value of each seperate Combobox?
I have an an DataGrid in which I load Data from an ObservableCollection and each row has an CheckBox so that I can have a list of checked Rows. Now I wanted to add an new Column to the DataGrid which is an ComboBox and in the ComboBox is a list with Checkboxen. I want for each row that when I check one Row and then when I check other Items from the ComboBox that I can combine the selected row and the selected values from my ComboBox.

The problem is that if I check one Row of the Combobox item it will check for every other ComboBox that appears in the DataGrid.

I want only to check the value of the combobox for one row and combine it with the Value of the checked row of the datagrid.

Here is my Code of my DataGrid:

```<code> <DataGrid  Style="{DynamicResource DataGridStyle}"
                       Margin="10"  SelectionUnit="CellOrRowHeader"  AutoGenerateColumns="False"
                       CanUserAddRows="False" CanUserDeleteRows="False" SelectionMode="Single"  VerticalAlignment="Stretch"
                       x:Name="SpaltenGrid" ItemsSource="{Binding bischenanders, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
                       GridLinesVisibility="None"  ScrollViewer.CanContentScroll="True"
                       ScrollViewer.VerticalScrollBarVisibility="Auto"
                       ScrollViewer.HorizontalScrollBarVisibility="Auto">
                        <DataGrid.Columns >
                            <DataGridCheckBoxColumn x:Name="selectedField" Binding="{Binding IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Header="Auswahl" CanUserSort="False">
                                <DataGridCheckBoxColumn.ElementStyle>
                                    <Style TargetType="CheckBox" BasedOn="{StaticResource {x:Type CheckBox}}" />
                                </DataGridCheckBoxColumn.ElementStyle>
                            </DataGridCheckBoxColumn>

                            <DataGridTextColumn  Header="Spaltenname"  Binding="{Binding Spaltenname}" Width="1.5*"/>

                            <DataGridComboBoxColumn x:Name="cmbAdditionColume"   Header="AdditionsSpalten" DisplayMemberPath="Spaltenname"
                                                    CanUserSort="False" Width="*">

                                <DataGridComboBoxColumn.ElementStyle>

                                    <Style TargetType="ComboBox"  BasedOn="{StaticResource ComboBoxStyle1 }"  />
                                </DataGridComboBoxColumn.ElementStyle>

                            </DataGridComboBoxColumn>

                            <!--<DataGridTemplateColumn Header="Week Days" Width="*" x:Name="cmbTemplateColumn">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <ComboBox x:Name="cmbAdditionColume" Foreground="Black"
                                                  DisplayMemberPath="Spaltenname" Style="{StaticResource ComboBoxStyle1}"/>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>-->

                        </DataGrid.Columns>

                        <DataGrid.Resources>
                            <!-- Select everything with orange... -->
                            <SolidColorBrush
    Color="Transparent"
    x:Key="{x:Static SystemColors.HighlightBrushKey}" />
                            <!-- ...all the time -->
                            <SolidColorBrush
    Color="Transparent"
    x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" />
                            <!--Design kopfzeile-->
                            <Style TargetType="{x:Type DataGridColumnHeader}" x:Name="test2" >
                                <Setter Property="Background" Value="Red"/>
                                <Setter Property="Foreground" Value="Black"/>
                                <Setter Property="FontWeight" Value="SemiBold"/>
                                <Setter Property="Height" Value="30"/>
                                <Setter Property="FontSize" Value="15"/>
                                <Setter Property="BorderThickness" Value="0" />
                                <Setter Property="BorderBrush" Value="Green"/>
                                <Setter Property="Padding" Value="10 0 0 0"/>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
                                            <Grid x:Name="insideHeader" Background="Transparent">
                                                <Border x:Name="borderHeader" BorderThickness="0"
                                        CornerRadius="10"
                                        Background="White"
                                        Padding="10,0,0,0"
                                        >
                                                    <ContentPresenter />
                                                </Border>
                                                <!--<Thumb HorizontalAlignment="Right"
                           Grid.Column="1"
                           Name="PART_HeaderGripper"
                           Margin="0,4,0,4"
                           Width="2"/>-->
                                            </Grid>

                                            <ControlTemplate.Triggers>
                                                <Trigger Property="IsMouseOver" Value="True">
                                                    <Setter  Property="Foreground" Value="{DynamicResource PrimaryBlueColor}"/>
                                                </Trigger>
                                                <Trigger Property="IsPressed" Value="True">
                                                    <Setter TargetName="borderHeader" Property="Background" Value="{DynamicResource SecundaryGrayColor}"/>
                                                </Trigger>
                                            </ControlTemplate.Triggers>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>

                            <Style TargetType="{x:Type DataGridRowHeader}">
                                <Setter Property="Content" Value=">" />
                                <Setter Property="Foreground" Value="{DynamicResource PrimaryBlueColor}" />
                                <Setter Property="FontWeight" Value="Bold"/>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type DataGridRowHeader}">
                                            <Grid x:Name="insideHeader" Background="Transparent">
                                                <Border x:Name="borderHeader" BorderThickness="0"
                                        CornerRadius="2"
                                        Background="White"
                                        Padding="0,10,0,0"
                                        >
                                                    <TextBlock Text=">" FontSize="12" VerticalAlignment="Top" Margin="0 0 0 0" TextAlignment="Center" FontWeight="Bold" Width="20" Foreground="{DynamicResource PrimaryBlueColor}" />

                                                </Border>
                                            </Grid>

                                            <ControlTemplate.Triggers>
                                                <Trigger Property="IsMouseOver" Value="True" >
                                                    <Setter TargetName="borderHeader" Property="Background" Value="{DynamicResource PrimaryGrayColor}"/>
                                                </Trigger>
                                                <Trigger Property="IsPressed" Value="True">
                                                    <Setter TargetName="borderHeader" Property="Background" Value="{DynamicResource SecundaryGrayColor}"/>
                                                </Trigger>
                                            </ControlTemplate.Triggers>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>

                            </Style>

                            <!--Deaktivieren Des rowheader
                    <Style TargetType="{x:Type DataGridRowHeader}">
                        <Setter Property="Background" Value="Transparent"/>
                    </Style>-->

                            <!--Cellen Design-->
                            <Style TargetType="{x:Type DataGridCell}">
                                <Setter Property="Background" Value="Transparent"/>
                                <Setter Property="Foreground" Value="Black"/>
                                <Setter Property="FontFamily" Value="sans-serif"/>
                                <Setter Property="BorderThickness" Value="0" />
                                <Setter Property="BorderBrush" Value="#333333"/>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type DataGridCell}">
                                            <Border x:Name="insideBorder" Background="Transparent" BorderThickness="0 2 0 1" BorderBrush="#dddddd">
                                                <Border x:Name="BorderCell" BorderThickness="0"
                                        CornerRadius="6"
                                        Background="White"
                                        Padding="8,5,0,5"
                                        Margin="2">
                                                    <ContentPresenter/>
                                                </Border>
                                            </Border>
                                            <ControlTemplate.Triggers>
                                                <Trigger Property="IsMouseOver" Value="True">
                                                    <Setter  Property="Foreground" Value="{DynamicResource PrimaryBlueColor}"/>
                                                </Trigger>
                                            </ControlTemplate.Triggers>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </DataGrid.Resources>

                    </DataGrid>
</code>```

my itemtemplate of my ComboBox:

```<code> <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <CheckBox IsChecked="{Binding Path=cmbIsChecked, Mode=TwoWay}" Width="20"/>
                        <TextBlock Text="{Binding Path=Spaltenname}" VerticalAlignment="Center" />
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>
</code>```

my "bischenanders" collection (sry for that bad name I will fix that in the future)

my outputColumns class:

```<code>public class OutputColumns
{
    public string Spaltenname{ get; set; }
    public bool IsChecked { get; set; }

    public bool cmbIsChecked { get; set; }

}
</code>```

}

thats the way I read the selected Items for the rows and for the Combobox rows

```<code> public List<OutputColumns> GetSelectedItems()
    {
        var selectedItems = new List<OutputColumns>();

        foreach (OutputColumns item in View.bischenanders)
        {
            try
            {
                if (item.IsChecked)
                {
                    selectedItems.Add(item);
                }
            }
            catch
            {

            }
        }
        return selectedItems;
    }

    public List<OutputColumns> cmbGetSelectedItems()
    {

        var selectedItems = new List<OutputColumns>();

        foreach (OutputColumns item in View.bischenanders)
        {
            try
            {
                if (item.cmbIsChecked)
                {
                    selectedItems.Add(item);
                }
            }
            catch
            {

            }
        }
        return selectedItems;
    }
</code>```

So that If this row is checked:

Picture

and in the combobox that 2 rows are checked:

Picture2

then I want that these 3 values are getting Combined

but when I check in one CombobBox every combobox in the DataGrid has the same checked Values

It looks like that every time I open a new ComboBox he getting the data from the class and then there will the programm find a version where it is checked, because ComboBoxs I already have open get there own checked values, only the new ones getting the checked one that are checked in the previous checkbox.

Thanks for help!

Body:
I have an an DataGrid in which I load Data from an ObservableCollection and each row has an CheckBox so that I can have a list of checked Rows. Now I wanted to add an new Column to the DataGrid which is an ComboBox and in the ComboBox is a list with Checkboxen. I want for each row that when I check one Row and then when I check other Items from the ComboBox that I can combine the selected row and the selected values from my ComboBox.

The problem is that if I check one Row of the Combobox item it will check for every other ComboBox that appears in the DataGrid.

I want only to check the value of the combobox for one row and combine it with the Value of the checked row of the datagrid.

Here is my Code of my DataGrid:

 <DataGrid  Style="{DynamicResource DataGridStyle}"
                       Margin="10"  SelectionUnit="CellOrRowHeader"  AutoGenerateColumns="False"
                       CanUserAddRows="False" CanUserDeleteRows="False" SelectionMode="Single"  VerticalAlignment="Stretch"
                       x:Name="SpaltenGrid" ItemsSource="{Binding bischenanders, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
                       GridLinesVisibility="None"  ScrollViewer.CanContentScroll="True"
                       ScrollViewer.VerticalScrollBarVisibility="Auto"
                       ScrollViewer.HorizontalScrollBarVisibility="Auto">
                        <DataGrid.Columns >
                            <DataGridCheckBoxColumn x:Name="selectedField" Binding="{Binding IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Header="Auswahl" CanUserSort="False">
                                <DataGridCheckBoxColumn.ElementStyle>

                        </DataGrid.Resources>

                    </DataGrid>

my itemtemplate of my ComboBox:

 <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <CheckBox IsChecked="{Binding Path=cmbIsChecked, Mode=TwoWay}" Width="20"/>
                        <TextBlock Text="{Binding Path=Spaltenname}" VerticalAlignment="Center" />
                    </StackPanel>
                </DataTemplate>
            </Setter.Value>
        </Setter>

my "bischenanders" collection (sry for that bad name I will fix that in the future)

my outputColumns class:

public class OutputColumns
{
    public string Spaltenname{ get; set; }
    public bool IsChecked { get; set; }

    public bool cmbIsChecked { get; set; }

}

}

thats the way I read the selected Items for the rows and for the Combobox rows

 public List<OutputColumns> GetSelectedItems()
    {
        var selectedItems = new List<OutputColumns>();

        foreach (OutputColumns item in View.bischenanders)
        {
            try
            {
                if (item.IsChecked)
                {
                    selectedItems.Add(item);
                }
            }
            catch
            {

            }
        }
        return selectedItems;
    }

    public List<OutputColumns> cmbGetSelectedItems()
    {

        var selectedItems = new List<OutputColumns>();

        foreach (OutputColumns item in View.bischenanders)
        {
            try
            {
                if (item.cmbIsChecked)
                {
                    selectedItems.Add(item);
                }
            }
            catch
            {

            }
        }
        return selectedItems;
    }

So that If this row is checked:

Picture

and in the combobox that 2 rows are checked:

Picture2

then I want that these 3 values are getting Combined

but when I check in one CombobBox every combobox in the DataGrid has the same checked Values

It looks like that every time I open a new ComboBox he getting the data from the class and then there will the programm find a version where it is checked, because ComboBoxs I already have open get there own checked values, only the new ones getting the checked one that are checked in the previous checkbox.

Thanks for help!


问:
Script to add secondary mail accounts
I would like to realize a PowerShell script which add additional generic IMAP/SMTP mail account(s), ie manually adding credentials, server names, ports, security methods, etc.

Such script should be "client-agnostic", so add the above informations onto MSOutlook or WindowsMail or ThunderBird depending on what desktop client is locally installed.

Currently I haven't found any module/cmdlet yet, but only codes specific for Exchange or MAPI such Gmail.

Title: Script to add secondary mail accounts


问:
Go: can't receive syscall.SIGINT in for select loop
I tried to catch the interrupt signal to stop the program, but in the for-select loop, Even if the program is stopped, the default branch will continue to be entered.The code show as below:

```<code>func main() {
    c := make(chan os.Signal)
    signal.Notify(c, os.Interrupt)
    for {
        select {
        case signal := <-c:
            {
                fmt.Println("receive signal", signal)
                os.Exit(0)
            }
        default:
        }
    }
}
</code>```

One solution is to add a buffer to c, like:

```<code>c := make(chan os.Signal,1)
</code>```

But I don't know why it works.

In addition, I tried to delete the default branch and replace it with no-block branchs.And c remains without buffer

```<code>c := make(chan os.Signal)
signal.Notify(c, os.Interrupt)
select {
        case signal := <- c:
            fmt.Println("receive signal", signal)
            buffer.Flush()
            os.Exit(0)
        case b := <- bodyChannel:
            w, _ := json.Marshal(b)
            buffer.Write(w)
            buffer.WriteString("\n")
        case <- t.C:
            fmt.Println("flush")
            err := buffer.Flush()
            if err != nil {
                fmt.Println("flush err", err.Error())
            }
            t.Reset(time.Second* 1)
}
</code>```

One of the other two branches is to continuously read data from a channel and write it to a file, and the other is to flush regularly.
In this scenario, the stop signal can be caught without the buffer. What is the difference between these two scenarios? and when buffers are needed?

Body:
I tried to catch the interrupt signal to stop the program, but in the for-select loop, Even if the program is stopped, the default branch will continue to be entered.The code show as below:

func main() {
    c := make(chan os.Signal)
    signal.Notify(c, os.Interrupt)
    for {
        select {
        case signal := <-c:
            {
                fmt.Println("receive signal", signal)
                os.Exit(0)
            }
        default:
        }
    }
}

One solution is to add a buffer to c, like:

c := make(chan os.Signal,1)

But I don't know why it works.

In addition, I tried to delete the default branch and replace it with no-block branchs.And c remains without buffer

c := make(chan os.Signal)
signal.Notify(c, os.Interrupt)
select {
        case signal := <- c:
            fmt.Println("receive signal", signal)
            buffer.Flush()
            os.Exit(0)
        case b := <- bodyChannel:
            w, _ := json.Marshal(b)
            buffer.Write(w)
            buffer.WriteString("\n")
        case <- t.C:
            fmt.Println("flush")
            err := buffer.Flush()
            if err != nil {
                fmt.Println("flush err", err.Error())
            }
            t.Reset(time.Second* 1)
}

One of the other two branches is to continuously read data from a channel and write it to a file, and the other is to flush regularly.
In this scenario, the stop signal can be caught without the buffer. What is the difference between these two scenarios? and when buffers are needed?


问:
Trouble passing eventcallback to component which inherits InputBase<TValue>
I am developing a custom select component which is inherited from, InputBase as follows:

Index.razor:

```<code><Select Id="InvestmentEntity"
    OnSelected="@OnInvestmentEntitySelect"
</Select>
</code>```

Index.razor.cs

```<code>public void OnInvestmentEntitySelect(Select<int> sender)
{
    // .. do something later
}
</code>```

Select.razor.cs

```<code>namespace Accounting.Web.Components.Forms
{
    public partial class Select<TValue> : InputBase<TValue>
    {
        [Parameter]
        public EventCallback<Select<TValue>> OnSelected { get; set; } = default!;

        protected override bool TryParseValueFromString(string? value, [MaybeNullWhen(false)] out TValue result, [NotNullWhen(false)] out string? validationErrorMessage)
        {
            if (BindConverter.TryConvertTo<TValue>(value, null, out result))
            {
                validationErrorMessage = "";
                return true;
            }
            else
            {
                validationErrorMessage = "Err : Select value";
                return false;
            }
        }

        public void OnSelect(SelectOption? option)
        {
            OnSelected.InvokeAsync(this);
        }

    }
}
</code>```

As you can see I am attempting to pass a callback event via the component tag (OnSelected) which is invoked the Select.razor.cs file.  However the compiler is returning the following error in relation to this line:

```<code>OnSelected="@OnInvestmentEntitySelect"
</code>```

Error:

Argument 2: cannot convert from 'method group' to 'EventCallback'

If I try the following, I get a different error:

```<code>OnSelected="@(() => OnInvestmentEntitySelect)"
</code>```

Errors:

```<code>Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
'OnInvestmentEntitySelect' to non-delegate type 'Task'. Did you intend to invoke the method?
Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type
</code>```

How can I pass the method to the even callback parameter so that it is called when invoked by the component in the scenario above?  My objective is to pass the reference of the instance of the component which invoked the event back as a parameter to the callback method in the parent page

Body:
I am developing a custom select component which is inherited from, InputBase as follows:

Index.razor:

<Select Id="InvestmentEntity"
    OnSelected="@OnInvestmentEntitySelect"
</Select>

Index.razor.cs

public void OnInvestmentEntitySelect(Select<int> sender)
{
    // .. do something later
}

Select.razor.cs

namespace Accounting.Web.Components.Forms
{
    public partial class Select<TValue> : InputBase<TValue>
    {
        [Parameter]
        public EventCallback<Select<TValue>> OnSelected { get; set; } = default!;

        protected override bool TryParseValueFromString(string? value, [MaybeNullWhen(false)] out TValue result, [NotNullWhen(false)] out string? validationErrorMessage)
        {
            if (BindConverter.TryConvertTo<TValue>(value, null, out result))
            {
                validationErrorMessage = "";
                return true;
            }
            else
            {
                validationErrorMessage = "Err : Select value";
                return false;
            }
        }

        public void OnSelect(SelectOption? option)
        {
            OnSelected.InvokeAsync(this);
        }

    }
}

As you can see I am attempting to pass a callback event via the component tag (OnSelected) which is invoked the Select.razor.cs file.  However the compiler is returning the following error in relation to this line:

OnSelected="@OnInvestmentEntitySelect"

Error:

Argument 2: cannot convert from 'method group' to 'EventCallback'

If I try the following, I get a different error:

OnSelected="@(() => OnInvestmentEntitySelect)"

Errors:

Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
'OnInvestmentEntitySelect' to non-delegate type 'Task'. Did you intend to invoke the method?
Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type

How can I pass the method to the even callback parameter so that it is called when invoked by the component in the scenario above?  My objective is to pass the reference of the instance of the component which invoked the event back as a parameter to the callback method in the parent page


问:
Two one-to-many relationship with abstract class
I'm not sure whether or not my logic and implementation is correct and won't have any issues. The potential problem is the following: I have an abstract class, Classifier, which has two concrete classes: ToolClassifier and ManualClassifier:

```<code>[Table("Classifiers")] //TPT Inheritance
public abstract class Classifier
{
    [Column(name: "classifier_id")]
    public int Id { get; set; }
    [Column(name: "date_added")]
    public DateTime DateAdded { get; set; }
    public ICollection<ClassifierVulnWeight> ClassifierVulnWeight { get; set; } = null!;
}

[Table("ToolClassifiers")] //TPT Inheritance
public class ToolClassifier : Classifier
{
    [Column(name: "tool_name")]
    public string ToolName { get; set; } = null!;
    [Column(name: "tool_acronym")]
    public string ToolAcronym { get; set; } = null!;
    [Column(name: "tool_url")]
    public string ToolURL { get; set; } = null!;

}

[Table("ManualClassifiers")] //TPT Inheritance
public class ManualClassifier : Classifier
{
    [Column(name: "first_name")]
    public string FirstName { get; set; } = null!;
    [Column(name: "label_name")]
    public string LastName { get; set; } = null!;
    [Column(name: "email")]
    public string Email { get; set; } = null!;
    [Column(name: "username")]
    public string Username { get; set; } = null!;
    [Column(name: "passwordHash")]
    public string PasswordHash { get; set; } = null!;
    [Column(name: "passwordSalt")]
    public string PasswordSalt { get; set; } = null!;
}
</code>```

The Classifier establishes a one-to-many relationship with the class ClassifierVulnWeight. The VulnerabilityClass also establishes a one-to-many relationship with the class ClassifierVulnWeight:

```<code>public class ClassifierVulnWeight
{
    [Column(name: "classifier_id")]
    public int ClassifierId { get; set; }
    public Classifier Classifier { get; set; } = null!;

    [Column(name: "vuln_class_id")]
    public int VulnerabilityClassId { get; set; }
    public VulnerabilityClass VulnerabilityClass { get; set; } = null!;

    [Column(name: "last_update")]
    public DateTime LastUpdate { get; set; }
    [Column(name: "weight")]
    public double Weight { get; set; }
}

 public class VulnerabilityClass
{
    [Column(name: "vuln_class_id")]
    public int Id { get; set; }
    [Column(name: "vuln_class_name")]
    public string VulnerabilityClassName { get; set; } = null!;
    [Column(name: "vuln_class_acronym")]
    public string VulnerabilityClassAcronym { get; set; } = null!;
    public ICollection<ClassifierVulnWeight> ClassifierVulnWeight { get; set; } = null!;

}
</code>```

The ClassifierVulnWight has a composite primary key, composed of the classifier Id and VulnClass Id, as shown below:

```<code>modelBuilder.Entity<ClassifierVulnWeight>()
            .HasKey(classifierVulnWeight => new
            {
                classifierVulnWeight.ClassifierId,
                classifierVulnWeight.VulnerabilityClassId
            });
</code>```

My question is the following: will I have any troubles when creating instances of ClassifierVulnWeight since I have the abstract class Classifier? This is because the obligation is in the Tool Classifier and Manual Classifier entities, i.e., there is no Classifier instance unless there is at least an instance of one of the two aforementioned.
I'm guessing that the ICollection property in the Classifier instance is inherited by both children and thus there will be no problem. Is my assumption correct? Thank you in advance.

Body:
I'm not sure whether or not my logic and implementation is correct and won't have any issues. The potential problem is the following: I have an abstract class, Classifier, which has two concrete classes: ToolClassifier and ManualClassifier:

[Table("Classifiers")] //TPT Inheritance
public abstract class Classifier
{
    [Column(name: "classifier_id")]
    public int Id { get; set; }
    [Column(name: "date_added")]
    public DateTime DateAdded { get; set; }
    public ICollection<ClassifierVulnWeight> ClassifierVulnWeight { get; set; } = null!;
}

[Table("ToolClassifiers")] //TPT Inheritance
public class ToolClassifier : Classifier
{
    [Column(name: "tool_name")]
    public string ToolName { get; set; } = null!;
    [Column(name: "tool_acronym")]
    public string ToolAcronym { get; set; } = null!;
    [Column(name: "tool_url")]
    public string ToolURL { get; set; } = null!;

}

[Table("ManualClassifiers")] //TPT Inheritance
public class ManualClassifier : Classifier
{
    [Column(name: "first_name")]
    public string FirstName { get; set; } = null!;
    [Column(name: "label_name")]
    public string LastName { get; set; } = null!;
    [Column(name: "email")]
    public string Email { get; set; } = null!;
    [Column(name: "username")]
    public string Username { get; set; } = null!;
    [Column(name: "passwordHash")]
    public string PasswordHash { get; set; } = null!;
    [Column(name: "passwordSalt")]
    public string PasswordSalt { get; set; } = null!;
}

The Classifier establishes a one-to-many relationship with the class ClassifierVulnWeight. The VulnerabilityClass also establishes a one-to-many relationship with the class ClassifierVulnWeight:

public class ClassifierVulnWeight
{
    [Column(name: "classifier_id")]
    public int ClassifierId { get; set; }
    public Classifier Classifier { get; set; } = null!;

    [Column(name: "vuln_class_id")]
    public int VulnerabilityClassId { get; set; }
    public VulnerabilityClass VulnerabilityClass { get; set; } = null!;

    [Column(name: "last_update")]
    public DateTime LastUpdate { get; set; }
    [Column(name: "weight")]
    public double Weight { get; set; }
}

 public class VulnerabilityClass
{
    [Column(name: "vuln_class_id")]
    public int Id { get; set; }
    [Column(name: "vuln_class_name")]
    public string VulnerabilityClassName { get; set; } = null!;
    [Column(name: "vuln_class_acronym")]
    public string VulnerabilityClassAcronym { get; set; } = null!;
    public ICollection<ClassifierVulnWeight> ClassifierVulnWeight { get; set; } = null!;

}

The ClassifierVulnWight has a composite primary key, composed of the classifier Id and VulnClass Id, as shown below:

modelBuilder.Entity<ClassifierVulnWeight>()
            .HasKey(classifierVulnWeight => new
            {
                classifierVulnWeight.ClassifierId,
                classifierVulnWeight.VulnerabilityClassId
            });

My question is the following: will I have any troubles when creating instances of ClassifierVulnWeight since I have the abstract class Classifier? This is because the obligation is in the Tool Classifier and Manual Classifier entities, i.e., there is no Classifier instance unless there is at least an instance of one of the two aforementioned.
I'm guessing that the ICollection property in the Classifier instance is inherited by both children and thus there will be no problem. Is my assumption correct? Thank you in advance.


问:
Angular: PDF downloaded from server saves as a .pdf.html file on mobiles
I have this function to call my server to generate and download a pdf file:

```<code>  public async getPdfFromServer(logbookFormat: any, numberOfPage: any, signatureString: any, filterObject: any = "") {
    const token: string = localStorage.getItem('token') || '';
    axios.defaults.headers.post['Content-Type'] = 'application/pdf';

    let data = {
    }
    try {
      return fetch('https://www.test.com/getPdfReport.php',
        {
          method: 'POST',
          headers: {
            'Authorization': token,
            'Content-Type': 'application/pdf'
          },
          body: JSON.stringify(data)
        }
      ).then((response) => {
        if (response) {
          // @ts-ignore
          return response.blob({headers: {'Content-Type': 'application/pdf'}});
        }
        return;
      });
    } catch (e) {
      console.log(e);
      return false;
    }
  }

</code>```

this function is called by this code:

```<code>  public async generateReport() {
    this.savePad();
    let blah: any;
    if (this.isFiltering) {
      blah = await this.dataService.getPdfFromServer(this.selectedFormat.value, this.selectedPages.value, this.signatureImg, this.filterObject);
    } else {
      blah = await this.dataService.getPdfFromServer(this.selectedFormat.value, this.selectedPages.value, this.signatureImg);
    }
    if (blah) {
      const fileName = 'my-report-' + new Date().getTime().toString() + '.pdf';
      const downloadUrl = window.URL.createObjectURL(blah);
      const link = document.createElement('a');
      link.href = downloadUrl;
      link.download = fileName;
      link.click();
    }
  }

</code>```

but when this is done from a mobile browser it downloads the file as a .pdf.html file. On a normal laptop it downloads normally as a .pdf file.

Wondering if anyone can help

Body:
I have this function to call my server to generate and download a pdf file:

  public async getPdfFromServer(logbookFormat: any, numberOfPage: any, signatureString: any, filterObject: any = "") {
    const token: string = localStorage.getItem('token') || '';
    axios.defaults.headers.post['Content-Type'] = 'application/pdf';

    let data = {
    }
    try {
      return fetch('https://www.test.com/getPdfReport.php',
        {
          method: 'POST',
          headers: {
            'Authorization': token,
            'Content-Type': 'application/pdf'
          },
          body: JSON.stringify(data)
        }
      ).then((response) => {
        if (response) {
          // @ts-ignore
          return response.blob({headers: {'Content-Type': 'application/pdf'}});
        }
        return;
      });
    } catch (e) {
      console.log(e);
      return false;
    }
  }

this function is called by this code:

  public async generateReport() {
    this.savePad();
    let blah: any;
    if (this.isFiltering) {
      blah = await this.dataService.getPdfFromServer(this.selectedFormat.value, this.selectedPages.value, this.signatureImg, this.filterObject);
    } else {
      blah = await this.dataService.getPdfFromServer(this.selectedFormat.value, this.selectedPages.value, this.signatureImg);
    }
    if (blah) {
      const fileName = 'my-report-' + new Date().getTime().toString() + '.pdf';
      const downloadUrl = window.URL.createObjectURL(blah);
      const link = document.createElement('a');
      link.href = downloadUrl;
      link.download = fileName;
      link.click();
    }
  }

but when this is done from a mobile browser it downloads the file as a .pdf.html file. On a normal laptop it downloads normally as a .pdf file.

Wondering if anyone can help


问:
wp_head(); not inserting my css into
First off, yes, I have used the search function.
No solution worked for me.

Running XAMPP 8.2.0, localhost.

functions.php

```<code><?php
function add_CSS() {
   wp_enqueue_style( 'gj-sheet', "/assets/css/style.css");
}
add_action('wp_enqueue_scripts', 'add_CSS');
?>
</code>```

header.php

```<code><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
    <?php wp_head(); ?>
    <title>Jobs</title>
</head>
</code>```

I need the stylesheet to be inserted in my .

Title: wp_head(); not inserting my css into <head>

Body:
First off, yes, I have used the search function.
No solution worked for me.

Running XAMPP 8.2.0, localhost.

functions.php

<?php
function add_CSS() {
   wp_enqueue_style( 'gj-sheet', "/assets/css/style.css");
}
add_action('wp_enqueue_scripts', 'add_CSS');
?>

header.php

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
    <?php wp_head(); ?>
    <title>Jobs</title>

I need the stylesheet to be inserted in my .


问:
Regarding finding the event when clicked on column menu
I’m using AGGrid enterprise and recently I encountered an issue in angular that when I choose reset columns in column menu of the grid, the
setColumnVisible false in one column the hidden column is shown when grid gets reset.

Please see below images to know more about the issue refer image name for pictures:

I have set column visibility to false for repName column:

In colDefs:

Clicking on reset columns in column menu:

The hidden column poped up:

I have read many websites and documentation to solve this issue but that didn’t worked also the documentation only mentioned about how to reposition, rearrange and redesign the column menu but what if I want the change the functionality of default column menu option globally in two thousands pages?

I can create custom column menu but I’m curious weather or not AGGrid provides a way to customize the functionality of column menu options like im my case I want Reset Columns option to check the visibility of a particular column based on some logic.

Thank you for reading this far and thanks in advance if you tried or provided the exact solution im looking for.

```<code>Note: If anyone want i can replicate the problem in stackblitz or in plucker.
</code>```

I have read many websites and documentation to solve this issue but that didn’t worked also, Hoping for solution or help.

Body:
I’m using AGGrid enterprise and recently I encountered an issue in angular that when I choose reset columns in column menu of the grid, the
setColumnVisible false in one column the hidden column is shown when grid gets reset.

Please see below images to know more about the issue refer image name for pictures:

I have set column visibility to false for repName column:

In colDefs:

Clicking on reset columns in column menu:

The hidden column poped up:

I have read many websites and documentation to solve this issue but that didn’t worked also the documentation only mentioned about how to reposition, rearrange and redesign the column menu but what if I want the change the functionality of default column menu option globally in two thousands pages?

I can create custom column menu but I’m curious weather or not AGGrid provides a way to customize the functionality of column menu options like im my case I want Reset Columns option to check the visibility of a particular column based on some logic.

Thank you for reading this far and thanks in advance if you tried or provided the exact solution im looking for.

Note: If anyone want i can replicate the problem in stackblitz or in plucker.

I have read many websites and documentation to solve this issue but that didn’t worked also, Hoping for solution or help.


问:
ChartJS label font size is scaled up and squeezed together
I have a nodejs app which is generating chartjs diagram images. In local the label is fine it looks like this:

But when I deploy exactly the same code to azure it looks like the label is scaled up and jammed.

My dependencies are "dependencies": { "chart.js": "2.7.3", "chartjs-node-canvas": "3.2.0"} and this is my chart config:

```<code>        options: {
            maintainAspectRatio: false,
            legend: {
                display: false
            },
            tooltips: {
                enabled: false
            },
            animation: {
                duration: 0
            },
            elements: {
                line: {
                    cubicInterpolationMode: 'monotone'
                }
            },
            scales: {
                xAxes: [{
                    type: 'linear',
                    display: true,
                    ticks: {
                        autoSkip: true,
                        fontColor: gray,
                        fontSize: 14,
                        maxRotation: 0,
                        min: 0,
                        minRotation: 0,
                        padding: 10
                    },
                    gridLines: {
                        color: 'transparent',
                        lineWidth: 0,
                        drawTicks: false,
                        zeroLineColor: gray,
                        zeroLineWidth: 2
                    },
                    scaleLabel: {
                        display: true,
                        labelString: xLabel,
                        fontColor: gray,
                        fontSize: 14
                    }
                }],
                yAxes: [{
                    display: true,
                    id: this.yAxisId,
                    position: 'left',
                    ticks,
                    gridLines: {
                        color: transparentGray,
                        lineWidth: 1,
                        drawTicks: false,
                        zeroLineColor: gray,
                        zeroLineWidth: 2
                    },
                    scaleLabel: {
                        display: true,
                        labelString: yLabel,
                        fontColor: gray,
                        fontSize: 14
                    }
                }]
            }
</code>```

Something is wrong with my options and then why it works perfectly fine on local?

Body:
I have a nodejs app which is generating chartjs diagram images. In local the label is fine it looks like this:

But when I deploy exactly the same code to azure it looks like the label is scaled up and jammed.

My dependencies are "dependencies": { "chart.js": "2.7.3", "chartjs-node-canvas": "3.2.0"} and this is my chart config:

        options: {
            maintainAspectRatio: false,
            legend: {
                display: false
            },
            tooltips: {
                enabled: false
            },
            animation: {
                duration: 0
            },
            elements: {
                line: {
                    cubicInterpolationMode: 'monotone'
                }
            },
            scales: {
                xAxes: [{
                    type: 'linear',
                    display: true,
                    ticks: {
                        autoSkip: true,
                        fontColor: gray,
                        fontSize: 14,
                        maxRotation: 0,
                        min: 0,
                        minRotation: 0,
                        padding: 10
                    },
                    gridLines: {
                        color: 'transparent',
                        lineWidth: 0,
                        drawTicks: false,
                        zeroLineColor: gray,
                        zeroLineWidth: 2
                    },
                    scaleLabel: {
                        display: true,
                        labelString: xLabel,
                        fontColor: gray,
                        fontSize: 14
                    }
                }],
                yAxes: [{
                    display: true,
                    id: this.yAxisId,
                    position: 'left',
                    ticks,
                    gridLines: {
                        color: transparentGray,
                        lineWidth: 1,
                        drawTicks: false,
                        zeroLineColor: gray,
                        zeroLineWidth: 2
                    },
                    scaleLabel: {
                        display: true,
                        labelString: yLabel,
                        fontColor: gray,
                        fontSize: 14
                    }
                }]
            }

Something is wrong with my options and then why it works perfectly fine on local?


问:
Rich Text Editor Autosave after 1 min sitecore 9.3
I want to save the Rich Text Editor value automatically. Like during content updating, content should automatically be saved after 1 minute. I got this link https://sitecoregadgets.blogspot.com/2011/11/rich-text-auto-save.html. But solution files are not available at the given link. I also tried using javascript to hit the "Accept" button in the rich text editor, but the editor closed that case.
Following code write down for testing:

```<code>setTimeout(function(){

                     scSendRequest(event, 'editorpage:accept'); // This is call to RTE Accept button.
                     var test =document.getElementsByClassName("scRibbonToolbarLargeButton");
                     test[0].click(); // This is call to the ribbon save button

          },30000);
</code>```

Auto save RTE value.

Body:
I want to save the Rich Text Editor value automatically. Like during content updating, content should automatically be saved after 1 minute. I got this link https://sitecoregadgets.blogspot.com/2011/11/rich-text-auto-save.html. But solution files are not available at the given link. I also tried using javascript to hit the "Accept" button in the rich text editor, but the editor closed that case.
Following code write down for testing:

setTimeout(function(){

                     scSendRequest(event, 'editorpage:accept'); // This is call to RTE Accept button.
                     var test =document.getElementsByClassName("scRibbonToolbarLargeButton");
                     test[0].click(); // This is call to the ribbon save button

          },30000);

Auto save RTE value.


问:
Using Shiny dateRangeInput to select only years
I am trying to implement something like the following post:

How to set daterangepicker to ONLY YEARS

I would like my dataRangeInput() to only accept values of years.

Currently the dataRangeInput() displays years but then goes on to ask for the month and day. I would like to avoid this since I am using yearly data and not daily/monthly.

Code:

```<code>#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
#    http://shiny.rstudio.com/
#

library(shiny)

# Define UI for application that draws a histogram
ui <- fluidPage(

  dateRangeInput(
    inputId = "myInputID",
    label = h4("Year"),
    start = as.Date("1990-01-04"),
    end = as.Date("2005-10-23"),
    # min = as.Date("1990-01-04"),
    # max = as.Date("2022-10-23"),
    startview = "year",
    language = "es",
    format = "yyyy",
    separator = " - "
    #startview = "decade"
  ),

  actionButton(inputId = "apply_analysis", label = "Aplicar", icon = icon("play")),

  plotOutput("out")

)

# Define server logic required to draw a histogram
server <- function(input, output) {

  out = eventReactive(input$apply_analysis, {
    managers %>%
    data.frame() %>%
    rownames_to_column("Date") %>%
    mutate(year = lubridate::year(Date)) %>%
      filter(year > input$myInputID)
  })

  output$myPlot = renderPlot({
    out() %>%
      ggplot(aes(x = year, y = HAM1)) +
      geom_line() +
      theme_bw()
})
}

# Run the application
shinyApp(ui = ui, server = server)
</code>```

Body:
I am trying to implement something like the following post:

How to set daterangepicker to ONLY YEARS

I would like my dataRangeInput() to only accept values of years.

Currently the dataRangeInput() displays years but then goes on to ask for the month and day. I would like to avoid this since I am using yearly data and not daily/monthly.

Code:

#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
#    http://shiny.rstudio.com/
#

library(shiny)

# Define UI for application that draws a histogram
ui <- fluidPage(

  dateRangeInput(
    inputId = "myInputID",
    label = h4("Year"),
    start = as.Date("1990-01-04"),
    end = as.Date("2005-10-23"),
    # min = as.Date("1990-01-04"),
    # max = as.Date("2022-10-23"),
    startview = "year",
    language = "es",
    format = "yyyy",
    separator = " - "
    #startview = "decade"
  ),

  actionButton(inputId = "apply_analysis", label = "Aplicar", icon = icon("play")),

  plotOutput("out")

)

# Define server logic required to draw a histogram
server <- function(input, output) {

  out = eventReactive(input$apply_analysis, {
    managers %>%
    data.frame() %>%
    rownames_to_column("Date") %>%
    mutate(year = lubridate::year(Date)) %>%
      filter(year > input$myInputID)
  })

  output$myPlot = renderPlot({
    out() %>%
      ggplot(aes(x = year, y = HAM1)) +
      geom_line() +
      theme_bw()
})
}

# Run the application
shinyApp(ui = ui, server = server)


问:
Include Stripe in angular project
I am working on a website which uses angular for client and django for backend and I want to include stripe for payments. To configure stripe on the backend I have a microservice which runs on docker and accepts the following requests:

one for creating a stripe customer

another one for creating a payment

I configured stripe on the client using the provided form as follows:

```<code>export class PaymentComponent implements OnInit {

  paymentHandler:any = null;

  constructor(private checkoutService: CheckoutService) { }

  ngOnInit() {
    this.invokeStripe();
  }

  initializePayment(amount: number) {
    const paymentHandler = (<any>window).StripeCheckout.configure({
      key: 'pk_test_51MKU1wDo0NxQ0glB5HRAxUsR9MsY24POw3YHwIXnoMyFRyJ3cAV6FaErUeuEiWkGuWgAOoB3ILWXTgHA1CE9LTFr00WOT5U5vJ',
      locale: 'auto',
      token: function (stripeToken: any) {
        console.log(stripeToken);
        alert('Stripe token generated!');
        paymentStripe(stripeToken);
      }
    });

    const paymentStripe = (stripeTocken: any) => {
      this.checkoutService.makePayment(stripeTocken).subscribe((data:any) => {
        console.log(data)
      })
    }

    paymentHandler.open({
      name: 'Card Details',
      description: 'Introduce the information from your card',
      amount: amount * 100
    });
  }

  invokeStripe() {
    if(!window.document.getElementById('stripe-script')) {
      const script = window.document.createElement("script");
      script.id = "stripe-script";
      script.type = "text/javascript";
      script.src = "https://checkout.stripe.com/checkout.js";
      script.onload = () => {
        this.paymentHandler = (<any>window).StripeCheckout.configure({
          key: 'pk_test_51MKU1wDo0NxQ0glB5HRAxUsR9MsY24POw3YHwIXnoMyFRyJ3cAV6FaErUeuEiWkGuWgAOoB3ILWXTgHA1CE9LTFr00WOT5U5vJ',
          locale: 'auto',
          token: function (stripeToken: any) {
            console.log(stripeToken)
            alert('Payment has been successfull!');
          }
        });
      }
      window.document.body.appendChild(script);
    }
  }

}
</code>```

The makePayment method makes a request to the django server sending the stripe tocken.
From the server I need the above requests to the microservice.
My question is why do I need the configurations from the server as long as all I have to do to perform a payment is to make a request to the microservice? And where should I use the tocken.

I have also read about webhooks, but I don't really understand the concept and how to use this in my situation.
Also, do I need to test everything with angular cli? And why?

Thank you in advance!

Title: Include Stripe in angular project

Body:
I am working on a website which uses angular for client and django for backend and I want to include stripe for payments. To configure stripe on the backend I have a microservice which runs on docker and accepts the following requests:

one for creating a stripe customer

another one for creating a payment

I configured stripe on the client using the provided form as follows:

export class PaymentComponent implements OnInit {

  paymentHandler:any = null;

  constructor(private checkoutService: CheckoutService) { }

  ngOnInit() {
    this.invokeStripe();
  }

  initializePayment(amount: number) {
    const paymentHandler = (<any>window).StripeCheckout.configure({
      key: 'pk_test_51MKU1wDo0NxQ0glB5HRAxUsR9MsY24POw3YHwIXnoMyFRyJ3cAV6FaErUeuEiWkGuWgAOoB3ILWXTgHA1CE9LTFr00WOT5U5vJ',
      locale: 'auto',
      token: function (stripeToken: any) {
        console.log(stripeToken);
        alert('Stripe token generated!');
        paymentStripe(stripeToken);
      }
    });

    const paymentStripe = (stripeTocken: any) => {
      this.checkoutService.makePayment(stripeTocken).subscribe((data:any) => {
        console.log(data)
      })
    }

    paymentHandler.open({
      name: 'Card Details',
      description: 'Introduce the information from your card',
      amount: amount * 100
    });
  }

  invokeStripe() {
    if(!window.document.getElementById('stripe-script')) {
      const script = window.document.createElement("script");
      script.id = "stripe-script";
      script.type = "text/javascript";
      script.src = "https://checkout.stripe.com/checkout.js";
      script.onload = () => {
        this.paymentHandler = (<any>window).StripeCheckout.configure({
          key: 'pk_test_51MKU1wDo0NxQ0glB5HRAxUsR9MsY24POw3YHwIXnoMyFRyJ3cAV6FaErUeuEiWkGuWgAOoB3ILWXTgHA1CE9LTFr00WOT5U5vJ',
          locale: 'auto',
          token: function (stripeToken: any) {
            console.log(stripeToken)
            alert('Payment has been successfull!');
          }
        });
      }
      window.document.body.appendChild(script);
    }
  }

}

The makePayment method makes a request to the django server sending the stripe tocken.
From the server I need the above requests to the microservice.
My question is why do I need the configurations from the server as long as all I have to do to perform a payment is to make a request to the microservice? And where should I use the tocken.

I have also read about webhooks, but I don't really understand the concept and how to use this in my situation.
Also, do I need to test everything with angular cli? And why?

Thank you in advance!


问:
Permission denied for user mapping in RDS mssql server
I have an mssql rds server and I am getting permission denied while trying to create a new user and map that user to my application database as a RDS master user. Can some please help me on this.</p>


问:
gdb always fails with SEGV at the beginning of execution
gdb fails with SEGV for each and every program I try to run. It obviously happens before entering main(), SEGV address is always something like 0x0000aaaa9aa5xxx9. It started after upgrade host system, Virtual Box and guest system, but I don't know which upgrade caused gdb to stop working.

Details:

```<code>#### Host macOS Ventura 13.01 ####
radoje@ramax ~ % uname -a
Darwin ramax.local 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct  9 20:14:54 PDT 2022; root:xnu-8792.41.9~2/RELEASE_X86_64 x86_64

#### Virtual box ####
ramax:~ root# VirtualBox --help
Oracle VM VirtualBox VM Selector v7.0.4

#### Guest system Ubuntu 22.04.1 LTS ####
radoje@ubus:~$ uname -a
Linux ubus 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

radoje@ubus:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04)

#### Trying to run basic 'hello world' program ####
radoje@ubus:~$ gdb /tmp/tmp.gzDY6CbzJm/cmake-build-debug/exp
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
...
(gdb) run
Starting program: /tmp/tmp.gzDY6CbzJm/cmake-build-debug/exp

Program received signal SIGSEGV, Segmentation fault.
0x0000aaaa9aa5ac29 in ?? ()
(gdb) where
#0  0x0000aaaa9aa5ac29 in ?? ()
#1  0x00007ffff7fe636c in dl_main (phdr=<optimized out>, phnum=<optimized out>, user_entry=<optimized out>,
    auxv=<optimized out>) at ./elf/rtld.c:1868
#2  0x00007ffff7fe285c in _dl_sysdep_start (start_argptr=start_argptr@entry=0x7fffffffe470,
    dl_main=dl_main@entry=0x7ffff7fe4900 <dl_main>) at ../elf/dl-sysdep.c:256
#3  0x00007ffff7fe45b8 in _dl_start_final (arg=0x7fffffffe470) at ./elf/rtld.c:507
#4  _dl_start (arg=0x7fffffffe470) at ./elf/rtld.c:596
#5  0x00007ffff7fe32b8 in _start () from /lib64/ld-linux-x86-64.so.2
#6  0x0000000000000001 in ?? ()
#7  0x00007fffffffe6e9 in ?? ()
#8  0x0000000000000000 in ?? ()
(gdb)
</code>```

Behaviour is almost identical for any program I try to run. Interestingly, fault address is always of pattern 0x0000aaaa9aa5xxx9.

Without gdb, programs run as expected.
Problem seems to be the same as this one:
gdb always returns segmentation fault

Body:
gdb fails with SEGV for each and every program I try to run. It obviously happens before entering main(), SEGV address is always something like 0x0000aaaa9aa5xxx9. It started after upgrade host system, Virtual Box and guest system, but I don't know which upgrade caused gdb to stop working.

Details:

#### Host macOS Ventura 13.01 ####
radoje@ramax ~ % uname -a
Darwin ramax.local 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct  9 20:14:54 PDT 2022; root:xnu-8792.41.9~2/RELEASE_X86_64 x86_64

#### Virtual box ####
ramax:~ root# VirtualBox --help
Oracle VM VirtualBox VM Selector v7.0.4

#### Guest system Ubuntu 22.04.1 LTS ####
radoje@ubus:~$ uname -a
Linux ubus 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

radoje@ubus:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04)

#### Trying to run basic 'hello world' program ####
radoje@ubus:~$ gdb /tmp/tmp.gzDY6CbzJm/cmake-build-debug/exp
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
...
(gdb) run
Starting program: /tmp/tmp.gzDY6CbzJm/cmake-build-debug/exp

Program received signal SIGSEGV, Segmentation fault.
0x0000aaaa9aa5ac29 in ?? ()
(gdb) where
#0  0x0000aaaa9aa5ac29 in ?? ()
#1  0x00007ffff7fe636c in dl_main (phdr=<optimized out>, phnum=<optimized out>, user_entry=<optimized out>,
    auxv=<optimized out>) at ./elf/rtld.c:1868
#2  0x00007ffff7fe285c in _dl_sysdep_start (start_argptr=start_argptr@entry=0x7fffffffe470,
    dl_main=dl_main@entry=0x7ffff7fe4900 <dl_main>) at ../elf/dl-sysdep.c:256
#3  0x00007ffff7fe45b8 in _dl_start_final (arg=0x7fffffffe470) at ./elf/rtld.c:507
#4  _dl_start (arg=0x7fffffffe470) at ./elf/rtld.c:596
#5  0x00007ffff7fe32b8 in _start () from /lib64/ld-linux-x86-64.so.2
#6  0x0000000000000001 in ?? ()
#7  0x00007fffffffe6e9 in ?? ()
#8  0x0000000000000000 in ?? ()
(gdb)

Behaviour is almost identical for any program I try to run. Interestingly, fault address is always of pattern 0x0000aaaa9aa5xxx9.

Without gdb, programs run as expected.
Problem seems to be the same as this one:
gdb always returns segmentation fault


问:
How is the new connection being distributed across the instances when PM2 uses the round-robin for cluster?
Recently, I have been exploring the concept, How the PM2 works in cluster mode. assume that, that we have four instances that are running in the cluster mode. and consider instance ids are 13, 14, 15, 16

By default PM2 uses the node cluster module for clustering, the node cluster mode default approach is round-robin. PM2 also uses the default approach.

When I hit the API, the request goes to instance 13, then I hit that API again it goes to instance 13 if that instance 13 is free (none of the requests come to that instance), if not the request goes to 14. considered as after a few minutes all instance are free(no more request comes to none of the instances). Now if I hit the API, that request goes to the next instance 14, instead of going to the instance 13.

Here my question is, When I hit the API continuously, all request goes to one instance if that instance is free. if I hit the API after some time, the request goes to the next instance even if all instances are free. Does PM2 manage any time duration for each instance to handle the incoming requests? If you know the answer kindly let me know.


问:
The new price does not appear
I have two tables: products (which has price_before and discount_id) and discounts (which has discount_value and discount_id) and I want to show the products with the new price.

This is my query in product controller:

public function newPrice(Request $request)
    {
        $newPrice= Product::join('discounts','discounts.discount_id','=','products.discount_id')
        ->where('products.product_id',$request->id)
        ->select(DB::raw('products.*','(products.prict_before * discounts.discount_value/100) as priceAfter'))
        ->get();
        return response()->json($newPrice);
    }
```
<p>and this is my route:</p>
<pre class="lang-php prettyprint-override"><code>Route::get('/newPrice/{id}','App\Http\Controllers\ProductController@newPrice');

</code>```

My problem is: when I test the query in postman, it shows me the information about the product without new price (priceAfter) and I want to return it.

Can you help me please?

Title: The new price does not appear

Body:
I have two tables: products (which has price_before and discount_id) and discounts (which has discount_value and discount_id) and I want to show the products with the new price.

This is my query in product controller:

public function newPrice(Request $request)
    {
        $newPrice= Product::join('discounts','discounts.discount_id','=','products.discount_id')
        ->where('products.product_id',$request->id)
        ->select(DB::raw('products.*','(products.prict_before * discounts.discount_value/100) as priceAfter'))
        ->get();
        return response()->json($newPrice);
    }

and this is my route:

Route::get('/newPrice/{id}','App\Http\Controllers\ProductController@newPrice');

My problem is: when I test the query in postman, it shows me the information about the product without new price (priceAfter) and I want to return it.

Can you help me please?


问:
Keeping page number location consistent throughout the pdf document through R render_book
I have a multiple Rmd files (with writings) that I want to export into one pdf file. I did:

```<code>bookdown::render_book(input = "references/bookdown")
</code>```

where my Rmd files were all in the input folders. The output.yml file contains:

```<code>bookdown::pdf_document2:
  toc: true
  toc_float: true
</code>```

This successfully exports a pdf file, but depends on the page, the page number sometimes appear on the bottom or on either top left / right.

I tried:

```<code>bookdown::pdf_document2:
  includes:
    in-header:
      - \usepackage{fancyhdr}
      - \pagestyle{fancy}
      - \fancyfoot[C]{\thepage}
  toc: true
  toc_float: true
</code>```

but did not make any difference.

Is it possible to keep the location of the page number in each page consistent?

Body:
I have a multiple Rmd files (with writings) that I want to export into one pdf file. I did:

bookdown::render_book(input = "references/bookdown")

where my Rmd files were all in the input folders. The output.yml file contains:

bookdown::pdf_document2:
  toc: true
  toc_float: true

This successfully exports a pdf file, but depends on the page, the page number sometimes appear on the bottom or on either top left / right.

I tried:

bookdown::pdf_document2:
  includes:
    in-header:
      - \usepackage{fancyhdr}
      - \pagestyle{fancy}
      - \fancyfoot[C]{\thepage}
  toc: true
  toc_float: true

but did not make any difference.

Is it possible to keep the location of the page number in each page consistent?


问:
Symfony serializer (v6.1.6) slow denormalize operation
I am having a simple REST API developed with Symfony 6. I am using the following serializer for my application:

```<code>$encoders = [new JsonEncoder()];
$extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);
$responseNormalizer = new ObjectNormalizer(null, new CamelCaseToSnakeCaseNameConverter(),null, $extractor);
$dateTimeNormalizer = new DateTimeNormalizer([DateTimeNormalizer::FORMAT_KEY => DateTimeType::DEFAULT_FORMAT]);
$arrayDenormalizer = new ArrayDenormalizer();
$normalizers = [$arrayDenormalizer, $dateTimeNormalizer, $responseNormalizer];
$serializer = new Serializer($normalizers, $encoders);

return $serializer->denormalize($data, $className);
</code>```

I realized my response times are very slow and figured out that the ->denormalize() call is the bottleneck. Even though these tests were made on local environment I noticed that when I make simple GET request for products, this returns 20 items per page (paginated response) and denormalize call for each of these 20 items takes around 300-400ms on average.

My question is, is there anything I am doing obviously wrong, a way to optimize my Serializer definition? I found in couple of posts that ObjectNormalizer is the problematic slow one but didn't manage to find any concrete solutions how to optimize it?

Body:
I am having a simple REST API developed with Symfony 6. I am using the following serializer for my application:

$encoders = [new JsonEncoder()];
$extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);
$responseNormalizer = new ObjectNormalizer(null, new CamelCaseToSnakeCaseNameConverter(),null, $extractor);
$dateTimeNormalizer = new DateTimeNormalizer([DateTimeNormalizer::FORMAT_KEY => DateTimeType::DEFAULT_FORMAT]);
$arrayDenormalizer = new ArrayDenormalizer();
$normalizers = [$arrayDenormalizer, $dateTimeNormalizer, $responseNormalizer];
$serializer = new Serializer($normalizers, $encoders);

return $serializer->denormalize($data, $className);

I realized my response times are very slow and figured out that the ->denormalize() call is the bottleneck. Even though these tests were made on local environment I noticed that when I make simple GET request for products, this returns 20 items per page (paginated response) and denormalize call for each of these 20 items takes around 300-400ms on average.

My question is, is there anything I am doing obviously wrong, a way to optimize my Serializer definition? I found in couple of posts that ObjectNormalizer is the problematic slow one but didn't manage to find any concrete solutions how to optimize it?


问:
couldn't find DSO to load: libhermes.so caused by: dlopen failed: library "libjsi.so" not found:
I try to enable hermes engine on RN- ~0.63.3 version
after running the app and making apk , unfortunately apk app got crashed and error showing in logcat
#warning
java.lang.UnsatisfiedLinkError: dlopen failed: library "libjsi.so" not found:
#Error
couldn't find DSO to load: libhermes.so caused by: dlopen failed: library "libjsi.so" not found

RN- ~0.63.3 following official docs how to enable hermes in existing RN app

expecting app should run on enabling hermes