问:
JavaFX ListView setItems() cannot resolve symbol
Creating a JavaFX GUI application and can't get ListView's to work on my Controller class. Here is the code:

MP3.Java

```<code>package mp3player;

import javafx.application.Application;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.stage.Stage;

public class MP3 extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception{
        Parent root = FXMLLoader.load(getClass().getResource("mp3player.fxml"));
        primaryStage.setTitle("Hello World");
        primaryStage.setScene(new Scene(root, 300, 275));
        primaryStage.show();

    }

    public static void main(String[] args) {
        launch(args);
    }
}
</code>```

MP3Controller.java

```<code>package mp3player;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.ListView;

public class MP3Controller {
    ObservableList<String> songs = FXCollections.observableArrayList("Song 1", "Song 2");
    ListView<String> songsView = new ListView<String>();

    songsView.setItems(songs);
}
</code>```

mp3player.fxml

```<code><?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>

<GridPane alignment="center" hgap="10" scaleY="1.0" vgap="10" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mp3player.MP3Controller">
   <columnConstraints>
      <ColumnConstraints />
   </columnConstraints>
   <rowConstraints>
      <RowConstraints maxHeight="200.0" minHeight="171.0" prefHeight="200.0" />
      <RowConstraints maxHeight="29.0" minHeight="0.0" prefHeight="0.0" />
   </rowConstraints>
   <children>
      <VBox prefHeight="200.0" prefWidth="100.0">
         <children>
            <HBox prefHeight="50.0" prefWidth="100.0" />
            <HBox prefHeight="100.0" prefWidth="200.0">
               <children>
                  <ListView fx:id="songsView" prefHeight="67.0" prefWidth="146.0" />
               </children></HBox>
            <HBox prefHeight="47.0" prefWidth="100.0" />
         </children>
      </VBox>
   </children>
</GridPane>
</code>```

Any help would be greatly appreciated. I am unsure as to what's happening here as I am following the docs pretty closely, I have a suspicion it might be to do with importing javafx? If so, you could try running the script in your machine and seeing if it works. Thanks everyone!

答:
try following
in your code you are trying to set values outside method or constructor that why it is not allowing you to set value

you can do by creating constructor or method

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.ListView;

public class MP3Controller {
    ObservableList<String> songs = FXCollections.observableArrayList("Song 1", "Song 2");
    ListView<String> songsView = new ListView<String>();
    MP3Controller() {
        songsView.setItems(songs);
    }
}
```

Body:
Creating a JavaFX GUI application and can't get ListView's to work on my Controller class. Here is the code:

MP3.Java

package mp3player;

import javafx.application.Application;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.stage.Stage;

public class MP3 extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception{
        Parent root = FXMLLoader.load(getClass().getResource("mp3player.fxml"));
        primaryStage.setTitle("Hello World");
        primaryStage.setScene(new Scene(root, 300, 275));
        primaryStage.show();

    }

    public static void main(String[] args) {
        launch(args);
    }
}

MP3Controller.java

package mp3player;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.ListView;

public class MP3Controller {
    ObservableList<String> songs = FXCollections.observableArrayList("Song 1", "Song 2");
    ListView<String> songsView = new ListView<String>();

    songsView.setItems(songs);
}

mp3player.fxml

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>

<GridPane alignment="center" hgap="10" scaleY="1.0" vgap="10" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mp3player.MP3Controller">
   <columnConstraints>
      <ColumnConstraints />
   </columnConstraints>
   <rowConstraints>
      <RowConstraints maxHeight="200.0" minHeight="171.0" prefHeight="200.0" />
      <RowConstraints maxHeight="29.0" minHeight="0.0" prefHeight="0.0" />
   </rowConstraints>
   <children>
      <VBox prefHeight="200.0" prefWidth="100.0">
         <children>
            <HBox prefHeight="50.0" prefWidth="100.0" />
            <HBox prefHeight="100.0" prefWidth="200.0">
               <children>
                  <ListView fx:id="songsView" prefHeight="67.0" prefWidth="146.0" />
               </children></HBox>
            <HBox prefHeight="47.0" prefWidth="100.0" />
         </children>
      </VBox>
   </children>
</GridPane>

Any help would be greatly appreciated. I am unsure as to what's happening here as I am following the docs pretty closely, I have a suspicion it might be to do with importing javafx? If so, you could try running the script in your machine and seeing if it works. Thanks everyone!


来源: stackexchange

问:
empty textbox controls after the data is inserted / saved/ submitted in a c# winform application
I need to empty all the textbox controls after the SAVE button is clicked but the user. I have around 10 of them. How do i clear text from them all simultaneously. I just know about:

```<code>textbox1.Text="";
</code>```

But, if i do this, then i need to repeat this for the no. of textbox controls on my Form, that would be a labor task instead of programmer?

Please guide.

答:
Try this

```<code>foreach(TextBox textbox in this.Controls.OfType<TextBox>())
{
   textbox.Text = string.Empty;
}
</code>```

If you want recursivly clear all textboxes use this function.

```<code>void ClearTextBoxes(Control control)
{
    foreach(Control childControl in control.Controls)
    {
         TextBox textbox = childControl as TextBox;
         if(textbox != null)
            textbox.Text = string.Empty;
         else if(childControl.Controls.Count > 0)
             ClearTextBoxes(childControl);
    }
}
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I need to empty all the textbox controls after the SAVE button is clicked but the user. I have around 10 of them. How do i clear text from them all simultaneously. I just know about:

textbox1.Text="";

But, if i do this, then i need to repeat this for the no. of textbox controls on my Form, that would be a labor task instead of programmer?

Please guide.

Body:
Try this

foreach(TextBox textbox in this.Controls.OfType<TextBox>())
{
   textbox.Text = string.Empty;
}

If you want recursivly clear all textboxes use this function.

void ClearTextBoxes(Control control)
{
    foreach(Control childControl in control.Controls)
    {
         TextBox textbox = childControl as TextBox;
         if(textbox != null)
            textbox.Text = string.Empty;
         else if(childControl.Controls.Count > 0)
             ClearTextBoxes(childControl);
    }
}


问:
Row deletion on named sheets
I am trying to delete a row containing ISIN Value in a workbook in multiple sheets.

I am able to delete the ISIN in couple of sheets but not Spread calibration sheet and fuel& quality sheet.

```<code>Sub del()
    Dim num As Integer
    Dim del As String
    Dim q As Integer
    Dim a As Integer
    Dim i As Integer

    num = Range("A" & Rows.Count).End(xlUp).Row
    del = InputBox("Enter ISIN", "ISIN")
    a = Application.Worksheets.Count

    For q = 1 To a
        Worksheets(q).Activate
        If ActiveSheet.Name = "Price Selection for Upload" Then
            For i = 1 To num
                If Range("A" & i).Value = del Then
                    ActiveSheet.Rows(i).EntireRow.Delete
                End If
            Next i
        ElseIf ActiveSheet.Name = "Main Sheet" Then
            For i = 1 To num
                If Range("A" & i).Value = del Then
                    ActiveSheet.Rows(i).EntireRow.Delete
                End If
            Next i
        ElseIf ActiveSheet.Name = "Spread Calibration" Then
            For i = 1 To num
                If Range("A" & i).Value = del Then
                    ActiveSheet.Rows(i).EntireRow.Delete
                End If
            Next i
        ElseIf ActiveSheet.Name = "Fuel& Quality" Then
            For i = 1 To num
                If Range("B" & i).Value = del Then
                    ActiveSheet.Rows(i).EntireRow.Delete
                End If
            Next i
        ElseIf ActiveSheet.Name = "Sheet3" Then
            Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Select
            ActiveCell.Value = del
        End If
    Next q

    Worksheets("Email Details").Activate
    Worksheets("Email Details").Range("Q2").Select

End Sub
</code>```

答:
Try this. You can shorten your loop by combining cases with the same outcome. I have used Select Case but you could stick with If, the point being that you don't need to repeat everything for every sheet name.

More importantly, when deleting loop backwards otherwise you risk skipping rows.

Also, looping through each row is slow so consider using Find or Autofilter.

Avoid using Select/Activate.

If the sheet names are not being properly picked up check for trailing or leading spaces etc.

