问:
How to sort lines by sed value?
I have multiple urls in a file like this:

```<code>https://private/report-artifact/dsop-pipeline-artifacts/container-scan-reports/anchore/enterprise/enterprise/0.6.1/2020-02-08T004236.092_2801/enterprise-0.6.1.tar
https://private/report-artifact/dsop-pipeline-artifacts/container-scan-reports/atlassian/bamboo-data-center/bamboo-agent/6.10.4/2019-12-17T185400.126_2118/bambo.tar
...
</code>```

I want to them to be sorted A-Z according to the last value, ie:

```<code>https://private/report-artifact/dsop-pipeline-artifacts/container-scan-reports/atlassian/bamboo-data-center/bamboo-agent/6.10.4/2019-12-17T185400.126_2118/bambo.tar
https://private/report-artifact/dsop-pipeline-artifacts/container-scan-reports/anchore/enterprise/enterprise/0.6.1/2020-02-08T004236.092_2801/enterprise-0.6.1.tar
...

</code>```

I can get the sed value of the last parameter with
sed 's|.*/||' , which gives me the A-Z pattern I am looking for:

```<code>bambo.tar
enterprise-0.6.1.tar
</code>```

But not sure how I can "sort" the entire url line like I want?

答:
Barmar's solution works well unless the files contain whitespace.  You can handle spaces (except newlines) with something like:

```<code>sed 's@\(.*\)/\(.*\)@\2/\1/\2@' | sort -t/ | sed -e 's@[^/]*/@@'
</code>```

but if the paths contain newlines, then using sed will be pretty hopeless.  The above is a bit cleaner with awk:

```<code>awk '{print $NF,$0}' FS=/ OFS=/ | sort -t/ | sed -e 's@[^/]*/@@'
</code>```

Title: How to sort lines by sed value?

Body:
I have multiple urls in a file like this:

https://private/report-artifact/dsop-pipeline-artifacts/container-scan-reports/anchore/enterprise/enterprise/0.6.1/2020-02-08T004236.092_2801/enterprise-0.6.1.tar
https://private/report-artifact/dsop-pipeline-artifacts/container-scan-reports/atlassian/bamboo-data-center/bamboo-agent/6.10.4/2019-12-17T185400.126_2118/bambo.tar
...

I want to them to be sorted A-Z according to the last value, ie:

https://private/report-artifact/dsop-pipeline-artifacts/container-scan-reports/atlassian/bamboo-data-center/bamboo-agent/6.10.4/2019-12-17T185400.126_2118/bambo.tar
https://private/report-artifact/dsop-pipeline-artifacts/container-scan-reports/anchore/enterprise/enterprise/0.6.1/2020-02-08T004236.092_2801/enterprise-0.6.1.tar
...

I can get the sed value of the last parameter with
sed 's|.*/||' , which gives me the A-Z pattern I am looking for:

bambo.tar
enterprise-0.6.1.tar

But not sure how I can "sort" the entire url line like I want?

Body:
Barmar's solution works well unless the files contain whitespace.  You can handle spaces (except newlines) with something like:

sed 's@\(.*\)/\(.*\)@\2/\1/\2@' | sort -t/ | sed -e 's@[^/]*/@@'

but if the paths contain newlines, then using sed will be pretty hopeless.  The above is a bit cleaner with awk:

awk '{print $NF,$0}' FS=/ OFS=/ | sort -t/ | sed -e 's@[^/]*/@@'


来源: stackexchange

问:
Incorrect appearance of encoding
```<code>from jsonrpclib import jsonrpc

url = 'https://myserver.com:443'
jpc = jsonrpc.Server('%s/jsonrpc' % url)
new_string = "金衣大俠"
jpc.editqueue("NewName", new_string, 123)
</code>```

The new_string appears as Ñc'à in my server.  The server supports foreign characters, if I copy the text in new_string I can paste and save it in the server through the UI (not using jsonrpc) and it appears just fine.  I would guess I have to encode my string a certain way for this to work.  Any ideas on how I can encode my string for it to work ?

答:
Please clarify:

encode my string *in a certain way

You can use inbuilt string encode / decode function.

```<code>new_string = u'金衣大俠' #force it to unicode

# On the client side:
encoded_string = new_string.encode('utf-16')

# and on the server side:
decoded_string = received_string.decode('utf-16')
</code>```

ContentLicense: CC BY-SA 4.0

Title: Incorrect appearance of encoding

Body:
from jsonrpclib import jsonrpc

url = 'https://myserver.com:443'
jpc = jsonrpc.Server('%s/jsonrpc' % url)
new_string = "金衣大俠"
jpc.editqueue("NewName", new_string, 123)

The new_string appears as Ñc'à in my server.  The server supports foreign characters, if I copy the text in new_string I can paste and save it in the server through the UI (not using jsonrpc) and it appears just fine.  I would guess I have to encode my string a certain way for this to work.  Any ideas on how I can encode my string for it to work ?

Body:
Please clarify:

encode my string *in a certain way

You can use inbuilt string encode / decode function.

new_string = u'金衣大俠' #force it to unicode

# On the client side:
encoded_string = new_string.encode('utf-16')

# and on the server side:
decoded_string = received_string.decode('utf-16')


问:
Using Spock framework with Groovy 2.6+ to support Java 8+ syntax
I have a Java library compiled using JDK 9 syntax. But, I am using spock-core:1.0-groovy-2.4, Which does not support JDK 8+ syntax. So, in my Java code, I can use lambdas, default methods, and method references. But, in my tests I cannot. I have to use a clunky workaround for lambdas where I write a Groovy closure, then cast it to a Function<...> using the as keyword. But, other syntax such as method references like Class::method simply will not compile. Below is the dependencies section of my build.gradle.

How can I upgrade it such that I am using a newer version of Groovy that supports newer versions of Java?

All of there documentation seems to be out of date, and only references up to Groovy 2.4.

```<code>dependencies {
  testCompile(
    'junit:junit:4.12',
    'org.codehaus.groovy:groovy-all:2.4.4',
    'org.spockframework:spock-core:1.0-groovy-2.4',
    'org.springframework.boot:spring-boot:1.2.1.RELEASE',
    'cglib:cglib-nodep:2.2.2',
    'com.opencsv:opencsv:4.1'
  )
}
</code>```

答:
Things have changed in 2020. Spock supports Groovy 3 (which supports Java 8+ enhancements, including lambda expression) starting with version 2.0-M2.

For Gradle it should be enough to add a Spock's JAR dedicated for Groovy 3:

```<code>testImplementation('org.spockframework:spock-core:2.0-M2-groovy-3.0')
</code>```

and enable JUnit Platform:

```<code>test {
    useJUnitPlatform()
}
</code>```

Btw, as a person who developed support for Groovy 3 in Spock I gathered various aspects (including caveats) relating migration from Spock 1.3 to 2.0 in a blog post - it might be worth to read it :-).

ContentLicense: CC BY-SA 3.0

Body:
I have a Java library compiled using JDK 9 syntax. But, I am using spock-core:1.0-groovy-2.4, Which does not support JDK 8+ syntax. So, in my Java code, I can use lambdas, default methods, and method references. But, in my tests I cannot. I have to use a clunky workaround for lambdas where I write a Groovy closure, then cast it to a Function<...> using the as keyword. But, other syntax such as method references like Class::method simply will not compile. Below is the dependencies section of my build.gradle.

How can I upgrade it such that I am using a newer version of Groovy that supports newer versions of Java?

All of there documentation seems to be out of date, and only references up to Groovy 2.4.

dependencies {
  testCompile(
    'junit:junit:4.12',
    'org.codehaus.groovy:groovy-all:2.4.4',
    'org.spockframework:spock-core:1.0-groovy-2.4',
    'org.springframework.boot:spring-boot:1.2.1.RELEASE',
    'cglib:cglib-nodep:2.2.2',
    'com.opencsv:opencsv:4.1'
  )
}

Body:
Things have changed in 2020. Spock supports Groovy 3 (which supports Java 8+ enhancements, including lambda expression) starting with version 2.0-M2.

For Gradle it should be enough to add a Spock's JAR dedicated for Groovy 3:

testImplementation('org.spockframework:spock-core:2.0-M2-groovy-3.0')

and enable JUnit Platform:

test {
    useJUnitPlatform()
}

Btw, as a person who developed support for Groovy 3 in Spock I gathered various aspects (including caveats) relating migration from Spock 1.3 to 2.0 in a blog post - it might be worth to read it :-).


问:
Bootstrap is messing with my table layout when i use repeater
I have a repeater with a couple nested repeaters. Everythink works fine, except for the layout when I try to use bootstrap. In the first picture

I try to make it work inside a div with class=row. Everything is crazy. Even when i try to have it alone second picture

same mistakes. When i remove all divs, the render is perfect. Here is my code for the first one

```<code> <div class="container-fluid">
    <div class="row">
        <div class="col-sm-2 col-md-2 col-lg-2" style="border-bottom:double;">
            <ul class="nav flex-column" style="margin-left: -15px;">
                (navigate menu)
            </ul>
            </div>
 <div  class="col-sm-10 col-md-10 col-lg-10"  style="border-bottom:double">
                <div class="row">
                    <div class="col-3">
    ... an invisibe panel...
</div>
             <div class="col-12">
    ... panel with search option for populating repeater ...
</div>
                    <div class="col-12">

                <asp:Panel ID="panel_endiaferomenwn_provoli" runat="server">
                <div class="table-responsive table-bordered">
                        <table  style="min-width:950px; width:100%">
                            <tr>
                                <td style="width: 8%; min-width:100px; text-wrap:none" id="last_change"><b>a</b></td>
                                <td style="width: 30%;"><b>b</b></td>
                                <td style="width: 15%;"><b>c</b></td>
                                <td style="width: 10%;"><b>d</b></td>
                                <td style="width: 14%;"><b>e / αγόρασε</b></td>
                                <td style="width: 10%; min-width:100px;"><b>f</b></td>
                                <td style="width: 8%; min-width:100px;"><b>g</b></td>
                                <td style="width: 5%; min-width:80px;"><b>h</b></td>
                            </tr>
                        </table>
                    </div>

                <asp:Repeater ID="rep_all" runat="server" DataSourceID="data_rep" OnPreRender="rep_all_PreRender">
                    <ItemTemplate>
                        <div class="table-responsive table-bordered">
                        <table style="min-width:950px; width:100%;">
                            <tbody>
                            <tr>
                                <td style="width:8%; min-width:100px;"><asp:Label ID="lbl_rep_last_change" runat="server" Text='<%# Convert.ToDateTime(Eval("date_of_last_change")).ToString("dd/MM/yyyy") %>'></asp:Label></td>
                                <td style="width:30%;">
                                 <asp:Repeater ID="rep_details" runat="server">
                                    <ItemTemplate>
                                        <div class="table-responsive">
                                            <table style="width:100%">
                                                <thead>
                                                </thead>
                                                <tbody>
                                                   <tr data-toggle="collapse" class="xeraki" style="width:30%;" data-target="#collapse<%# Eval("id") %>">
                                                        <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                            <asp:Label ID="lbl_det_name_title" Text="Επωνυμία" runat="server" Font-Bold="true"></asp:Label></td>
                                                        <td style="border: none; padding: 1px;">
                                                            <asp:Label ID="lbl_det_name" runat="server" Font-Underline="true" ForeColor="Blue" Text='<%# Eval("name") %>'></asp:Label></td>
                                                       <td style="border: none; padding: 1px;"></td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        <div class="collapse" id="collapse<%# Eval("id") %>">
                                            <div class="table-responsive">
                                        <table style="width:100%">
                                            <tbody>
                                                <tr>
                                                    <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                        <asp:Label ID="lbl_det_til1_title" Text="Τηλ1 " runat="server" Font-Bold="true"></asp:Label>
                                                    </td>
                                                    <td style="border: none; padding: 1px;">
                                                        <asp:Label ID="lbl_det_til1" runat="server" Text='<%# Eval("phone1") %>'></asp:Label></td>
                                                </tr>
                                                <tr>
                                                    <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                        <asp:Label ID="lbl_det_til2_title" Text="Τηλ2 " runat="server" Font-Bold="true"></asp:Label></td>
                                                    <td style="border: none; padding: 1px;">
                                                        <asp:Label ID="lbl_det_til2" runat="server" Text='<%# Eval("phone2") %>'></asp:Label></td>
                                                </tr>
                                                <tr>
                                                    <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                        <asp:Label ID="lbl_det_manager_title" Text="Υπεύθυνος " runat="server" Font-Bold="true"></asp:Label></td>
                                                    <td style="border: none; padding: 1px;">
                                                        <asp:Label ID="lbl_det_manager" runat="server" Text='<%# Eval("manager") %>'></asp:Label></td>
                                                </tr>
                                                <tr>
                                                    <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                        <asp:Label ID="lbl_det_perioxi_title" Text="Περιοχή " runat="server" Font-Bold="true"></asp:Label></td>
                                                    <td style="border: none; padding: 1px;">
                                                        <asp:Label ID="lbl_det_perioxi" runat="server" Text='<%# Eval("area") %>'></asp:Label></td>
                                                </tr>
                                                <tr>
                                                    <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                        <asp:Label ID="lbl_det_address_title" Text="Διεύθυνση " runat="server" Font-Bold="true"></asp:Label></td>
                                                    <td style="border: none; padding: 1px;">
                                                        <asp:Label ID="lbl_det_address" runat="server" Text='<%# Eval("address") %>'></asp:Label></td>
                                                </tr>
                                                <tr>
                                                    <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                        <asp:Label ID="lbl_det_afm_title" Text="ΑΦΜ " runat="server" Font-Bold="true"></asp:Label></td>
                                                    <td style="border: none; padding: 1px;">
                                                        <asp:Label ID="lbl_det_afm" runat="server" Text='<%# Eval("afm") %>'></asp:Label></td>
                                                </tr>
                                                <tr>
                                                    <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                        <asp:Label ID="lbl_det_salesman_title" Text="Πωλητής " runat="server" Font-Bold="true"></asp:Label></td>
                                                    <td style="border: none; padding: 1px;">
                                                        <asp:Label ID="lbl_det_salesman" runat="server" Text='<%# Eval("salesman") %>'></asp:Label></td>
                                                </tr>

                                            </tbody>
                                            </table>
                                            </div>
                                            </div>

                                    </ItemTemplate>
                                    </asp:Repeater>

                                </td>
                                <td style="width:15%;"><asp:Label ID="lbl_rep_show" runat="server" Text='<%# Eval("show") %>'></asp:Label> <asp:Label ID="lbl_rep_id" runat="server" Text='<%# Eval("id") %>' Visible="false"></asp:Label> </td>
                                <td style="width:10%;"><asp:Label ID="lbl_rep_perioxi" runat="server" Text='<%# Eval("area") %>'></asp:Label></td>
                                <td style="width:14%;">
                                    <asp:Repeater ID="rep_rep_inter" runat="server">
                                    <ItemTemplate>
                                        <div class="table-responsive">
                                            <table>
                                                <thead>
                                                </thead>
                                                <tbody>
                                                <tr>
                                                    <td style="border:none;padding:1px;width:55%;"><asp:Label ID="lbl2_name" runat="server" Text='<%# Eval("name") %>'></asp:Label><asp:Label ID="lbl_rep2_id" runat="server" Text='<%# Eval("id") %>' Visible="false"></asp:Label></td>
                                                    <td style="border:none;padding:1px;width:45%;"><asp:CheckBox CssClass="d-flex text-right" ID="check_buy" runat="server" Text="" Enabled="false" /></td>
                                                </tr>
                                                    </tbody>
                                            </table>
                                        </div>
                                    </ItemTemplate>
                                    </asp:Repeater>
                                </td>
                                <td style="width:10%;min-width:100px;"><asp:Label ID="lbl_rep_katastasi" runat="server" Text='<%# Eval("katastasi") %>'></asp:Label> </td>
                                <td style="width:8%;min-width:100px;"><asp:Label ID="lbl_rep_prothesmia" runat="server" Text='<%# Convert.ToDateTime(Eval("date_of_next_step")).ToString("dd/MM/yyyy") %>'></asp:Label></td>
                                <td style="width: 5%; min-width:80px;">
                                    <div class="d-flex justify-content-center"">
                                    <asp:ImageButton ID="btn_expand" runat="server" OnClick="btn_expand_Click" ImageUrl="../webimages/expand-arrow.png" Width="48" />
                                    <asp:ImageButton ID="btn_collapse" runat="server" OnClick="btn_collapse_Click" ImageUrl="../webimages/collapse-arrow.png" Width="48" Visible="false"/>
                                        </div>
                                </td>
                            </tr>

                                <tr>

                                    <div class="table-responsive table-bordered">
                                        <table style="min-width: 950px; width: 100%;">
                                            <tbody>
                                                <tr>

                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>

                                        <div id="expand_epafes" runat="server" class="colapse">
                                            <header>
                                                <div class="table-responsive table-bordered">
                                                <table style="min-width: 950px; width: 100%;">

                                                 <tr>
                                                    <td style="width: 10%; min-width:175px;" id="date_epafes2"><b>Ημερομηνία Επαφής</b></td>
                                                    <td style="width: 45%; text-align:center;"><b>Παρατηρήσεις</b></td>
                                                     <td style="width:15%;"><b>Κατάσταση</b></td>
                                                     <td style="width:10%;"><b>Προθεσμία</b></td>
                                                     <td style="width: 15%;"><b>Προσφορά</b></td>
                                                    <td style="width: 5%; min-width:80px;"><b></b></td>
                                                </tr>

                                                  </table>
                                                    </div>
                                            </header>
                                    <asp:Repeater ID="rep_epafes" runat="server">
                                        <ItemTemplate>
                                            <div class="table-responsive table-bordered">

                                                <table style="min-width: 950px; width: 100%;">

                                                    <tbody>
                                                        <tr>
                                                           <td style="width: 10%; min-width:175px;" id="date_epafes">
                                                               <asp:Label ID="epafes_lbl_imerominia" runat="server" Text='<%# Convert.ToDateTime(Eval("date_made")).ToString("dd/MM/yyyy") %>'></asp:Label>
                                                               <asp:TextBox ID="epafes_edit_imerominia" runat="server" Visible="false" TextMode="Date" Text='<%# Convert.ToDateTime(Eval("date_made")).ToString("yyyy-MM-dd") %>'></asp:TextBox>
                                                           </td>
                                                            <td style="width: 45%;">
                                                               <asp:Label ID="epafes_lbl_remarks" runat="server" Text='<%# Eval("remarks") %>' ></asp:Label>
                                                                <asp:Label ID="lbl_epafes_id_endiaferontos" runat="server" Visible="false" Text='<%# Eval("id_endeiaferontos") %>'></asp:Label>
                                                                <asp:Label ID="lbl_epafes_id_epafis" runat="server" Visible="false" Text='<%# Eval("id") %>' ></asp:Label>
                                                                <asp:TextBox ID="epafes_edit_remarks" runat="server" CssClass="w-100" Visible="false" Text='<%# Eval("remarks") %>'></asp:TextBox>
                                                            </td>
                                                            <td style="width: 15%;">

                                                            </td>
                                                            <td style="width: 10%;">

                                                            </td>
                                                            <td style="width: 15%;">
                                                                <asp:Button ID="btn_test" runat="server" Text="test" OnClick="btn_test_Click"  />
                                                            </td>
                                                            <td style="width: 5%; min-width:80px;" class="d-flex justify-content-center">
                                                                <asp:ImageButton ImageUrl="../webimages/edit.png" ID="btn_edit_edit" runat="server" OnClick="btn_edit_edit_Click" />
                                                                <asp:ImageButton ImageUrl="../webimages/ok.png" ID="btn_edit_save" runat="server" Visible="false" OnClick="btn_edit_save_Click" />
                                                                <asp:ImageButton ImageUrl="../webimages/cancel.png" ID="btn_edit_cancel" runat="server" Visible="false" OnClick="btn_edit_cancel_Click" />
                                                            </td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </ItemTemplate>
                                        <FooterTemplate>
                                            <div class="table-responsive table-bordered">
                                                <table style="min-width: 950px; width: 100%;">
                                                    <tbody>
                                                        <tr>
                                                            <td style="width: 10%; min-width: 175px;">
                                                                <asp:TextBox ID="txt_epafes_date_add" runat="server" TextMode="Date" Text='<%# DateTime.Now.ToString("yyyy-MM-dd") %>'></asp:TextBox>
                                                            </td>
                                                            <td style="width: 50%;">
                                                                <asp:TextBox ID="txt_epafes_remarks_add" runat="server" Placeholder="Παρατηρήσεις" CssClass="w-100" ></asp:TextBox>
                                                            </td>
                                                            <td style="width:20%;">
                                                            </td>
                                                            <td style="width: 15%;">

                                                            </td>
                                                            <td style="width: 5%; min-width: 80px;" class="d-flex justify-content-center">
                                                                <asp:ImageButton ImageUrl="../webimages/save.png" ID="btn_epafi_add" runat="server" OnClick="btn_epafi_add_Click" />
                                                            </td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </FooterTemplate>
                                    </asp:Repeater>
                                       </div>
                                </tr>
                                </tbody>
                        </table>
                            </div>
                    </ItemTemplate>
                </asp:Repeater>

                <asp:SqlDataSource ID="data_rep" runat="server" (connectio details) ></asp:SqlDataSource>
                    </asp:Panel>

                </div>

                </div>
 </div>

        </div>

</div>
</code>```