```<code>Sub del()

Dim num As Long 'use Long rather than integer
Dim del As String
Dim q As Long
Dim a As Long
Dim i As Long

num = Range("A" & Rows.Count).End(xlUp).Row 'need to add sheet reference
del = InputBox("Enter ISIN", "ISIN")
a = Application.Worksheets.Count

For q = 1 To a
    With Worksheets(q)
        Select Case .Name
            Case "Price Selection for Upload", "Main Sheet", "Spread Calibration"
                For i = num To 1 Step -1 'loop backwards
                    If .Range("A" & i).Value = del Then
                        .Rows(i).EntireRow.Delete
                    End If
                Next i
            Case "Fuel& Quality"
                For i = num To 1 Step -1
                    If .Range("B" & i).Value = del Then
                        .Rows(i).EntireRow.Delete
                    End If
                Next i
            Case "Sheet3"
                .Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = del
        End Select
    End With
Next q

Application.Goto Worksheets("Email Details").Range("Q2")

End Sub
</code>```

ContentLicense: CC BY-SA 4.0

Title: Row deletion on named sheets

Body:
I am trying to delete a row containing ISIN Value in a workbook in multiple sheets.

I am able to delete the ISIN in couple of sheets but not Spread calibration sheet and fuel& quality sheet.

Sub del()
    Dim num As Integer
    Dim del As String
    Dim q As Integer
    Dim a As Integer
    Dim i As Integer

    num = Range("A" & Rows.Count).End(xlUp).Row
    del = InputBox("Enter ISIN", "ISIN")
    a = Application.Worksheets.Count

    For q = 1 To a
        Worksheets(q).Activate
        If ActiveSheet.Name = "Price Selection for Upload" Then
            For i = 1 To num
                If Range("A" & i).Value = del Then
                    ActiveSheet.Rows(i).EntireRow.Delete
                End If
            Next i
        ElseIf ActiveSheet.Name = "Main Sheet" Then
            For i = 1 To num
                If Range("A" & i).Value = del Then
                    ActiveSheet.Rows(i).EntireRow.Delete
                End If
            Next i
        ElseIf ActiveSheet.Name = "Spread Calibration" Then
            For i = 1 To num
                If Range("A" & i).Value = del Then
                    ActiveSheet.Rows(i).EntireRow.Delete
                End If
            Next i
        ElseIf ActiveSheet.Name = "Fuel& Quality" Then
            For i = 1 To num
                If Range("B" & i).Value = del Then
                    ActiveSheet.Rows(i).EntireRow.Delete
                End If
            Next i
        ElseIf ActiveSheet.Name = "Sheet3" Then
            Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Select
            ActiveCell.Value = del
        End If
    Next q

    Worksheets("Email Details").Activate
    Worksheets("Email Details").Range("Q2").Select

End Sub

Body:
Try this. You can shorten your loop by combining cases with the same outcome. I have used Select Case but you could stick with If, the point being that you don't need to repeat everything for every sheet name.

More importantly, when deleting loop backwards otherwise you risk skipping rows.

Also, looping through each row is slow so consider using Find or Autofilter.

Avoid using Select/Activate.

If the sheet names are not being properly picked up check for trailing or leading spaces etc.

Sub del()

Dim num As Long 'use Long rather than integer
Dim del As String
Dim q As Long
Dim a As Long
Dim i As Long

num = Range("A" & Rows.Count).End(xlUp).Row 'need to add sheet reference
del = InputBox("Enter ISIN", "ISIN")
a = Application.Worksheets.Count

For q = 1 To a
    With Worksheets(q)
        Select Case .Name
            Case "Price Selection for Upload", "Main Sheet", "Spread Calibration"
                For i = num To 1 Step -1 'loop backwards
                    If .Range("A" & i).Value = del Then
                        .Rows(i).EntireRow.Delete
                    End If
                Next i
            Case "Fuel& Quality"
                For i = num To 1 Step -1
                    If .Range("B" & i).Value = del Then
                        .Rows(i).EntireRow.Delete
                    End If
                Next i
            Case "Sheet3"
                .Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = del
        End Select
    End With
Next q

Application.Goto Worksheets("Email Details").Range("Q2")

End Sub


问:
How to sorting multi array in php
I have one multi dimensional array, i want to be sort array based on SequenceID in the every array nested array, based on sequence number wise like 1,2,3,4,5,6 like SequenceID wise data display. How to do this please any one help on this .
My array data is below .

```<code><?php

$dataarray=  array(

            "CAR_DATA" => array(
                   "SNo" => 1607,
                   "SRRequestID" => 22666,
                   "AncillarySearchID"=>3333,
                   "car_data_line" => array (
                           "QuoteID" => 1607,
                           "SequenceID" => 5
                        )
                     ),
            "FLIGHT_DATA" => array(
                "SNo" => 1212,
                "SRRequestID" => 2222,
                "FLightSearchID"=>3333,
                "flight_data_line" => array (
                        "QuoteID" => 3222,
                        "SequenceID" => 2
               )
             ),

            "FLIGHT_DATA" => array(
                    "SNo" => 3222,
                    "SRRequestID" => 2222,
                    "FLightSearchID"=>3333,
                    "flight_data_line" => array (
                            "QuoteID" => 3222,
                            "SequenceID" => 1
                   )
                 ),

            "HOTEL_DATA" => array(
                    "SNo" => 343,
                    "SRRequestID" => 212,
                    "HotelSearchID"=>3434,
                    "hotel_data_line" => array (
                        "QuoteID" => 456,
                        "SequenceID" => 3
                   )
                 ),

            "HOTEL_DATA" => array(
                    "SNo" => 32,
                    "SRRequestID" => 3333,
                    "HotelSearchID"=>343,
                    "hotel_data_line" => array (
                        "QuoteID" => 121,
                        "SequenceID" => 6
                   )
                 ),

                 "HOTEL_DATA" => array(
                    "SNo" => 344,
                    "SRRequestID" => 34343,
                    "HotelSearchID"=>4433,
                    "hotel_data_line" => array (
                        "QuoteID" => 22222,
                        "SequenceID" => 4
                   )
                 ),

             );

        echo "```";print_r($dataarray);
        ?>
```

<p>Expected out put is below .</p>

```<?php

$ExpectedOutPutData=  array(

            "FLIGHT_DATA" => array(
                    "SNo" => 3222,
                    "SRRequestID" => 2222,
                    "FLightSearchID"=>3333,
                    "flight_data_line" => array (
                            "QuoteID" => 3222,
                            "SequenceID" => 1
                   )
                 ),

            "FLIGHT_DATA" => array(
                "SNo" => 1212,
                "SRRequestID" => 2222,
                "FLightSearchID"=>3333,
                "flight_data_line" => array (
                        "QuoteID" => 3222,
                        "SequenceID" => 2
               )
             ),

            "HOTEL_DATA" => array(
                    "SNo" => 343,
                    "SRRequestID" => 212,
                    "HotelSearchID"=>3434,
                    "hotel_data_line" => array (
                        "QuoteID" => 456,
                        "SequenceID" => 3
                   )
                 ),

            "HOTEL_DATA" => array(
                "SNo" => 344,
                "SRRequestID" => 34343,
                "HotelSearchID"=>4433,
                "hotel_data_line" => array (
                    "QuoteID" => 22222,
                    "SequenceID" => 4
               )
             ),

           "CAR_DATA" => array(
               "SNo" => 1607,
               "SRRequestID" => 22666,
               "AncillarySearchID"=>3333,
               "car_data_line" => array (
                       "QuoteID" => 1607,
                       "SequenceID" => 5
                    )
                 ),

            "HOTEL_DATA" => array(
                    "SNo" => 32,
                    "SRRequestID" => 3333,
                    "HotelSearchID"=>343,
                    "hotel_data_line" => array (
                        "QuoteID" => 121,
                        "SequenceID" => 6
                   )
                 )
             );

        ?>