I am sorry for the long code, tried to make it shorter. I also include a picture with code collapsed, to help you see it easier.

答:
Clean code will help a lot in knowing where you are at, I think you had an extra div element that wasn't suppost to be there:

```

            (navigate menu)

                ... an invisibe panel...

                ... panel with search option for populating repeater ...

                <asp:Panel ID="panel_endiaferomenwn_provoli" runat="server">

                                a
                                b
                                c
                                d
                                e / αγόρασε
                                f
                                g
                                h

                    <asp:Repeater ID="rep_all" runat="server" DataSourceID="data_rep" OnPreRender="rep_all_PreRender">
                        <ItemTemplate>

                                                <asp:Label ID="lbl_rep_last_change" runat="server" Text='<%# Convert.ToDateTime(Eval("date_of_last_change")).ToString("dd/MM/yyyy") %>'></asp:Label>

                                                <asp:Repeater ID="rep_details" runat="server">
                                                    <ItemTemplate>

                                                                    <tr data-toggle="collapse" class="xeraki" style="width:30%;" data-target="#collapse<%# Eval(" id ") %>">

                                                                            <asp:Label ID="lbl_det_name_title" Text="Επωνυμία" runat="server" Font-Bold="true"></asp:Label>

                                                                            <asp:Label ID="lbl_det_name" runat="server" Font-Underline="true" ForeColor="Blue" Text='<%# Eval("name") %>'></asp:Label>

                                                        <div class="collapse" id="collapse<%# Eval(" id ") %>">

                                                                                <asp:Label ID="lbl_det_til1_title" Text="Τηλ1 " runat="server" Font-Bold="true"></asp:Label>

                                                                                <asp:Label ID="lbl_det_til1" runat="server" Text='<%# Eval("phone1") %>'></asp:Label>

                                                                                <asp:Label ID="lbl_det_til2_title" Text="Τηλ2 " runat="server" Font-Bold="true"></asp:Label>

                                                                                <asp:Label ID="lbl_det_til2" runat="server" Text='<%# Eval("phone2") %>'></asp:Label>

                                                                                <asp:Label ID="lbl_det_manager_title" Text="Υπεύθυνος " runat="server" Font-Bold="true"></asp:Label>

                                                                                <asp:Label ID="lbl_det_manager" runat="server" Text='<%# Eval("manager") %>'></asp:Label>

                                                                                <asp:Label ID="lbl_det_perioxi_title" Text="Περιοχή " runat="server" Font-Bold="true"></asp:Label>

                                                                                <asp:Label ID="lbl_det_perioxi" runat="server" Text='<%# Eval("area") %>'></asp:Label>

                                                                                <asp:Label ID="lbl_det_address_title" Text="Διεύθυνση " runat="server" Font-Bold="true"></asp:Label>

                                                                                <asp:Label ID="lbl_det_address" runat="server" Text='<%# Eval("address") %>'></asp:Label>

                                                                                <asp:Label ID="lbl_det_afm_title" Text="ΑΦΜ " runat="server" Font-Bold="true"></asp:Label>

                                                                                <asp:Label ID="lbl_det_afm" runat="server" Text='<%# Eval("afm") %>'></asp:Label>

                                                                                <asp:Label ID="lbl_det_salesman_title" Text="Πωλητής " runat="server" Font-Bold="true"></asp:Label>

                                                                                <asp:Label ID="lbl_det_salesman" runat="server" Text='<%# Eval("salesman") %>'></asp:Label>

                                                    </ItemTemplate>
                                                </asp:Repeater>

                                                <asp:Label ID="lbl_rep_show" runat="server" Text='<%# Eval("show") %>'></asp:Label>
                                                <asp:Label ID="lbl_rep_id" runat="server" Text='<%# Eval("id") %>' Visible="false"></asp:Label>

                                                <asp:Label ID="lbl_rep_perioxi" runat="server" Text='<%# Eval("area") %>'></asp:Label>

                                                <asp:Repeater ID="rep_rep_inter" runat="server">
                                                    <ItemTemplate>

                                                                            <asp:Label ID="lbl2_name" runat="server" Text='<%# Eval("name") %>'></asp:Label>
                                                                            <asp:Label ID="lbl_rep2_id" runat="server" Text='<%# Eval("id") %>' Visible="false"></asp:Label>

                                                                            <asp:CheckBox CssClass="d-flex text-right" ID="check_buy" runat="server" Text="" Enabled="false" />

                                                    </ItemTemplate>
                                                </asp:Repeater>

                                                <asp:Label ID="lbl_rep_katastasi" runat="server" Text='<%# Eval("katastasi") %>'></asp:Label>

                                                <asp:Label ID="lbl_rep_prothesmia" runat="server" Text='<%# Convert.ToDateTime(Eval("date_of_next_step")).ToString("dd/MM/yyyy") %>'></asp:Label>

                                <asp:ImageButton ID="btn_expand " runat="server " OnClick="btn_expand_Click " ImageUrl="../webimages/expand-arrow.png " Width="48 " />
                                <asp:ImageButton ID="btn_collapse " runat="server " OnClick="btn_collapse_Click " ImageUrl="../webimages/collapse-arrow.png " Width="48 " Visible="false "/>

                                                Ημερομηνία Επαφής
                                                Παρατηρήσεις
                                                 Κατάσταση
                                                 Προθεσμία
                                                 Προσφορά

                                <asp:Repeater ID="rep_epafes " runat="server ">
                                    <ItemTemplate>

                                                           <asp:Label ID="epafes_lbl_imerominia " runat="server " Text='<%# Convert.ToDateTime(Eval("date_made ")).ToString("dd/MM/yyyy ") %>'></asp:Label>
                                                           <asp:TextBox ID="epafes_edit_imerominia " runat="server " Visible="false " TextMode="Date " Text='<%# Convert.ToDateTime(Eval("date_made ")).ToString("yyyy-MM-dd ") %>'></asp:TextBox>

                                                           <asp:Label ID="epafes_lbl_remarks " runat="server " Text='<%# Eval("remarks ") %>' ></asp:Label>
                                                            <asp:Label ID="lbl_epafes_id_endiaferontos " runat="server " Visible="false " Text='<%# Eval("id_endeiaferontos ") %>'></asp:Label>
                                                            <asp:Label ID="lbl_epafes_id_epafis " runat="server " Visible="false " Text='<%# Eval("id ") %>' ></asp:Label>
                                                            <asp:TextBox ID="epafes_edit_remarks " runat="server " CssClass="w-100 " Visible="false " Text='<%# Eval("remarks ") %>'></asp:TextBox>

                                                            <asp:Button ID="btn_test " runat="server " Text="test " OnClick="btn_test_Click "  />

                                                            <asp:ImageButton ImageUrl="../webimages/edit.png " ID="btn_edit_edit " runat="server " OnClick="btn_edit_edit_Click " />
                                                            <asp:ImageButton ImageUrl="../webimages/ok.png " ID="btn_edit_save " runat="server " Visible="false " OnClick="btn_edit_save_Click " />
                                                            <asp:ImageButton ImageUrl="../webimages/cancel.png " ID="btn_edit_cancel " runat="server " Visible="false " OnClick="btn_edit_cancel_Click " />

                                    </ItemTemplate>
                                    <FooterTemplate>

                                                            <asp:TextBox ID="txt_epafes_date_add " runat="server " TextMode="Date " Text='<%# DateTime.Now.ToString("yyyy-MM-dd ") %>'></asp:TextBox>

                                                            <asp:TextBox ID="txt_epafes_remarks_add " runat="server " Placeholder="Παρατηρήσεις " CssClass="w-100 " ></asp:TextBox>

                                                            <asp:ImageButton ImageUrl="../webimages/save.png " ID="btn_epafi_add " runat="server " OnClick="btn_epafi_add_Click " />

                                    </FooterTemplate>
                                </asp:Repeater>

                </ItemTemplate>
            </asp:Repeater>

            <asp:SqlDataSource ID="data_rep " runat="server " (connectio details) ></asp:SqlDataSource>
                </asp:Panel>

```