```

<p>Here challenge is i have  CAR_DATA array one time and FLIGHT_DATA array 2 times and HOTEL_DATA array 3 times came in this example. i need with in these nested array is <strong>SequenceID</strong> based on serial number wise data showing.</p>

``` Original code

    <?php

    Array
    (
        [0] => Array
            (
                [0] => Array
                    (
                        [flight_data] => stdClass Object
                            (
                                [0] => stdClass Object
                                    (
                                        [SNo] => 33052
                                        [Flight_Search_ID] => 32955
                                        [SR_Request_ID] => 44331
                                        [quote_flight_data] => Array
                                            (
                                                [0] => stdClass Object
                                                    (
                                                        [ID] => 11652
                                                        [ReqID] => 44331
                                                        [SearchID] => 32955
                                                        [QuoteID] => 3978
                                                        [SequenceID] => 5
                                                        [QuoteGeneratedID] => R44331-1464
                                                        [RequestID] => 44331
                                                    )
                                            )
                                    )
                            )
                        [QMergeId] =>
                        [BookingDate] =>
                    )

                [1] => Array
                    (
                        [flight_data] => stdClass Object
                            (
                                [0] => stdClass Object
                                    (
                                        [SNo] => 33052
                                        [Flight_Search_ID] => 32955
                                        [SR_Request_ID] => 44331
                                        [quote_flight_data] => Array
                                            (
                                                [0] => stdClass Object
                                                    (
                                                        [ID] => 11653
                                                        [ReqID] => 44331
                                                        [SearchID] => 32955
                                                        [QuoteID] => 3979
                                                        [SequenceID] => 3
                                                        [QuoteGeneratedID] => R44331-1464
                                                        [RequestID] => 44331
                                                    )
                                            )
                                    )
                            )
                        [QMergeId] =>
                        [BookingDate] =>
                    )

                [2] => Array
                    (
                        [flight_data] => stdClass Object
                            (
                                [0] => stdClass Object
                                    (
                                        [SNo] => 33052
                                        [Flight_Search_ID] => 32955
                                        [SR_Request_ID] => 44331
                                        [quote_flight_data] => Array
                                            (
                                                [0] => stdClass Object
                                                    (
                                                        [ID] => 11652
                                                        [ReqID] => 44331
                                                        [SearchID] => 32955
                                                        [QuoteID] => 3980
                                                        [SequenceID] => 2
                                                        [QuoteGeneratedID] => R44331-1464
                                                        [RequestID] => 44331
                                                    )
                                            )
                                    )
                            )
                        [QMergeId] =>
                        [BookingDate] => 20200317
                    )

                [3] => Array
                    (
                        [flight_data] => stdClass Object
                            (
                                [0] => stdClass Object
                                    (
                                        [SNo] => 33052
                                        [Flight_Search_ID] => 32955
                                        [SR_Request_ID] => 44331
                                        [quote_flight_data] => Array
                                            (
                                                [0] => stdClass Object
                                                    (
                                                        [ID] => 11653
                                                        [ReqID] => 44331
                                                        [SearchID] => 32955
                                                        [QuoteID] => 3981
                                                        [SequenceID] => 6
                                                        [QuoteGeneratedID] => R44331-1464
                                                        [RequestID] => 44331
                                                    )
                                            )
                                    )

                            )
                        [QMergeId] =>
                        [BookingDate] => 20200317
                    )

                [4] => Array
                    (
                        [hotel_data] => stdClass Object
                            (
                                [0] => stdClass Object
                                    (
                                        [hid] => 16014
                                        [SNo] => 16019
                                        [Hotel_Search_ID] => 16014
                                        [SR_Request_ID] => 44331
                                        [quote_hotel_data] => stdClass Object
                                            (
                                                [0] => stdClass Object
                                                    (
                                                        [QuoteID] => 3943
                                                        [SequenceID] => 1
                                                        [QuoteGeneratedID] => R44331-1464
                                                        [RequestID] => 44331
                                                        [SearchID] => 16014
                                                    )
                                            )
                                    )
                            )
                        [QMergeId] =>
                        [BookingDate] => 20200317
                    )

                [5] => Array
                    (
                        [hotel_data] => stdClass Object
                            (
                                [0] => stdClass Object
                                    (
                                        [hid] => 16014
                                        [SNo] => 16019
                                        [Hotel_Search_ID] => 16014
                                        [SR_Request_ID] => 44331
                                        [quote_hotel_data] => stdClass Object
                                            (
                                                [0] => stdClass Object
                                                    (
                                                        [QuoteID] => 3944
                                                        [SequenceID] => 4
                                                        [QuoteGeneratedID] => R44331-1464
                                                        [RequestID] => 44331
                                                        [SearchID] => 16014
                                                    )
                                            )
                                    )
                            )
                        [QMergeId] =>
                        [BookingDate] => 20200317
                    )

            )

    )

    ?>
```

<blockquote>
  <p>ORIGINAL DATA OUTPUR AFTER JSON ENCODE AND DECODE</p>
</blockquote>

```$array= Array
(
    [flight_data] => Array
        (
            [0] => Array
                (
                    [SNo] => 32999
                    [Flight_Search_ID] => 32902
                    [SR_Request_ID] => 44232
                    [quote_flight_data] => Array
                        (
                            [0] => Array
                                (
                                    [ID] => 11537
                                    [ReqID] => 44232
                                    [SearchID] => 32902
                                    [QuoteID] => 3921
                                    [SequenceID] => 2
                                    [QuoteGeneratedID] => R44232-1426
                                    [RequestID] => 44232
                                )
                        )
                )
        )
    [QMergeId] =>
    [BookingDate] => 20200416
)

Array
(
    [flight_data] => Array
        (
            [0] => Array
                (
                    [SNo] => 32999
                    [Flight_Search_ID] => 32902
                    [SR_Request_ID] => 44232
                    [quote_flight_data] => Array
                        (
                            [0] => Array
                                (
                                    [ID] => 11537
                                    [ReqID] => 44232
                                    [SearchID] => 32902
                                    [QuoteID] => 3921
                                    [SequenceID] => 1
                                    [QuoteGeneratedID] => R44232-1426
                                    [RequestID] => 44232
                                )
                        )
                )
        )
    [QMergeId] =>
    [BookingDate] => 20200416
)

Array
(
    [hotel_data] => Array
        (
            [0] => Array
                (
                    [SNo] => 32999
                    [Flight_Search_ID] => 32902
                    [SR_Request_ID] => 44232
                    [quote_hotel_data] => Array
                        (
                            [0] => Array
                                (
                                    [ID] => 11537
                                    [ReqID] => 44232
                                    [SearchID] => 32902
                                    [QuoteID] => 3921
                                    [SequenceID] => 4
                                    [QuoteGeneratedID] => R44232-1426
                                    [RequestID] => 44232
                                )
                        )
                )
        )
    [QMergeId] =>
    [BookingDate] => 20200416
)

Array
(
    [hotel_data] => Array
        (
            [0] => Array
                (
                    [SNo] => 32999
                    [Flight_Search_ID] => 32902
                    [SR_Request_ID] => 44232
                    [quote_hotel_data] => Array
                        (
                            [0] => Array
                                (
                                    [ID] => 11537
                                    [ReqID] => 44232
                                    [SearchID] => 32902
                                    [QuoteID] => 3921
                                    [SequenceID] => 3
                                    [QuoteGeneratedID] => R44232-1426
                                    [RequestID] => 44232
                                )
                        )
                )
        )
    [QMergeId] =>
    [BookingDate] => 20200416
)

Array
(
    [car_data] => Array
        (
            [0] => Array
                (
                    [SNo] => 32999
                    [Flight_Search_ID] => 32902
                    [SR_Request_ID] => 44232
                    [quote_car_data] => Array
                        (
                            [0] => Array
                                (
                                    [ID] => 11537
                                    [ReqID] => 44232
                                    [SearchID] => 32902
                                    [QuoteID] => 3921
                                    [SequenceID] => 5
                                    [QuoteGeneratedID] => R44232-1426
                                    [RequestID] => 44232
                                )
                        )
                )
        )
    [QMergeId] =>
    [BookingDate] => 20200416
)
```

答:
Assuming you would be able to make your array as the way that would work. Because you've duplicate keys in your array. You can't preserve keys becasue PHP will keep the last one. So your array should be in the following way:

```<code><?php