Body:
I have a repeater with a couple nested repeaters. Everythink works fine, except for the layout when I try to use bootstrap. In the first picture

I try to make it work inside a div with class=row. Everything is crazy. Even when i try to have it alone second picture

same mistakes. When i remove all divs, the render is perfect. Here is my code for the first one

                (navigate menu)

    ... an invisibe panel...

    ... panel with search option for populating repeater ...

                <asp:Panel ID="panel_endiaferomenwn_provoli" runat="server">

                                a
                                b
                                c
                                d
                                e / αγόρασε
                                f
                                g
                                h

                <asp:Repeater ID="rep_all" runat="server" DataSourceID="data_rep" OnPreRender="rep_all_PreRender">
                    <ItemTemplate>

                                <asp:Label ID="lbl_rep_last_change" runat="server" Text='<%# Convert.ToDateTime(Eval("date_of_last_change")).ToString("dd/MM/yyyy") %>'></asp:Label>

                                 <asp:Repeater ID="rep_details" runat="server">
                                    <ItemTemplate>

                                                   <tr data-toggle="collapse" class="xeraki" style="width:30%;" data-target="#collapse<%# Eval("id") %>">

                                                            <asp:Label ID="lbl_det_name_title" Text="Επωνυμία" runat="server" Font-Bold="true"></asp:Label>

                                                            <asp:Label ID="lbl_det_name" runat="server" Font-Underline="true" ForeColor="Blue" Text='<%# Eval("name") %>'></asp:Label>

                                        <div class="collapse" id="collapse<%# Eval("id") %>">

                                                        <asp:Label ID="lbl_det_til1_title" Text="Τηλ1 " runat="server" Font-Bold="true"></asp:Label>

                                                        <asp:Label ID="lbl_det_til1" runat="server" Text='<%# Eval("phone1") %>'></asp:Label>

                                                        <asp:Label ID="lbl_det_til2_title" Text="Τηλ2 " runat="server" Font-Bold="true"></asp:Label>

                                                        <asp:Label ID="lbl_det_til2" runat="server" Text='<%# Eval("phone2") %>'></asp:Label>

                                                        <asp:Label ID="lbl_det_manager_title" Text="Υπεύθυνος " runat="server" Font-Bold="true"></asp:Label>

                                                        <asp:Label ID="lbl_det_manager" runat="server" Text='<%# Eval("manager") %>'></asp:Label>

                                                        <asp:Label ID="lbl_det_perioxi_title" Text="Περιοχή " runat="server" Font-Bold="true"></asp:Label>

                                                        <asp:Label ID="lbl_det_perioxi" runat="server" Text='<%# Eval("area") %>'></asp:Label>

                                                        <asp:Label ID="lbl_det_address_title" Text="Διεύθυνση " runat="server" Font-Bold="true"></asp:Label>

                                                        <asp:Label ID="lbl_det_address" runat="server" Text='<%# Eval("address") %>'></asp:Label>

                                                        <asp:Label ID="lbl_det_afm_title" Text="ΑΦΜ " runat="server" Font-Bold="true"></asp:Label>

                                                        <asp:Label ID="lbl_det_afm" runat="server" Text='<%# Eval("afm") %>'></asp:Label>

                                                        <asp:Label ID="lbl_det_salesman_title" Text="Πωλητής " runat="server" Font-Bold="true"></asp:Label>

                                                        <asp:Label ID="lbl_det_salesman" runat="server" Text='<%# Eval("salesman") %>'></asp:Label>

                                    </ItemTemplate>
                                    </asp:Repeater>

                                <asp:Label ID="lbl_rep_show" runat="server" Text='<%# Eval("show") %>'></asp:Label> <asp:Label ID="lbl_rep_id" runat="server" Text='<%# Eval("id") %>' Visible="false"></asp:Label>
                                <asp:Label ID="lbl_rep_perioxi" runat="server" Text='<%# Eval("area") %>'></asp:Label>

                                    <asp:Repeater ID="rep_rep_inter" runat="server">
                                    <ItemTemplate>

                                                    <asp:Label ID="lbl2_name" runat="server" Text='<%# Eval("name") %>'></asp:Label><asp:Label ID="lbl_rep2_id" runat="server" Text='<%# Eval("id") %>' Visible="false"></asp:Label>
                                                    <asp:CheckBox CssClass="d-flex text-right" ID="check_buy" runat="server" Text="" Enabled="false" />

                                    </ItemTemplate>
                                    </asp:Repeater>

                                <asp:Label ID="lbl_rep_katastasi" runat="server" Text='<%# Eval("katastasi") %>'></asp:Label>
                                <asp:Label ID="lbl_rep_prothesmia" runat="server" Text='<%# Convert.ToDateTime(Eval("date_of_next_step")).ToString("dd/MM/yyyy") %>'></asp:Label>

                                    <asp:ImageButton ID="btn_expand" runat="server" OnClick="btn_expand_Click" ImageUrl="../webimages/expand-arrow.png" Width="48" />
                                    <asp:ImageButton ID="btn_collapse" runat="server" OnClick="btn_collapse_Click" ImageUrl="../webimages/collapse-arrow.png" Width="48" Visible="false"/>

                                                    Ημερομηνία Επαφής
                                                    Παρατηρήσεις
                                                     Κατάσταση
                                                     Προθεσμία
                                                     Προσφορά

                                    <asp:Repeater ID="rep_epafes" runat="server">
                                        <ItemTemplate>

                                                               <asp:Label ID="epafes_lbl_imerominia" runat="server" Text='<%# Convert.ToDateTime(Eval("date_made")).ToString("dd/MM/yyyy") %>'></asp:Label>
                                                               <asp:TextBox ID="epafes_edit_imerominia" runat="server" Visible="false" TextMode="Date" Text='<%# Convert.ToDateTime(Eval("date_made")).ToString("yyyy-MM-dd") %>'></asp:TextBox>

                                                               <asp:Label ID="epafes_lbl_remarks" runat="server" Text='<%# Eval("remarks") %>' ></asp:Label>
                                                                <asp:Label ID="lbl_epafes_id_endiaferontos" runat="server" Visible="false" Text='<%# Eval("id_endeiaferontos") %>'></asp:Label>
                                                                <asp:Label ID="lbl_epafes_id_epafis" runat="server" Visible="false" Text='<%# Eval("id") %>' ></asp:Label>
                                                                <asp:TextBox ID="epafes_edit_remarks" runat="server" CssClass="w-100" Visible="false" Text='<%# Eval("remarks") %>'></asp:TextBox>

                                                                <asp:Button ID="btn_test" runat="server" Text="test" OnClick="btn_test_Click"  />

                                                                <asp:ImageButton ImageUrl="../webimages/edit.png" ID="btn_edit_edit" runat="server" OnClick="btn_edit_edit_Click" />
                                                                <asp:ImageButton ImageUrl="../webimages/ok.png" ID="btn_edit_save" runat="server" Visible="false" OnClick="btn_edit_save_Click" />
                                                                <asp:ImageButton ImageUrl="../webimages/cancel.png" ID="btn_edit_cancel" runat="server" Visible="false" OnClick="btn_edit_cancel_Click" />

                                        </ItemTemplate>
                                        <FooterTemplate>

                                                                <asp:TextBox ID="txt_epafes_date_add" runat="server" TextMode="Date" Text='<%# DateTime.Now.ToString("yyyy-MM-dd") %>'></asp:TextBox>

                                                                <asp:TextBox ID="txt_epafes_remarks_add" runat="server" Placeholder="Παρατηρήσεις" CssClass="w-100" ></asp:TextBox>

                                                                <asp:ImageButton ImageUrl="../webimages/save.png" ID="btn_epafi_add" runat="server" OnClick="btn_epafi_add_Click" />

                                        </FooterTemplate>
                                    </asp:Repeater>

                    </ItemTemplate>
                </asp:Repeater>

                <asp:SqlDataSource ID="data_rep" runat="server" (connectio details) ></asp:SqlDataSource>
                    </asp:Panel>