$dataArray=  array(
    array(
        "CAR_DATA" => array(
            "SNo" => 1607,
            "SRRequestID" => 22666,
            "AncillarySearchID"=>3333,
            "car_data_line" => array (
                "QuoteID" => 1607,
                "SequenceID" => 5
            )
        )
    ),
    array(
        "FLIGHT_DATA" => array(
            "SNo" => 1212,
            "SRRequestID" => 2222,
            "FLightSearchID"=>3333,
            "flight_data_line" => array (
                "QuoteID" => 3222,
                "SequenceID" => 2
            )
        )
    ),
    array(
        "FLIGHT_DATA" => array(
            "SNo" => 3222,
            "SRRequestID" => 2222,
            "FLightSearchID"=>3333,
            "flight_data_line" => array (
                "QuoteID" => 3222,
                "SequenceID" => 1
            )
        )
    ),
    array(
        "HOTEL_DATA" => array(
            "SNo" => 343,
            "SRRequestID" => 212,
            "HotelSearchID"=>3434,
            "hotel_data_line" => array (
                "QuoteID" => 456,
                "SequenceID" => 3
            )
        )
    ),
    array(
        "HOTEL_DATA" => array(
            "SNo" => 32,
            "SRRequestID" => 3333,
            "HotelSearchID"=>343,
            "hotel_data_line" => array (
                "QuoteID" => 121,
                "SequenceID" => 6
            )
        )
    ),
    array(
        "HOTEL_DATA" => array(
            "SNo" => 344,
            "SRRequestID" => 34343,
            "HotelSearchID"=>4433,
            "hotel_data_line" => array (
                "QuoteID" => 22222,
                "SequenceID" => 4
            )
        )
    ),
);
</code>```

Next up let's make a new array based on SequenceID as the keys. Then sort the array using ksort() function. That's it.

```<code><?php

function sortArrayBySequenceID($array) {

    $new = [];

    foreach ($array as $key => $value) {

        if (isset($value['CAR_DATA']['car_data_line']['SequenceID'])) {
            $new[$value['CAR_DATA']['car_data_line']['SequenceID']] = $array[$key];
        } elseif (isset($value['FLIGHT_DATA']['flight_data_line']['SequenceID'])) {
            $new[$value['FLIGHT_DATA']['flight_data_line']['SequenceID']] = $array[$key];
        } elseif (isset($value['HOTEL_DATA']['hotel_data_line']['SequenceID'])) {
            $new[$value['HOTEL_DATA']['hotel_data_line']['SequenceID']] = $array[$key];
        }

    }

    // Sorts the newly made array based on key
    ksort($new);

    return $new;
}

print_r(sortArrayBySequenceID($dataArray));
</code>```

Title: How to sorting multi array in php

Body:
I have one multi dimensional array, i want to be sort array based on SequenceID in the every array nested array, based on sequence number wise like 1,2,3,4,5,6 like SequenceID wise data display. How to do this please any one help on this .
My array data is below .

<?php

$dataarray=  array(

            "CAR_DATA" => array(
                   "SNo" => 1607,
                   "SRRequestID" => 22666,
                   "AncillarySearchID"=>3333,
                   "car_data_line" => array (
                           "QuoteID" => 1607,
                           "SequenceID" => 5
                        )
                     ),
            "FLIGHT_DATA" => array(
                "SNo" => 1212,
                "SRRequestID" => 2222,
                "FLightSearchID"=>3333,
                "flight_data_line" => array (
                        "QuoteID" => 3222,
                        "SequenceID" => 2
               )
             ),

            "FLIGHT_DATA" => array(
                    "SNo" => 3222,
                    "SRRequestID" => 2222,
                    "FLightSearchID"=>3333,
                    "flight_data_line" => array (
                            "QuoteID" => 3222,
                            "SequenceID" => 1
                   )
                 ),

            "HOTEL_DATA" => array(
                    "SNo" => 343,
                    "SRRequestID" => 212,
                    "HotelSearchID"=>3434,
                    "hotel_data_line" => array (
                        "QuoteID" => 456,
                        "SequenceID" => 3
                   )
                 ),

            "HOTEL_DATA" => array(
                    "SNo" => 32,
                    "SRRequestID" => 3333,
                    "HotelSearchID"=>343,
                    "hotel_data_line" => array (
                        "QuoteID" => 121,
                        "SequenceID" => 6
                   )
                 ),

                 "HOTEL_DATA" => array(
                    "SNo" => 344,
                    "SRRequestID" => 34343,
                    "HotelSearchID"=>4433,
                    "hotel_data_line" => array (
                        "QuoteID" => 22222,
                        "SequenceID" => 4
                   )
                 ),

             );

        echo "
";print_r($dataarray);
        ?>

Expected out put is below .

<?php

$ExpectedOutPutData=  array(

            "FLIGHT_DATA" => array(
                    "SNo" => 3222,
                    "SRRequestID" => 2222,
                    "FLightSearchID"=>3333,
                    "flight_data_line" => array (
                            "QuoteID" => 3222,
                            "SequenceID" => 1
                   )
                 ),

            "FLIGHT_DATA" => array(
                "SNo" => 1212,
                "SRRequestID" => 2222,
                "FLightSearchID"=>3333,
                "flight_data_line" => array (
                        "QuoteID" => 3222,
                        "SequenceID" => 2
               )
             ),

            "HOTEL_DATA" => array(
                    "SNo" => 343,
                    "SRRequestID" => 212,
                    "HotelSearchID"=>3434,
                    "hotel_data_line" => array (
                        "QuoteID" => 456,
                        "SequenceID" => 3
                   )
                 ),

            "HOTEL_DATA" => array(
                "SNo" => 344,
                "SRRequestID" => 34343,
                "HotelSearchID"=>4433,
                "hotel_data_line" => array (
                    "QuoteID" => 22222,
                    "SequenceID" => 4
               )
             ),

           "CAR_DATA" => array(
               "SNo" => 1607,
               "SRRequestID" => 22666,
               "AncillarySearchID"=>3333,
               "car_data_line" => array (
                       "QuoteID" => 1607,
                       "SequenceID" => 5
                    )
                 ),

            "HOTEL_DATA" => array(
                    "SNo" => 32,
                    "SRRequestID" => 3333,
                    "HotelSearchID"=>343,
                    "hotel_data_line" => array (
                        "QuoteID" => 121,
                        "SequenceID" => 6
                   )
                 )
             );

        ?>

Here challenge is i have  CAR_DATA array one time and FLIGHT_DATA array 2 times and HOTEL_DATA array 3 times came in this example. i need with in these nested array is SequenceID based on serial number wise data showing.

 Original code

    <?php

    Array
    (
        [0] => Array
            (
                [0] => Array
                    (
                        [flight_data] => stdClass Object
                            (
                                [0] => stdClass Object
                                    (
                                        [SNo] => 33052
                                        [Flight_Search_ID] => 32955
                                        [SR_Request_ID] => 44331
                                        [quote_flight_data] => Array
                                            (
                                                [0] => stdClass Object
                                                    (
                                                        [ID] => 11652
                                                        [ReqID] => 44331
                                                        [SearchID] => 32955
                                                        [QuoteID] => 3978
                                                        [SequenceID] => 5
                                                        [QuoteGeneratedID] => R44331-1464
                                                        [RequestID] => 44331
                                                    )
                                            )
                                    )
                            )
                        [QMergeId] =>
                        [BookingDate] =>
                    )

                [1] => Array
                    (
                        [flight_data] => stdClass Object
                            (
                                [0] => stdClass Object
                                    (
                                        [SNo] => 33052
                                        [Flight_Search_ID] => 32955
                                        [SR_Request_ID] => 44331
                                        [quote_flight_data] => Array
                                            (
                                                [0] => stdClass Object
                                                    (
                                                        [ID] => 11653
                                                        [ReqID] => 44331
                                                        [SearchID] => 32955
                                                        [QuoteID] => 3979
                                                        [SequenceID] => 3
                                                        [QuoteGeneratedID] => R44331-1464
                                                        [RequestID] => 44331
                                                    )
                                            )
                                    )
                            )
                        [QMergeId] =>
                        [BookingDate] =>
                    )

                [2] => Array
                    (
                        [flight_data] => stdClass Object
                            (
                                [0] => stdClass Object
                                    (
                                        [SNo] => 33052
                                        [Flight_Search_ID] => 32955
                                        [SR_Request_ID] => 44331
                                        [quote_flight_data] => Array
                                            (
                                                [0] => stdClass Object
                                                    (
                                                        [ID] => 11652
                                                        [ReqID] => 44331
                                                        [SearchID] => 32955
                                                        [QuoteID] => 3980
                                                        [SequenceID] => 2
                                                        [QuoteGeneratedID] => R44331-1464
                                                        [RequestID] => 44331
                                                    )
                                            )
                                    )
                            )
                        [QMergeId] =>
                        [BookingDate] => 20200317
                    )

                [3] => Array
                    (
                        [flight_data] => stdClass Object
                            (
                                [0] => stdClass Object
                                    (
                                        [SNo] => 33052
                                        [Flight_Search_ID] => 32955
                                        [SR_Request_ID] => 44331
                                        [quote_flight_data] => Array
                                            (
                                                [0] => stdClass Object
                                                    (
                                                        [ID] => 11653
                                                        [ReqID] => 44331
                                                        [SearchID] => 32955
                                                        [QuoteID] => 3981
                                                        [SequenceID] => 6
                                                        [QuoteGeneratedID] => R44331-1464
                                                        [RequestID] => 44331
                                                    )
                                            )
                                    )

                            )
                        [QMergeId] =>
                        [BookingDate] => 20200317
                    )

                [4] => Array
                    (
                        [hotel_data] => stdClass Object
                            (
                                [0] => stdClass Object
                                    (
                                        [hid] => 16014
                                        [SNo] => 16019
                                        [Hotel_Search_ID] => 16014
                                        [SR_Request_ID] => 44331
                                        [quote_hotel_data] => stdClass Object
                                            (
                                                [0] => stdClass Object
                                                    (
                                                        [QuoteID] => 3943
                                                        [SequenceID] => 1
                                                        [QuoteGeneratedID] => R44331-1464
                                                        [RequestID] => 44331
                                                        [SearchID] => 16014
                                                    )
                                            )
                                    )
                            )
                        [QMergeId] =>
                        [BookingDate] => 20200317
                    )

                [5] => Array
                    (
                        [hotel_data] => stdClass Object
                            (
                                [0] => stdClass Object
                                    (
                                        [hid] => 16014
                                        [SNo] => 16019
                                        [Hotel_Search_ID] => 16014
                                        [SR_Request_ID] => 44331
                                        [quote_hotel_data] => stdClass Object
                                            (
                                                [0] => stdClass Object
                                                    (
                                                        [QuoteID] => 3944
                                                        [SequenceID] => 4
                                                        [QuoteGeneratedID] => R44331-1464
                                                        [RequestID] => 44331
                                                        [SearchID] => 16014
                                                    )
                                            )
                                    )
                            )
                        [QMergeId] =>
                        [BookingDate] => 20200317
                    )

            )

    )

    ?>

ORIGINAL DATA OUTPUR AFTER JSON ENCODE AND DECODE

$array= Array
(
    [flight_data] => Array
        (
            [0] => Array
                (
                    [SNo] => 32999
                    [Flight_Search_ID] => 32902
                    [SR_Request_ID] => 44232
                    [quote_flight_data] => Array
                        (
                            [0] => Array
                                (
                                    [ID] => 11537
                                    [ReqID] => 44232
                                    [SearchID] => 32902
                                    [QuoteID] => 3921
                                    [SequenceID] => 2
                                    [QuoteGeneratedID] => R44232-1426
                                    [RequestID] => 44232
                                )
                        )
                )
        )
    [QMergeId] =>
    [BookingDate] => 20200416
)

Array
(
    [flight_data] => Array
        (
            [0] => Array
                (
                    [SNo] => 32999
                    [Flight_Search_ID] => 32902
                    [SR_Request_ID] => 44232
                    [quote_flight_data] => Array
                        (
                            [0] => Array
                                (
                                    [ID] => 11537
                                    [ReqID] => 44232
                                    [SearchID] => 32902
                                    [QuoteID] => 3921
                                    [SequenceID] => 1
                                    [QuoteGeneratedID] => R44232-1426
                                    [RequestID] => 44232
                                )
                        )
                )
        )
    [QMergeId] =>
    [BookingDate] => 20200416
)

Array
(
    [hotel_data] => Array
        (
            [0] => Array
                (
                    [SNo] => 32999
                    [Flight_Search_ID] => 32902
                    [SR_Request_ID] => 44232
                    [quote_hotel_data] => Array
                        (
                            [0] => Array
                                (
                                    [ID] => 11537
                                    [ReqID] => 44232
                                    [SearchID] => 32902
                                    [QuoteID] => 3921
                                    [SequenceID] => 4
                                    [QuoteGeneratedID] => R44232-1426
                                    [RequestID] => 44232
                                )
                        )
                )
        )
    [QMergeId] =>
    [BookingDate] => 20200416
)

Array
(
    [hotel_data] => Array
        (
            [0] => Array
                (
                    [SNo] => 32999
                    [Flight_Search_ID] => 32902
                    [SR_Request_ID] => 44232
                    [quote_hotel_data] => Array
                        (
                            [0] => Array
                                (
                                    [ID] => 11537
                                    [ReqID] => 44232
                                    [SearchID] => 32902
                                    [QuoteID] => 3921
                                    [SequenceID] => 3
                                    [QuoteGeneratedID] => R44232-1426
                                    [RequestID] => 44232
                                )
                        )
                )
        )
    [QMergeId] =>
    [BookingDate] => 20200416
)

Array
(
    [car_data] => Array
        (
            [0] => Array
                (
                    [SNo] => 32999
                    [Flight_Search_ID] => 32902
                    [SR_Request_ID] => 44232
                    [quote_car_data] => Array
                        (
                            [0] => Array
                                (
                                    [ID] => 11537
                                    [ReqID] => 44232
                                    [SearchID] => 32902
                                    [QuoteID] => 3921
                                    [SequenceID] => 5
                                    [QuoteGeneratedID] => R44232-1426
                                    [RequestID] => 44232
                                )
                        )
                )
        )
    [QMergeId] =>
    [BookingDate] => 20200416
)

Body:
Assuming you would be able to make your array as the way that would work. Because you've duplicate keys in your array. You can't preserve keys becasue PHP will keep the last one. So your array should be in the following way:

<?php

$dataArray=  array(
    array(
        "CAR_DATA" => array(
            "SNo" => 1607,
            "SRRequestID" => 22666,
            "AncillarySearchID"=>3333,
            "car_data_line" => array (
                "QuoteID" => 1607,
                "SequenceID" => 5
            )
        )
    ),
    array(
        "FLIGHT_DATA" => array(
            "SNo" => 1212,
            "SRRequestID" => 2222,
            "FLightSearchID"=>3333,
            "flight_data_line" => array (
                "QuoteID" => 3222,
                "SequenceID" => 2
            )
        )
    ),
    array(
        "FLIGHT_DATA" => array(
            "SNo" => 3222,
            "SRRequestID" => 2222,
            "FLightSearchID"=>3333,
            "flight_data_line" => array (
                "QuoteID" => 3222,
                "SequenceID" => 1
            )
        )
    ),
    array(
        "HOTEL_DATA" => array(
            "SNo" => 343,
            "SRRequestID" => 212,
            "HotelSearchID"=>3434,
            "hotel_data_line" => array (
                "QuoteID" => 456,
                "SequenceID" => 3
            )
        )
    ),
    array(
        "HOTEL_DATA" => array(
            "SNo" => 32,
            "SRRequestID" => 3333,
            "HotelSearchID"=>343,
            "hotel_data_line" => array (
                "QuoteID" => 121,
                "SequenceID" => 6
            )
        )
    ),
    array(
        "HOTEL_DATA" => array(
            "SNo" => 344,
            "SRRequestID" => 34343,
            "HotelSearchID"=>4433,
            "hotel_data_line" => array (
                "QuoteID" => 22222,
                "SequenceID" => 4
            )
        )
    ),
);

Next up let's make a new array based on SequenceID as the keys. Then sort the array using ksort() function. That's it.

<?php

function sortArrayBySequenceID($array) {

    $new = [];

    foreach ($array as $key => $value) {

        if (isset($value['CAR_DATA']['car_data_line']['SequenceID'])) {
            $new[$value['CAR_DATA']['car_data_line']['SequenceID']] = $array[$key];
        } elseif (isset($value['FLIGHT_DATA']['flight_data_line']['SequenceID'])) {
            $new[$value['FLIGHT_DATA']['flight_data_line']['SequenceID']] = $array[$key];
        } elseif (isset($value['HOTEL_DATA']['hotel_data_line']['SequenceID'])) {
            $new[$value['HOTEL_DATA']['hotel_data_line']['SequenceID']] = $array[$key];
        }

    }

    // Sorts the newly made array based on key
    ksort($new);

    return $new;
}

print_r(sortArrayBySequenceID($dataArray));


问:
Copy directory from path into current directory
The following python code takes a list of file paths to a particular instance of a file to copy them into the current directory with the path name in the title:

```<code>python3 find.py --copy zz /Users/apt/testdir a.txt
/Users/apt/testdir/d1/a.txt
/Users/apt/testdir/d1/d3/a.txt
/Users/apt/testdir/d1/d3/d4/a.txt
/Users/apt/testdir/d1/d3/d5/a.txt
$ ls zz
Users_apt_testdir_d1_a.txt
Users_apt_testdir_d1_d3_d4_a.txt
Users_apt_testdir_d1_d3_a.txt
Users_apt_testdir_d1_d3_d5_a.txt
</code>```

Everything works but my copy function:

```<code>def copy(f, new_dir):
   file_name=str(f[1:])
   file_name=file_name.replace('/', "_")
   file_path=os.path.join(new_dir, file_name)
   shutil.copy(file_path, new_dir)
   os.chdir(os.path.abspath(new_dir))
   os.rename(list(os.path.split(f))[1], file_name)