I am sorry for the long code, tried to make it shorter. I also include a picture with code collapsed, to help you see it easier.

Body:
Clean code will help a lot in knowing where you are at, I think you had an extra div element that wasn't suppost to be there:

<div class="container-fluid">
<div class="row">
    <div class="col-sm-2 col-md-2 col-lg-2" style="border-bottom:double;">
        <ul class="nav flex-column" style="margin-left: -15px;">
            (navigate menu)
        </ul>
    </div>
    <div class="col-sm-10 col-md-10 col-lg-10" style="border-bottom:double">
        <div class="row">
            <div class="col-3">
                ... an invisibe panel...
            </div>
            <div class="col-12">
                ... panel with search option for populating repeater ...
            </div>
            <div class="col-12">

                <asp:Panel ID="panel_endiaferomenwn_provoli" runat="server">
                    <div class="table-responsive table-bordered">
                        <table style="min-width:950px; width:100%">
                            <tr>
                                <td style="width: 8%; min-width:100px; text-wrap:none" id="last_change"><b>a</b></td>
                                <td style="width: 30%;"><b>b</b></td>
                                <td style="width: 15%;"><b>c</b></td>
                                <td style="width: 10%;"><b>d</b></td>
                                <td style="width: 14%;"><b>e / αγόρασε</b></td>
                                <td style="width: 10%; min-width:100px;"><b>f</b></td>
                                <td style="width: 8%; min-width:100px;"><b>g</b></td>
                                <td style="width: 5%; min-width:80px;"><b>h</b></td>
                            </tr>
                        </table>
                    </div>

                    <asp:Repeater ID="rep_all" runat="server" DataSourceID="data_rep" OnPreRender="rep_all_PreRender">
                        <ItemTemplate>
                            <div class="table-responsive table-bordered">
                                <table style="min-width:950px; width:100%;">
                                    <tbody>
                                        <tr>
                                            <td style="width:8%; min-width:100px;">
                                                <asp:Label ID="lbl_rep_last_change" runat="server" Text='<%# Convert.ToDateTime(Eval("date_of_last_change")).ToString("dd/MM/yyyy") %>'></asp:Label>
                                            </td>
                                            <td style="width:30%;">
                                                <asp:Repeater ID="rep_details" runat="server">
                                                    <ItemTemplate>
                                                        <div class="table-responsive">
                                                            <table style="width:100%">
                                                                <thead>
                                                                </thead>
                                                                <tbody>
                                                                    <tr data-toggle="collapse" class="xeraki" style="width:30%;" data-target="#collapse<%# Eval(" id ") %>">
                                                                        <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                                            <asp:Label ID="lbl_det_name_title" Text="Επωνυμία" runat="server" Font-Bold="true"></asp:Label>
                                                                        </td>
                                                                        <td style="border: none; padding: 1px;">
                                                                            <asp:Label ID="lbl_det_name" runat="server" Font-Underline="true" ForeColor="Blue" Text='<%# Eval("name") %>'></asp:Label>
                                                                        </td>
                                                                        <td style="border: none; padding: 1px;"></td>
                                                                    </tr>
                                                                </tbody>
                                                            </table>
                                                        </div>
                                                        <div class="collapse" id="collapse<%# Eval(" id ") %>">
                                                            <div class="table-responsive">
                                                                <table style="width:100%">
                                                                    <tbody>
                                                                        <tr>
                                                                            <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                                                <asp:Label ID="lbl_det_til1_title" Text="Τηλ1 " runat="server" Font-Bold="true"></asp:Label>
                                                                            </td>
                                                                            <td style="border: none; padding: 1px;">
                                                                                <asp:Label ID="lbl_det_til1" runat="server" Text='<%# Eval("phone1") %>'></asp:Label>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                                                <asp:Label ID="lbl_det_til2_title" Text="Τηλ2 " runat="server" Font-Bold="true"></asp:Label>
                                                                            </td>
                                                                            <td style="border: none; padding: 1px;">
                                                                                <asp:Label ID="lbl_det_til2" runat="server" Text='<%# Eval("phone2") %>'></asp:Label>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                                                <asp:Label ID="lbl_det_manager_title" Text="Υπεύθυνος " runat="server" Font-Bold="true"></asp:Label>
                                                                            </td>
                                                                            <td style="border: none; padding: 1px;">
                                                                                <asp:Label ID="lbl_det_manager" runat="server" Text='<%# Eval("manager") %>'></asp:Label>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                                                <asp:Label ID="lbl_det_perioxi_title" Text="Περιοχή " runat="server" Font-Bold="true"></asp:Label>
                                                                            </td>
                                                                            <td style="border: none; padding: 1px;">
                                                                                <asp:Label ID="lbl_det_perioxi" runat="server" Text='<%# Eval("area") %>'></asp:Label>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                                                <asp:Label ID="lbl_det_address_title" Text="Διεύθυνση " runat="server" Font-Bold="true"></asp:Label>
                                                                            </td>
                                                                            <td style="border: none; padding: 1px;">
                                                                                <asp:Label ID="lbl_det_address" runat="server" Text='<%# Eval("address") %>'></asp:Label>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                                                <asp:Label ID="lbl_det_afm_title" Text="ΑΦΜ " runat="server" Font-Bold="true"></asp:Label>
                                                                            </td>
                                                                            <td style="border: none; padding: 1px;">
                                                                                <asp:Label ID="lbl_det_afm" runat="server" Text='<%# Eval("afm") %>'></asp:Label>
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td style="border: none; padding: 1px; width: 40%; text-wrap: none;">
                                                                                <asp:Label ID="lbl_det_salesman_title" Text="Πωλητής " runat="server" Font-Bold="true"></asp:Label>
                                                                            </td>
                                                                            <td style="border: none; padding: 1px;">
                                                                                <asp:Label ID="lbl_det_salesman" runat="server" Text='<%# Eval("salesman") %>'></asp:Label>
                                                                            </td>
                                                                        </tr>

                                                                    </tbody>
                                                                </table>
                                                            </div>
                                                        </div>

                                                    </ItemTemplate>
                                                </asp:Repeater>

                                            </td>
                                            <td style="width:15%;">
                                                <asp:Label ID="lbl_rep_show" runat="server" Text='<%# Eval("show") %>'></asp:Label>
                                                <asp:Label ID="lbl_rep_id" runat="server" Text='<%# Eval("id") %>' Visible="false"></asp:Label>
                                            </td>
                                            <td style="width:10%;">
                                                <asp:Label ID="lbl_rep_perioxi" runat="server" Text='<%# Eval("area") %>'></asp:Label>
                                            </td>
                                            <td style="width:14%;">
                                                <asp:Repeater ID="rep_rep_inter" runat="server">
                                                    <ItemTemplate>
                                                        <div class="table-responsive">
                                                            <table>
                                                                <thead>
                                                                </thead>
                                                                <tbody>
                                                                    <tr>
                                                                        <td style="border:none;padding:1px;width:55%;">
                                                                            <asp:Label ID="lbl2_name" runat="server" Text='<%# Eval("name") %>'></asp:Label>
                                                                            <asp:Label ID="lbl_rep2_id" runat="server" Text='<%# Eval("id") %>' Visible="false"></asp:Label>
                                                                        </td>
                                                                        <td style="border:none;padding:1px;width:45%;">
                                                                            <asp:CheckBox CssClass="d-flex text-right" ID="check_buy" runat="server" Text="" Enabled="false" />
                                                                        </td>
                                                                    </tr>
                                                                </tbody>
                                                            </table>
                                                        </div>
                                                    </ItemTemplate>
                                                </asp:Repeater>
                                            </td>
                                            <td style="width:10%;min-width:100px;">
                                                <asp:Label ID="lbl_rep_katastasi" runat="server" Text='<%# Eval("katastasi") %>'></asp:Label>
                                            </td>
                                            <td style="width:8%;min-width:100px;">
                                                <asp:Label ID="lbl_rep_prothesmia" runat="server" Text='<%# Convert.ToDateTime(Eval("date_of_next_step")).ToString("dd/MM/yyyy") %>'></asp:Label>
                                            </td>
                                            <td style="width: 5%; min-width:80px;">
                                                <div class="d-flex justify-content-center" ">
                                <asp:ImageButton ID="btn_expand " runat="server " OnClick="btn_expand_Click " ImageUrl="../webimages/expand-arrow.png " Width="48 " />
                                <asp:ImageButton ID="btn_collapse " runat="server " OnClick="btn_collapse_Click " ImageUrl="../webimages/collapse-arrow.png " Width="48 " Visible="false "/>
                                    </div>
                            </td>
                        </tr>

                            <tr>

                                <div class="table-responsive table-bordered ">
                                    <table style="min-width: 950px; width: 100%; ">
                                        <tbody>
                                            <tr>

                                            </tr>
                                        </tbody>
                                    </table>
                                </div>

                                    <div id="expand_epafes " runat="server " class="colapse ">
                                        <header>
                                            <div class="table-responsive table-bordered ">
                                            <table style="min-width: 950px; width: 100%; ">

                                             <tr>
                                                <td style="width: 10%; min-width:175px; " id="date_epafes2 "><b>Ημερομηνία Επαφής</b></td>
                                                <td style="width: 45%; text-align:center; "><b>Παρατηρήσεις</b></td>
                                                 <td style="width:15%; "><b>Κατάσταση</b></td>
                                                 <td style="width:10%; "><b>Προθεσμία</b></td>
                                                 <td style="width: 15%; "><b>Προσφορά</b></td>
                                                <td style="width: 5%; min-width:80px; "><b></b></td>
                                            </tr>

                                              </table>
                                                </div>
                                        </header>
                                <asp:Repeater ID="rep_epafes " runat="server ">
                                    <ItemTemplate>
                                        <div class="table-responsive table-bordered ">

                                            <table style="min-width: 950px; width: 100%; ">

                                                <tbody>
                                                    <tr>
                                                       <td style="width: 10%; min-width:175px; " id="date_epafes ">
                                                           <asp:Label ID="epafes_lbl_imerominia " runat="server " Text='<%# Convert.ToDateTime(Eval("date_made ")).ToString("dd/MM/yyyy ") %>'></asp:Label>
                                                           <asp:TextBox ID="epafes_edit_imerominia " runat="server " Visible="false " TextMode="Date " Text='<%# Convert.ToDateTime(Eval("date_made ")).ToString("yyyy-MM-dd ") %>'></asp:TextBox>
                                                       </td>
                                                        <td style="width: 45%; ">
                                                           <asp:Label ID="epafes_lbl_remarks " runat="server " Text='<%# Eval("remarks ") %>' ></asp:Label>
                                                            <asp:Label ID="lbl_epafes_id_endiaferontos " runat="server " Visible="false " Text='<%# Eval("id_endeiaferontos ") %>'></asp:Label>
                                                            <asp:Label ID="lbl_epafes_id_epafis " runat="server " Visible="false " Text='<%# Eval("id ") %>' ></asp:Label>
                                                            <asp:TextBox ID="epafes_edit_remarks " runat="server " CssClass="w-100 " Visible="false " Text='<%# Eval("remarks ") %>'></asp:TextBox>
                                                        </td>
                                                        <td style="width: 15%; ">

                                                        </td>
                                                        <td style="width: 10%; ">

                                                        </td>
                                                        <td style="width: 15%; ">
                                                            <asp:Button ID="btn_test " runat="server " Text="test " OnClick="btn_test_Click "  />
                                                        </td>
                                                        <td style="width: 5%; min-width:80px; " class="d-flex justify-content-center ">
                                                            <asp:ImageButton ImageUrl="../webimages/edit.png " ID="btn_edit_edit " runat="server " OnClick="btn_edit_edit_Click " />
                                                            <asp:ImageButton ImageUrl="../webimages/ok.png " ID="btn_edit_save " runat="server " Visible="false " OnClick="btn_edit_save_Click " />
                                                            <asp:ImageButton ImageUrl="../webimages/cancel.png " ID="btn_edit_cancel " runat="server " Visible="false " OnClick="btn_edit_cancel_Click " />
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                        <div class="table-responsive table-bordered ">
                                            <table style="min-width: 950px; width: 100%; ">
                                                <tbody>
                                                    <tr>
                                                        <td style="width: 10%; min-width: 175px; ">
                                                            <asp:TextBox ID="txt_epafes_date_add " runat="server " TextMode="Date " Text='<%# DateTime.Now.ToString("yyyy-MM-dd ") %>'></asp:TextBox>
                                                        </td>
                                                        <td style="width: 50%; ">
                                                            <asp:TextBox ID="txt_epafes_remarks_add " runat="server " Placeholder="Παρατηρήσεις " CssClass="w-100 " ></asp:TextBox>
                                                        </td>
                                                        <td style="width:20%; ">
                                                        </td>
                                                        <td style="width: 15%; ">

                                                        </td>
                                                        <td style="width: 5%; min-width: 80px; " class="d-flex justify-content-center ">
                                                            <asp:ImageButton ImageUrl="../webimages/save.png " ID="btn_epafi_add " runat="server " OnClick="btn_epafi_add_Click " />
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </FooterTemplate>
                                </asp:Repeater>
                                   </div>
                            </tr>
                            </tbody>
                    </table>
                        </div>
                </ItemTemplate>
            </asp:Repeater>

            <asp:SqlDataSource ID="data_rep " runat="server " (connectio details) ></asp:SqlDataSource>
                </asp:Panel>

        </div>

    </div>

</div>


问:
How can I change only my array when I click in a button?
I have a array with animals. For the moment I can display all the animal in a array but I want to display only some animals when I click on a button.

This is my html code :

```<code><br>
<table>
  <thead class="thead-dark">
    <tr>
      <th scope="col">Nos especes</th>
    </tr>
  </thead>
  <tbody>
      <tr *ngFor="let a of especeAnimalPresente">
        <td>
          <a href="#" class="animated-button1">
            <span></span>
            <span></span>
            <span></span>
            <span></span>
            {{a}}
          </a>
        </td>
      </tr>
    </tbody>
</table>
<br>
<table class="table" style="color:white">
    <thead class="thead-dark">
      <tr>
        <th scope="col">#</th>
        <th scope="col">Espece</th>
        <th scope="col">Nom</th>
        <th scope="col">Sexe</th>
        <th scope="col">Signe distinctif</th>
        <th scope="col">Bilan de sante</th>
        <th scope="col">Date arrivee</th>
        <th scope="col">Date depart</th>
        <th scope="col">Taille</th>
        <th scope="col">Age</th>
        <th scope="col">Bassin d'appartenance</th>
      </tr>
    </thead>
    <tbody>
        <tr *ngFor="let a of animaux">
          <th scope="row">{{a.id}}</th>
          <td>{{a.espece}}</td>
          <td>{{a.nom}}</td>
          <td>{{a.sexe}}</td>
          <td>{{a.signeDistinctif}}</td>
          <td>{{a.bilanSante}}</td>
          <td>{{a.dateArr}}</td>
          <td>{{a.dateDep}}</td>
          <td>{{a.taille}}</td>
          <td>{{a.age}}</td>
          <td>{{a.bassinAppartenance}}</td>
        </tr>
      </tbody>
</table>
</code>```

and this is the code in my animal.component.ts :

```<code>import { Component, OnInit } from '@angular/core';
import { AnimalService } from "./animal.service";
import { Animal } from "./animal";

@Component({
  selector: 'app-animal',
  templateUrl: './animal.component.html',
  styleUrls: ['./animal.component.css']
})
export class AnimalComponent implements OnInit {

  private animaux:Array<Animal>;
  private especeAnimalPresente:Array<string>;
  private especeAnimalPresenteTmp:Array<string>;
  constructor(private animalService: AnimalService) {
    this.especeAnimalPresenteTmp = [];
  }

  ngOnInit() {
    this.recupAllAnimals();
  }

  recupAllAnimals(){
    this.animalService.getAllAnimaux().subscribe(data => {
      this.animaux = data;
      this.recupEspecePresent();
    })

  }

  recupEspecePresent(){
     if (this.animaux){
      for (let animal of this.animaux) {
          this.especeAnimalPresenteTmp.push(animal.espece);
      }
      this.especeAnimalPresente = this.removeDuplicates(this.especeAnimalPresenteTmp);
     }
  }

  removeDuplicates(array) {
    let unique = {};
    array.forEach(function(i) {
      if(!unique[i]) {
        unique[i] = true;
      }
    });
    return Object.keys(unique);
  }

}
</code>```

For the moment I have this result :

I want to change only the array when I clic on a button.

Someone can help me please ?

答:
You can do it like so:

```<code><a href="#" class="animated-button1" (click)="$event.preventDefault(); filterAnimals(a)">
  <span></span>
  <span></span>
  <span></span>
  <span></span>
  {{a}}
</a>
</code>```

and in your controller:

```<code>filterAnimals(animal) {
  this.animaux = this.animaux.filter(el => el.espece === animal.espece)
}
</code>```

maybe use another variable like this.filteredAnimals so you can still have the whole list in this.animaux

Body:
I have a array with animals. For the moment I can display all the animal in a array but I want to display only some animals when I click on a button.

This is my html code :

      Nos especes

            {{a}}

        #
        Espece
        Nom
        Sexe
        Signe distinctif
        Bilan de sante
        Date arrivee
        Date depart
        Taille
        Age
        Bassin d'appartenance

          {{a.id}}
          {{a.espece}}
          {{a.nom}}
          {{a.sexe}}
          {{a.signeDistinctif}}
          {{a.bilanSante}}
          {{a.dateArr}}
          {{a.dateDep}}
          {{a.taille}}
          {{a.age}}
          {{a.bassinAppartenance}}

and this is the code in my animal.component.ts :

import { Component, OnInit } from '@angular/core';
import { AnimalService } from "./animal.service";
import { Animal } from "./animal";

@Component({
  selector: 'app-animal',
  templateUrl: './animal.component.html',
  styleUrls: ['./animal.component.css']
})
export class AnimalComponent implements OnInit {

  private animaux:Array<Animal>;
  private especeAnimalPresente:Array<string>;
  private especeAnimalPresenteTmp:Array<string>;
  constructor(private animalService: AnimalService) {
    this.especeAnimalPresenteTmp = [];
  }

  ngOnInit() {
    this.recupAllAnimals();
  }

  recupAllAnimals(){
    this.animalService.getAllAnimaux().subscribe(data => {
      this.animaux = data;
      this.recupEspecePresent();
    })

  }