FileNotFoundError: [Errno 2] No such file or directory: "zz/['_u_macole_testdir_d1_d3_a.txt', '_u_macole_testdir_d1_d3_d4_a.txt', '_u_macole_testdir_d1_d3_d5_a.txt']
</code>```

答:
The error is pretty self-explanatory, either file or new_dir doesn't have the good type. Since file is a list, you need to iterate and call copy each time:
Something like

def copy(f, new_dir):
   file_name=str(f[1:])
   file_name=file_name.replace('/', "_")
   file_path=os.path.join(new_dir, file_name)
   shutil.copy(file_path, new_dir)
   os.chdir(os.path.abspath(new_dir))
   os.rename(f, file_name)

for i in f:
   copy(i, new_dir)
```

Body:
The following python code takes a list of file paths to a particular instance of a file to copy them into the current directory with the path name in the title:

python3 find.py --copy zz /Users/apt/testdir a.txt
/Users/apt/testdir/d1/a.txt
/Users/apt/testdir/d1/d3/a.txt
/Users/apt/testdir/d1/d3/d4/a.txt
/Users/apt/testdir/d1/d3/d5/a.txt
$ ls zz
Users_apt_testdir_d1_a.txt
Users_apt_testdir_d1_d3_d4_a.txt
Users_apt_testdir_d1_d3_a.txt
Users_apt_testdir_d1_d3_d5_a.txt

Everything works but my copy function:

def copy(f, new_dir):
   file_name=str(f[1:])
   file_name=file_name.replace('/', "_")
   file_path=os.path.join(new_dir, file_name)
   shutil.copy(file_path, new_dir)
   os.chdir(os.path.abspath(new_dir))
   os.rename(list(os.path.split(f))[1], file_name)

FileNotFoundError: [Errno 2] No such file or directory: "zz/['_u_macole_testdir_d1_d3_a.txt', '_u_macole_testdir_d1_d3_d4_a.txt', '_u_macole_testdir_d1_d3_d5_a.txt']


问:
How to do case insensitive filtering in mongoose?
I just started working on MongoDB and below is my code.  I need to ignore casing while filtering data how to do it?

```<code>db.collection.aggregate([

  {
    $project: {
      _id: 0,
      name: 1,
      data: {
        $filter: {
          input: "$data",
          as: "el",
          cond: {
            $in: [
              "$$el",
              [
                "Min", //need to ignore casing
                "max",
                "gg"
              ]
            ]
          }
        }
      }
    }
  }
])
</code>```

Thanks in advance

答:
You can use the $toLower operator to convert the filter element to lowercase then ensure the array elements in the conditional expression are all in lowercase:

```<code>db.collection.aggregate([
  {
    $project: {
      _id: 0,
      name: 1,
      data: {
        $filter: {
          input: "$data",
          as: "el",
          cond: {
            $in: [
              // Convert the input element to lower case
              { "$toLower": "$$el" },
              // Ensue all the elements of the array below are in lower case
              [
                "min",
                "max",
                "gg"
              ]
            ]
          }
        }
      }
    }
  }
])
</code>```

Body:
I just started working on MongoDB and below is my code.  I need to ignore casing while filtering data how to do it?

db.collection.aggregate([

  {
    $project: {
      _id: 0,
      name: 1,
      data: {
        $filter: {
          input: "$data",
          as: "el",
          cond: {
            $in: [
              "$$el",
              [
                "Min", //need to ignore casing
                "max",
                "gg"
              ]
            ]
          }
        }
      }
    }
  }
])

Thanks in advance

Body:
You can use the $toLower operator to convert the filter element to lowercase then ensure the array elements in the conditional expression are all in lowercase:

db.collection.aggregate([
  {
    $project: {
      _id: 0,
      name: 1,
      data: {
        $filter: {
          input: "$data",
          as: "el",
          cond: {
            $in: [
              // Convert the input element to lower case
              { "$toLower": "$$el" },
              // Ensue all the elements of the array below are in lower case
              [
                "min",
                "max",
                "gg"
              ]
            ]
          }
        }
      }
    }
  }
])


问:
Is there a pom.xml option for H:+TraceClassInitialization when building a graalvm executable?
I am building a native GraalVM native image by running:

```<code>./mvnw package -Pnative
</code>```

This throws an error :

```<code>Error: Detected a started Thread in the image heap. Threads running in the image generator are no longer running at image run time.  To see how this object got instantiated use -H:+TraceClassInitialization. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image run time by using the option --initialize-at-build-time=<class-name>.
</code>```

I can see the native-image command that it tried to run:

```<code>/Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.1/Contents/Home/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar get-started-1.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace get-started-1.0-SNAPSHOT-runner
</code>```

so I think I can add the -H:+TraceClassInitialization error, but when I do run native-image with or without the trace option I get a different error:

```<code>[get-started-1.0-SNAPSHOT-runner:52581]    classlist:   7,548.63 ms
[get-started-1.0-SNAPSHOT-runner:52581]        setup:      55.85 ms
Error: policy com.oracle.svm.core.genscavenge.CollectionPolicy cannot be instantiated.
com.oracle.svm.core.util.UserError$UserException: policy com.oracle.svm.core.genscavenge.CollectionPolicy cannot be instantiated.
</code>```

which I am not sure is related. I am guessing that running through maven sets up some context, and wondering if there is a property on the pom.xml file that I can set to ask for -H:+TraceClassInitialization

答:
Eventually found out how. Additional build args are added as properties. eg.

```<code>  <properties>
    <quarkus.package.type>native</quarkus.package.type>
    <quarkus.native.additional-build-args>-H:+TraceClassInitialization</quarkus.native.additional-build-args>
  </properties>
</code>```

or into application.properties in src/resources

```<code>quarkus.native.additional-build-args=-H:+TraceClassInitialization
</code>```

Now I can work out which classed need to be pre-initialised. I am having difficulty setting the --initialize-at-build-time= as it is already present with an empty list. Back to the documentation. If I can't find anything, then I will pose a fresh question.

Body:
I am building a native GraalVM native image by running:

./mvnw package -Pnative

This throws an error :

Error: Detected a started Thread in the image heap. Threads running in the image generator are no longer running at image run time.  To see how this object got instantiated use -H:+TraceClassInitialization. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image run time by using the option --initialize-at-build-time=<class-name>.

I can see the native-image command that it tried to run:

/Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.1/Contents/Home/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar get-started-1.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace get-started-1.0-SNAPSHOT-runner

so I think I can add the -H:+TraceClassInitialization error, but when I do run native-image with or without the trace option I get a different error:

[get-started-1.0-SNAPSHOT-runner:52581]    classlist:   7,548.63 ms
[get-started-1.0-SNAPSHOT-runner:52581]        setup:      55.85 ms
Error: policy com.oracle.svm.core.genscavenge.CollectionPolicy cannot be instantiated.
com.oracle.svm.core.util.UserError$UserException: policy com.oracle.svm.core.genscavenge.CollectionPolicy cannot be instantiated.

which I am not sure is related. I am guessing that running through maven sets up some context, and wondering if there is a property on the pom.xml file that I can set to ask for -H:+TraceClassInitialization

Body:
Eventually found out how. Additional build args are added as properties. eg.

  <properties>
    <quarkus.package.type>native</quarkus.package.type>
    <quarkus.native.additional-build-args>-H:+TraceClassInitialization</quarkus.native.additional-build-args>
  </properties>

or into application.properties in src/resources

quarkus.native.additional-build-args=-H:+TraceClassInitialization

Now I can work out which classed need to be pre-initialised. I am having difficulty setting the --initialize-at-build-time= as it is already present with an empty list. Back to the documentation. If I can't find anything, then I will pose a fresh question.


问:
How can I retrieve all rows which depend on other rows in the same table?
So I have this table scheme

|id| item_id | dependency_item_id | completed |

The idea is to have rows in this table to point to other rows in the same table by dependency_item_id -> item_id.

What I want is to retrieve all records which have a dependency_item_id with a value of NULL and completed with a value of 0

AND

All records which have their parent, row which is the one with the item_id = dependency_item_id, with status completed = 1 and their status completed = 0

Example:

```<code>These are the records in the database.
|id|task_id|dependency_item_id|completed|
|1 |1      |null              |1        |
|2 |2      |null              |0        |
|3 |3      |1                 |0        |
|4 |4      |2                 |0        |
|5 |5      |2                 |0        |

With the query we should get only the second record
|id|task_id|dependency_item_id|completed|
|2 |2      |null              |0        |
|3 |3      |1                 |0        |
</code>```

The query I have by this point is the following:

```<code>SELECT process.*
    FROM tasks AS tasks
        JOIN tasks AS dep ON dep.dependency_item_id = process.task_id
    WHERE (dep.completed = 1 and tasks.completed = 0) OR tasks.dependency_item_id IS NULL
</code>```

答:
I had to tweak the queries you gave me to suit my need because with the given queries I couldn't retrieve the records which had null dependencies. My final result was the following:</p>

```<code>SELECT dep.*
    FROM tasks AS task
        LEFT JOIN tasks AS dep ON dep.dependency_item_id = task.item_id
    WHERE (task.completed = 1 and dep.completed = 0)
UNION
SELECT * FROM tasks WHERE dependency_item_id IS NULL AND completed = 0
</code>```

Body:
So I have this table scheme

|id| item_id | dependency_item_id | completed |

The idea is to have rows in this table to point to other rows in the same table by dependency_item_id -> item_id.

What I want is to retrieve all records which have a dependency_item_id with a value of NULL and completed with a value of 0

AND

All records which have their parent, row which is the one with the item_id = dependency_item_id, with status completed = 1 and their status completed = 0

Example:

These are the records in the database.
|id|task_id|dependency_item_id|completed|
|1 |1      |null              |1        |
|2 |2      |null              |0        |
|3 |3      |1                 |0        |
|4 |4      |2                 |0        |
|5 |5      |2                 |0        |

With the query we should get only the second record
|id|task_id|dependency_item_id|completed|
|2 |2      |null              |0        |
|3 |3      |1                 |0        |

The query I have by this point is the following:

SELECT process.*
    FROM tasks AS tasks
        JOIN tasks AS dep ON dep.dependency_item_id = process.task_id
    WHERE (dep.completed = 1 and tasks.completed = 0) OR tasks.dependency_item_id IS NULL

Body:
I had to tweak the queries you gave me to suit my need because with the given queries I couldn't retrieve the records which had null dependencies. My final result was the following:

SELECT dep.*
    FROM tasks AS task
        LEFT JOIN tasks AS dep ON dep.dependency_item_id = task.item_id
    WHERE (task.completed = 1 and dep.completed = 0)
UNION
SELECT * FROM tasks WHERE dependency_item_id IS NULL AND completed = 0


问:
Create (virtually) multiple databases under one AWS Redshift instance
We are using AWS RDS Postgres at the moment and are thinking of shifting to AWS Redshift.

Problem

We want to create two databases (1 for STAGING, 1 for PRODUCTION) under it but we came to know that we can only create ONE database under an instance.

Research

I found this answer which said that I can create multiple schemas and then simply set the default schema for roles that way I can virtually achieve different databases for PROD and QA and I will not have to change any of my queries.
But while reading the developer guide, at page 382 I read that DATABASE ROLES is listed under Unsupported PostgreSQL Features.

Question

How can I achieve this functionality given my use case in AWS Redshift?

答:
With Redshift you can create multiple databases within one cluster. (max of around 60)

the command

```<code>create database newdbname;
</code>```

will do this.

Any one query can ONLY access one database at a time so correct permissions can be set up per database.

So, I think you have everything you need.

ref:

https://docs.aws.amazon.com/redshift/latest/dg/r_Privileges.html
https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_DATABASE.html

Body:
With Redshift you can create multiple databases within one cluster. (max of around 60)

the command

create database newdbname;

will do this.

Any one query can ONLY access one database at a time so correct permissions can be set up per database.

So, I think you have everything you need.

ref:

https://docs.aws.amazon.com/redshift/latest/dg/r_Privileges.html
https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_DATABASE.html


问:
Elixir - Starting a Java JInterface OTP node under supervision
I have an elixir umbrella project where one of the apps sends requests to a Java app that I have exposed as something similar to an OTP process using JInterface.

It works perfectly because the JInterface library that ships with Erlang makes it easy.

My problem is that I need to be able to stop and start my JInterface process in my umbrella app and I can't find any documentation that shows how to do it. I currently have to execute the jar manually.

Please can somebody explain / point me towards documentation showing how I can execute my jar from within elixir under supervision?

I have tried for so long to find out how to do this but I can only find docs on how to use JInterface and how to interface with it but not how to start it programatically under supervision.
Thanks in advance.

答:
A long time ago I had to do just that, and the result was lucene_server.
You can find code for node monitoring here. Something along the lines of…

```<code>true = link(process()),
true = erlang:monitor_node(State#state.java_node, true),
</code>```

Another thing that you might find useful (from the Java side) is to use jinerface_stdlib

Body:
A long time ago I had to do just that, and the result was lucene_server.
You can find code for node monitoring here. Something along the lines of…