  recupEspecePresent(){
     if (this.animaux){
      for (let animal of this.animaux) {
          this.especeAnimalPresenteTmp.push(animal.espece);
      }
      this.especeAnimalPresente = this.removeDuplicates(this.especeAnimalPresenteTmp);
     }
  }

  removeDuplicates(array) {
    let unique = {};
    array.forEach(function(i) {
      if(!unique[i]) {
        unique[i] = true;
      }
    });
    return Object.keys(unique);
  }

}

For the moment I have this result :

I want to change only the array when I clic on a button.

Someone can help me please ?

Body:
You can do it like so:

<a href="#" class="animated-button1" (click)="$event.preventDefault(); filterAnimals(a)">
  <span></span>
  <span></span>
  <span></span>
  <span></span>
  {{a}}
</a>

and in your controller:

filterAnimals(animal) {
  this.animaux = this.animaux.filter(el => el.espece === animal.espece)
}

maybe use another variable like this.filteredAnimals so you can still have the whole list in this.animaux


问:
Cucumber StepDef ResultActions NullPointerException
I am receiving the following NullPointerException when trying to execute a Cucumber StepDefs file that passes a JSON from a .feature file to a REST endpoint on localhost;

I have tried to instantiate the ResultActions in every other way, receiving the same error.

The Controller works linked to the test is fine, and is pointing to the correct REST endpoint.

The issue is with the result in personStepDefs

I don't think I'm missing a parameter for ResultActions result as I've built my RequestBuilder

```<code>java.lang.NullPointerException at com.///.v2.PersonStepDefs.i\_add\_a\_new\_Person\_using\_POST\_at\_with\_JSON([PersonStepDefs.java:49](https://PersonStepDefs.java:49)) at

✽.I add a new Person using POST at "[http://localhost:8080/services/person/add](http://localhost:8080/services/person/add)" with JSON:(file:///C:/path/to/src/test/resources/Person.feature:6)
</code>```

PersonStepDefs.java

```<code>import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.WebApplicationContext;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@Transactional
/**
 * Person Step Definition class to execute Scenario contained in Person.feature
 * @author Lewis Jones
 *
 */
public class PersonStepDefs {

    @Autowired
    private volatile WebApplicationContext wac;

    @Autowired
    private volatile MockMvc mockMvc;

    private ResultActions result;

    /**
     * Runs the application server before every scenario.
     */
    @BeforeClass
    public void setup() {
        this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
    }

    @When("I add a new Person using POST at {string} with JSON:")
    public void i_add_a_new_Person_using_POST_at_with_JSON(String request, String json) throws Exception {
        result = mockMvc.perform(post(request).contentType(MediaType.APPLICATION_JSON)
                .content(json.getBytes()));
    }

    @Then("the response code should be {int}")
    public void the_response_code_should_be(Integer responseCode) throws Exception {
        result.andExpect(status().is(responseCode));
    }

}
</code>```

RunMvcTest.java

```<code>import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.web.WebAppConfiguration;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;

@RunWith(Cucumber.class)
@CucumberOptions(
        plugin = {"pretty","html:build/cucumber-html-report"},
        features = "src/test/resources", strict = true)
@WebAppConfiguration
@ContextConfiguration(classes = V2Application.class)
/**
 * A class to run the Cucumber .feature files located in 'features'
 * @author Lewis Jones
 *
 */
public class RunMvcTest {

}
</code>```

Person.feature

```<code>Feature: Person CRUD
  As a User, I want to add a Person

  @repo
  Scenario: Person.Repo.Add
    When I add a new Person using POST at "http://localhost:8080/services/person/add" with JSON:
      """
      {"firstName":"Lewis","lastName":"Jones","addressId":"1", "dob":"1999-07-11"}
      """
    Then the response code should be 200
</code>```

答:
A null pointer exception happens when you try to de-reference a variable or field that is null. So if you try to call perform on mockMvc while mockMvc is null you will get a null pointer exception.

If you read the stack trace carefully you can see that this it what it tries to tell you.

```<code>result = mockMvc.perform(....);
</code>```

So how can mockMcv be null? You initialize it in setup method right? That means setup isn't called. You can confirm this by putting a break point in the method and debugging your test.

```<code>import org.junit.BeforeClass;

....

    /**
     * Runs the application server before every scenario.
     */
    @BeforeClass
    public void setup() {
        this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
    }
</code>```

And setup doesn't get called because BeforeClass is a JUnit annotation. Cucumber uses io.cucumber.java.Before.

Body:
I am receiving the following NullPointerException when trying to execute a Cucumber StepDefs file that passes a JSON from a .feature file to a REST endpoint on localhost;

I have tried to instantiate the ResultActions in every other way, receiving the same error.

The Controller works linked to the test is fine, and is pointing to the correct REST endpoint.

The issue is with the result in personStepDefs

I don't think I'm missing a parameter for ResultActions result as I've built my RequestBuilder

java.lang.NullPointerException at com.///.v2.PersonStepDefs.i\_add\_a\_new\_Person\_using\_POST\_at\_with\_JSON([PersonStepDefs.java:49](https://PersonStepDefs.java:49)) at