true = link(process()),
true = erlang:monitor_node(State#state.java_node, true),

Another thing that you might find useful (from the Java side) is to use jinerface_stdlib


问:
.NET units class, inches to millimeters
Does .NET has Units conversion class? I need to convert inches to millimeters and vise versa. </p>

答: .NET Framework doesn't have anything like this, but F# does Units of Measure.</p>

Title: .NET units class, inches to millimeters


问:
Windows Authentication Issue going from Edge to Edge Chromium
The problem

I have a web forms application that is a management application to monitor other applications on the network. Currently this is used in edge or internet explorer, but we will be using edge chromium in the near future.

It is using windows authentication at the moment and works ok on edge and internet explorer, however there is an edge in edge chromium.

When run the application everything is fine, but when i go to a new page i get prompted to enter my windows credentials. When i do this it does not work and simply asks again.

Enter Windows Credentials

Below is the authorization area of my web config.

```<code>  <authorization>
    <remove users="*" roles="" verbs="" />
    <add accessType="Allow" users="" roles="Sample group inserted here" />
  </authorization>
</code>```

If i hit cancel then i receive a 401. Below are the response and request headers. I did check these on IE as well and when it is trying to load this template it fails twice then succeeds on the third attempt.

Headers

I have tried adjusting the authorization area and look at it on all browsers.

Expected result

I would expect once i run the application my identity is recognised and i can go to any area without being prompted.

Here is my complete web config

<?xml version="1.0" encoding="utf-8"?>

<configuration>
  <configSections>

  </configSections>
  <appSettings>
    <add key="" value="https://localhost:44386" />
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="OracleUser" value="" />
    <add key="OraclePassword" value="" />
  </appSettings>

  <system.web>
    <compilation debug="true" targetFramework="4.7.1" />
    <httpRuntime targetFramework="4.5" />
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
    <machineKey decryptionKey="Left out on purpose" validationKey="Left out on purpose" />
    <identity impersonate="true" />
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />

    <security>
      <authorization>
        <remove users="*" roles="" verbs="" />
        <add accessType="Allow" users="" roles="Left out on purpose" />
      </authorization>
    </security>
  <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers></system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.112.3.0" newVersion="4.112.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
</configuration>```
</div>
</div>
</p>

<p>Successful request IE
IE 200</p>

<p>First 401 IE</p>

<p>First 401 IE</p>

<p>Second 401 IE</p>

<p>Second 401</p>

<p>I managed to find a solution (working locally in visual studio). I moved the authorization second to system.web and changed it to this. However this still only works in IE when i deploy to iis.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code> <authorization>
      <allow roles="" />
      <deny users="*" />
    </authorization></code>```

from this

  <security>
      <authorization>
        <remove users="*" roles="" verbs="" />
        <add accessType="Allow" users="" roles="" />
      </authorization>
    </security>```
</div>
</div>
</p>

<p>I would appreciate some information on this. I am not a web forms developer.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings>
    <add key="" value="https://localhost:44386" />
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="OracleUser" value="" />
    <add key="OraclePassword" value="" />
  </appSettings>
  <!--
    For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.

    The following attributes can be set on the <httpRuntime> tag.
      <system.Web>
        <httpRuntime targetFramework="4.7.1" />
      </system.Web>
  -->
  <system.web>
    <compilation debug="true" targetFramework="4.7.1" />
    <httpRuntime targetFramework="4.5" />
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
    <machineKey decryptionKey="" validationKey="" />
    <identity impersonate="false" />
    <authorization>
      <allow roles="Removed deliberately" />
      <deny users="*" />
    </authorization>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
  <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers></system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.112.3.0" newVersion="4.112.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
</configuration></code>```

答:
First, make sure you enabled windows authentication for your site in iis.

1)open iis.

2)select your site.

3)click on the authentication feature from the middle pane.

4)make sure windows authentication is enabled and rest of the are disabled.

to set authorization:

```<code><system.webServer>
        <security>
            <authentication>
                <anonymousAuthentication enabled="false" />
                <windowsAuthentication enabled="true" />
            </authentication>

           <authorization>
                <remove users="*" roles="" verbs="" />
                <add accessType="Deny" users="?" />
                <add accessType="Allow" roles="domainname\role" />
            </authorization>
        </security>
 </system.webServer>
</code>```

deny = * means deny everyone

deny = ? means deny unauthenticated users

For more detail you could refer this below link:

How to implement Windows authentication and authorization in ASP.NET

Body:
The problem

I have a web forms application that is a management application to monitor other applications on the network. Currently this is used in edge or internet explorer, but we will be using edge chromium in the near future.

It is using windows authentication at the moment and works ok on edge and internet explorer, however there is an edge in edge chromium.

When run the application everything is fine, but when i go to a new page i get prompted to enter my windows credentials. When i do this it does not work and simply asks again.

Enter Windows Credentials

Below is the authorization area of my web config.

  <authorization>
    <remove users="*" roles="" verbs="" />
    <add accessType="Allow" users="" roles="Sample group inserted here" />
  </authorization>

If i hit cancel then i receive a 401. Below are the response and request headers. I did check these on IE as well and when it is trying to load this template it fails twice then succeeds on the third attempt.

Headers

I have tried adjusting the authorization area and look at it on all browsers.

Expected result

I would expect once i run the application my identity is recognised and i can go to any area without being prompted.

Here is my complete web config

<?xml version="1.0" encoding="utf-8"?>

<configuration>
  <configSections>

  </configSections>
  <appSettings>
    <add key="" value="https://localhost:44386" />
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="OracleUser" value="" />
    <add key="OraclePassword" value="" />
  </appSettings>

  <system.web>
    <compilation debug="true" targetFramework="4.7.1" />
    <httpRuntime targetFramework="4.5" />
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
    <machineKey decryptionKey="Left out on purpose" validationKey="Left out on purpose" />
    <identity impersonate="true" />
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />

    <security>
      <authorization>
        <remove users="*" roles="" verbs="" />
        <add accessType="Allow" users="" roles="Left out on purpose" />
      </authorization>
    </security>
  <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers></system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.112.3.0" newVersion="4.112.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
</configuration>

Successful request IE
IE 200

First 401 IE

First 401 IE

Second 401 IE

Second 401

I managed to find a solution (working locally in visual studio). I moved the authorization second to system.web and changed it to this. However this still only works in IE when i deploy to iis.

 <authorization>
      <allow roles="" />
      <deny users="*" />
    </authorization>

from this

  <security>
      <authorization>
        <remove users="*" roles="" verbs="" />
        <add accessType="Allow" users="" roles="" />
      </authorization>
    </security>

I would appreciate some information on this. I am not a web forms developer.

<?xml version="1.0" encoding="utf-8"?>

<configuration>
  <configSections>

  </configSections>
  <appSettings>
    <add key="" value="https://localhost:44386" />
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="OracleUser" value="" />
    <add key="OraclePassword" value="" />
  </appSettings>

  <system.web>
    <compilation debug="true" targetFramework="4.7.1" />
    <httpRuntime targetFramework="4.5" />
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
    <machineKey decryptionKey="" validationKey="" />
    <identity impersonate="false" />
    <authorization>
      <allow roles="Removed deliberately" />
      <deny users="*" />
    </authorization>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
  <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers></system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.112.3.0" newVersion="4.112.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
  </entityFramework>
</configuration>

Body:
First, make sure you enabled windows authentication for your site in iis.

1)open iis.

2)select your site.

3)click on the authentication feature from the middle pane.

4)make sure windows authentication is enabled and rest of the are disabled.

to set authorization:

<system.webServer>
        <security>
            <authentication>
                <anonymousAuthentication enabled="false" />
                <windowsAuthentication enabled="true" />
            </authentication>

           <authorization>
                <remove users="*" roles="" verbs="" />
                <add accessType="Deny" users="?" />
                <add accessType="Allow" roles="domainname\role" />
            </authorization>
        </security>
 </system.webServer>

deny = * means deny everyone

deny = ? means deny unauthenticated users

For more detail you could refer this below link:

How to implement Windows authentication and authorization in ASP.NET


问:
Unable to use tilde (~) in vue image src binding
So the scenario is,

I have an array with test image names, I have to fetch a random image and bind to my image tag,
The code I have used is:

```<code>export default {
    data() {
        return {
            images: ['test-1.png', 'test-2.png', 'test-3.png'],
        }
    },
    methods: {
        randomItem (items) {
            return items[Math.floor(Math.random()*items.length)];
        }
    },
    created() {
        this.selectedImage = '~/assets/images/' + this.randomItem(this.images);
  }
</code>```

And in my template I have added it as:

```<code><img :src="selectedImage"/>
</code>```

And my output on my browser renders it as:

```<code><img data-v-658aaa7e="" src="~/assets/images/test-1.png">
</code>```

I want it to take up the complete path.

答:
The path needs to be resolved with require:

this.selectedImage = require('~/assets/images/' + this.randomItem(this.images));
```

This is automatically done in the template by vue-loader, which is why it works without require there.

demo

Body:
So the scenario is,

I have an array with test image names, I have to fetch a random image and bind to my image tag,
The code I have used is:

export default {
    data() {
        return {
            images: ['test-1.png', 'test-2.png', 'test-3.png'],
        }
    },
    methods: {
        randomItem (items) {
            return items[Math.floor(Math.random()*items.length)];
        }
    },
    created() {
        this.selectedImage = '~/assets/images/' + this.randomItem(this.images);
  }

And in my template I have added it as:

And my output on my browser renders it as:

I want it to take up the complete path.

Body:
The path needs to be resolved with require:

this.selectedImage = require('~/assets/images/' + this.randomItem(this.images));

This is automatically done in the template by vue-loader, which is why it works without require there.

demo