✽.I add a new Person using POST at "[http://localhost:8080/services/person/add](http://localhost:8080/services/person/add)" with JSON:(file:///C:/path/to/src/test/resources/Person.feature:6)

PersonStepDefs.java

import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.WebApplicationContext;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@Transactional
/**
 * Person Step Definition class to execute Scenario contained in Person.feature
 * @author Lewis Jones
 *
 */
public class PersonStepDefs {

    @Autowired
    private volatile WebApplicationContext wac;

    @Autowired
    private volatile MockMvc mockMvc;

    private ResultActions result;

    /**
     * Runs the application server before every scenario.
     */
    @BeforeClass
    public void setup() {
        this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
    }

    @When("I add a new Person using POST at {string} with JSON:")
    public void i_add_a_new_Person_using_POST_at_with_JSON(String request, String json) throws Exception {
        result = mockMvc.perform(post(request).contentType(MediaType.APPLICATION_JSON)
                .content(json.getBytes()));
    }

    @Then("the response code should be {int}")
    public void the_response_code_should_be(Integer responseCode) throws Exception {
        result.andExpect(status().is(responseCode));
    }

}

RunMvcTest.java

import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.web.WebAppConfiguration;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;

@RunWith(Cucumber.class)
@CucumberOptions(
        plugin = {"pretty","html:build/cucumber-html-report"},
        features = "src/test/resources", strict = true)
@WebAppConfiguration
@ContextConfiguration(classes = V2Application.class)
/**
 * A class to run the Cucumber .feature files located in 'features'
 * @author Lewis Jones
 *
 */
public class RunMvcTest {

}

Person.feature

Feature: Person CRUD
  As a User, I want to add a Person

  @repo
  Scenario: Person.Repo.Add
    When I add a new Person using POST at "http://localhost:8080/services/person/add" with JSON:
      """
      {"firstName":"Lewis","lastName":"Jones","addressId":"1", "dob":"1999-07-11"}
      """
    Then the response code should be 200

Body:
A null pointer exception happens when you try to de-reference a variable or field that is null. So if you try to call perform on mockMvc while mockMvc is null you will get a null pointer exception.

If you read the stack trace carefully you can see that this it what it tries to tell you.

result = mockMvc.perform(....);

So how can mockMcv be null? You initialize it in setup method right? That means setup isn't called. You can confirm this by putting a break point in the method and debugging your test.

import org.junit.BeforeClass;

....

    /**
     * Runs the application server before every scenario.
     */
    @BeforeClass
    public void setup() {
        this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
    }

And setup doesn't get called because BeforeClass is a JUnit annotation. Cucumber uses io.cucumber.java.Before.


问:
jQuery Autocomplete using extraParams to pass additional GET variables
I am referring specifically to the jQuery Autocomplete v1.1 plugin by Jörn Zaefferer [source: http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/] as there seems to be quite a few variations of this plugin.

I'm trying to pass additional parameters to the server when the user starts typing because I have multiple fields that I want autocomplete to provide suggestions for.

In addition to the query, I want to send the input name attribute to the server but I can't seem to use $(this).attr('name') within the extraParams.

My jQuery:

```<code>   $('.ajax-auto input').autocomplete('search.php', {
     extraParams: {
      search_type: function(){
       return $(this).attr('name');
      }
     }
   })
</code>```

This is my HTML.

```<code> <form method="post" action="#" id="update-form" autocomplete="off">
  <ol>
         <li class="ajax-auto">
             <label for="form-initials">Initials</label>
                <input type="text" id="form-initials" name="initials" />
            </li>
         <li class="ajax-auto">
             <label for="form-company">Company</label>
                <input type="text" id="form-company" name="company" />
            </li>
  </ol>
 </form>
</code>```

Any suggestions?

答:
use a .each first, then you can use $(this) and set whatever you need into a variable. the resulting variable can be used in the autocomplete</p>

```<code>$(".autosuggest").each(function (index, object) {
    var autosuggestType = $(this).attr("autoSuggestType");
    $(this).autocomplete("url",
            {
                extraParams: {
                    autoSuggestType: autosuggestType
                },
</code>```

ContentLicense: CC BY-SA 2.5

Body:
I am referring specifically to the jQuery Autocomplete v1.1 plugin by Jörn Zaefferer [source: http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/] as there seems to be quite a few variations of this plugin.

I'm trying to pass additional parameters to the server when the user starts typing because I have multiple fields that I want autocomplete to provide suggestions for.

In addition to the query, I want to send the input name attribute to the server but I can't seem to use $(this).attr('name') within the extraParams.

My jQuery:

   $('.ajax-auto input').autocomplete('search.php', {
     extraParams: {
      search_type: function(){
       return $(this).attr('name');
      }
     }
   })

This is my HTML.

 <form method="post" action="#" id="update-form" autocomplete="off">

             Initials
                <input type="text" id="form-initials" name="initials" />

             Company
                <input type="text" id="form-company" name="company" />

 </form>

Any suggestions?

Body:
use a .each first, then you can use $(this) and set whatever you need into a variable. the resulting variable can be used in the autocomplete

$(".autosuggest").each(function (index, object) {
    var autosuggestType = $(this).attr("autoSuggestType");
    $(this).autocomplete("url",
            {
                extraParams: {
                    autoSuggestType: autosuggestType
                },


问:
Extracting specific datas in numpy array
How can I get data from a specific row and column range?

For example, I have a 5X5 array. I would like to get data in row 1~3 and column 1~3?

I know there are other answers talking about getting data in columns, but I don't want the whole columns. Need help~

This is the coding I use to get the whole column.

```<code>import numpy as np
m = np.array(np.random.random((5, 5)))
print(m)
#Getting column 1,2
print(m[:,[1, 2]])
#Getting column 1~3
print(m[:,1:4])
</code>```

答:
Just slice in both dimensions at once:

import numpy as np
m = np.array(np.random.random((5, 5)))
print(m[1:4,1:4])
[[0.92383161 0.76857191 0.39590632]
 [0.84968982 0.50103819 0.72481367]
 [0.2130214  0.61815567 0.55792883]]
```

Remember that python excludes the end-point of the slice, hence 1:4 instead of 1:3.

Body:
How can I get data from a specific row and column range?

For example, I have a 5X5 array. I would like to get data in row 1~3 and column 1~3?

I know there are other answers talking about getting data in columns, but I don't want the whole columns. Need help~

This is the coding I use to get the whole column.

import numpy as np
m = np.array(np.random.random((5, 5)))
print(m)
#Getting column 1,2
print(m[:,[1, 2]])
#Getting column 1~3
print(m[:,1:4])

Body:
Just slice in both dimensions at once:

import numpy as np
m = np.array(np.random.random((5, 5)))
print(m[1:4,1:4])
[[0.92383161 0.76857191 0.39590632]
 [0.84968982 0.50103819 0.72481367]
 [0.2130214  0.61815567 0.55792883]]

Remember that python excludes the end-point of the slice, hence 1:4 instead of 1:3.


问:
How to mock relations on Django
I'm currently running into a problem, I can't figure out how to mock a relation.

Let's say I have some model called

class MyModel(models.Model):
    name = models.CharField(max_length=10)

class RelatedModel(models.Model):
    my_model = models.OneToOneField(MyModel, on_delete=models.CASCADE, related_name='related_model')
    name = models.CharField(max_length=10
```

<p>And I have some repository class like this:</p>

<pre class="lang-py prettyprint-override"><code>class MyModelRepository:
    @staticmethod
    def get_related_model(my_model):
        try:
            return my_model.related_model
        except MyModel.related_model.RelatedObjectDoesNotExist:
            # do some other thing
</code>```

When writing unit-tests for this how can I mock the related_model to raise this exception or return some arbitrary instance?

答:
Here's a way to do it without unittest.mock:

```<code>class MockRelatedModel:
    @property
    def related_model(self):
        raise MyModel.related_model.RelatedObjectDoesNotExist()
</code>```

If you do want to use unittest.mock you can use PropertyMock. Note, this hasn't been tested. And frankly, I think it might be easier to create an instance of MyModel without the related_model set on it and call MyModelRepository.get_related_model.

```<code>with patch('path.to.MyModel', new_callable=PropertyMock) as mock_model:
    mock_model.related_model.side_effect = MyModel.related_model.RelatedObjectDoesNotExist()
    instance = MyModel()
    MyModelRepository.get_related_model(instance)
</code>```

Title: How to mock relations on Django

Body:
I'm currently running into a problem, I can't figure out how to mock a relation.

Let's say I have some model called

class MyModel(models.Model):
    name = models.CharField(max_length=10)

class RelatedModel(models.Model):
    my_model = models.OneToOneField(MyModel, on_delete=models.CASCADE, related_name='related_model')
    name = models.CharField(max_length=10

And I have some repository class like this:

class MyModelRepository:
    @staticmethod
    def get_related_model(my_model):
        try:
            return my_model.related_model
        except MyModel.related_model.RelatedObjectDoesNotExist:
            # do some other thing

When writing unit-tests for this how can I mock the related_model to raise this exception or return some arbitrary instance?

Body:
Here's a way to do it without unittest.mock:

class MockRelatedModel:
    @property
    def related_model(self):
        raise MyModel.related_model.RelatedObjectDoesNotExist()

If you do want to use unittest.mock you can use PropertyMock. Note, this hasn't been tested. And frankly, I think it might be easier to create an instance of MyModel without the related_model set on it and call MyModelRepository.get_related_model.

with patch('path.to.MyModel', new_callable=PropertyMock) as mock_model:
    mock_model.related_model.side_effect = MyModel.related_model.RelatedObjectDoesNotExist()
    instance = MyModel()
    MyModelRepository.get_related_model(instance)


问:
How can I create a Trend Line in Amazon QuickSight?
I need to create a Trend calculation for a dashboard in Amazon QuickSight. Basically I need the same thing that the Trend function in Excel allows.
Thanks!</p>

答:
As of February 2020 QuickSight does not provide an ability to create a trend line. Your best strategy at the moment is to calculate trend line values outside of QuickSight (in your ETL (Extract, Transform, Load) pipeline) and only use QuickSight to show the line.

We do know that customers need this ability so we are planning to provide this functionality in one of the upcoming releases.


问:
What's the different between oauth2Login and oauth2Client? what are the use-case of them?
I have seen the Spring security docs.https://docs.spring.io/spring-security/site/docs/5.2.1.RELEASE/reference/htmlsingle/#oauth2 But I don't really know the different use-case between oauth2Login() and oauth2Client(). Are there any samples ?</p>

答:
oauth2Login() will authenticate the user with OAuth2 (or OIDC), populating Spring's Principal with the information from either the JWT or the userInfo endpoint. oauth2Client() won't authenticate the user but will seek permission from the OAuth2 authorization server for the resources (scopes) it needs to access. With oauth2Client() you'll still need to authenticate the user, for example via formLogin().

A more detailed explanation can be found here.


问:
How to point to a file on a desktop directory in as3 in an AIR app
I'm currently using this to successfully load (and play) an mp3 from a folder on my desktop in my AIR desktop program:

```<code>soundBG2.load(new URLRequest("C:/Users/User/Desktop/music/mySong.mp3"));
</code>```

It works well, however I'd like to not use an explicit path. I'd like to use something like:

```<code>soundBG2.load(new URLRequest(desktopDirectory+"/music/mySong.mp3"));
</code>```

...which of course doesn't work the way it's coded there, but how to I do that please?

Thank you

答:
Figured it out:</p>

```<code>soundBG2.load(new URLRequest(File.desktopDirectory.nativePath + "/music/mySong.mp3"));
</code>```

Body:
I'm currently using this to successfully load (and play) an mp3 from a folder on my desktop in my AIR desktop program:

soundBG2.load(new URLRequest("C:/Users/User/Desktop/music/mySong.mp3"));

It works well, however I'd like to not use an explicit path. I'd like to use something like:

soundBG2.load(new URLRequest(desktopDirectory+"/music/mySong.mp3"));

...which of course doesn't work the way it's coded there, but how to I do that please?

Thank you

Body:
Figured it out:

soundBG2.load(new URLRequest(File.desktopDirectory.nativePath + "/music/mySong.mp3"));


问:
In Java, is better maintain data in the ResultSet or transform to array?
I have two classes, a server and some clients. The server class make a query to database and retrieve a certain number of rows. The clients request a part of these rows, each one a different part.

In the server class, is better I maintain the result of the query in the ResultSet and transforming in a array of objects when the client class make the request or transforming all in a array of objects and sending him partially when the request occur?

I think that maintain in the ResultSet is more easier to do and control.

答:
If you intend to pass the contents of the result set to other classes or methods then it is definitely better to take the data out of the result set and store it in some form of data structure ( array / List etc ). If you do not do this you will start adding dependencies on the java.sql package to classes that really do not need to be involved in database access. It also makes unit testing of those classes / methods much harder.

If the ResultSet is only being used in a very restricted scope ( ie a single method ) then there's no real benefit in unloading it in to a different data structure though.


答:
Easy, you do the same slicing with the rows as you do with the columns:</p>

```<code>import numpy as np
m = np.array(np.random.random((5, 5)))
print(m)
#Getting column 1,2
print(m[:,[1, 2]])
#Getting column 1~3
print(m[:,1:4])
#Getting rows 1~3 and columns 1~3
print(m[1:4,1:4])
</code>```

Title: Extracting specific datas in numpy array

Body:
Easy, you do the same slicing with the rows as you do with the columns:

import numpy as np
m = np.array(np.random.random((5, 5)))
print(m)
#Getting column 1,2
print(m[:,[1, 2]])
#Getting column 1~3
print(m[:,1:4])
#Getting rows 1~3 and columns 1~3
print(m[1:4,1:4])