问:
Is there a native technique in PostgreSQL to force "timestamp without time zone" to not include milliseconds?
I am using PostgreSQL 9.6.17. (Migrating from MySQL)

A java program writes dates inside a table. The date formats is the following:
2019-01-01 09:00:00

But it can also be 2019-01-01 09:00:00.00 or 2019-01-01 09:00:00.000 when inserted in the database, which messes up my date management in my program when retrieved.

On insertion, I would like all the date to have the very same format: 2019-01-01 09:00:00. The datatype used by the column is timestamp without a time zone.

How can I tell postgresql to not input milliseconds in timestamp without timezone via configuration or SQL query ?

This data types doc does not provide any information about that.

答:
You can cast:

```<code>mytimestamptz::timestamp(0)
</code>```

This will round the result to the nearest second. If you want to truncate instead:

```<code>date_trunc('second', mytimestamp)
</code>```

Body:
You can cast:

mytimestamptz::timestamp(0)

This will round the result to the nearest second. If you want to truncate instead:

date_trunc('second', mytimestamp)


来源: stackexchange

问:
In pom.xml maven-antrun-plugin not found
I am following this blog to build my backend in spring boot and frontend in Reactjs. When I cloned the code, it is working fine. But in pom.xml it shows error message as maven-antrun-plugin not found. Why is it so? How do I fix it?

```<code>    <plugin>
        <artifactId>maven-antrun-plugin</artifactId> // error not found
        <executions>
           <execution>
              <phase>generate-resources</phase>
              <configuration>
                 <target>
                    <copy todir="${project.build.directory}/classes/static">
                       <fileset dir="${project.basedir}/frontend/build" />
                    </copy>
                 </target>
              </configuration>
              <goals>
                 <goal>run</goal>
              </goals>
           </execution>
        </executions>
     </plugin>
</code>```

答: Along with artifactId, you should specify groupId as org.apache.maven.plugins and version as 1.8</p>

ContentLicense: CC BY-SA 4.0

Body:
I am following this blog to build my backend in spring boot and frontend in Reactjs. When I cloned the code, it is working fine. But in pom.xml it shows error message as maven-antrun-plugin not found. Why is it so? How do I fix it?

    <plugin>
        <artifactId>maven-antrun-plugin</artifactId> // error not found
        <executions>
           <execution>
              <phase>generate-resources</phase>
              <configuration>
                 <target>
                    <copy todir="${project.build.directory}/classes/static">
                       <fileset dir="${project.basedir}/frontend/build" />
                    </copy>
                 </target>
              </configuration>
              <goals>
                 <goal>run</goal>
              </goals>
           </execution>
        </executions>
     </plugin>


问:
How can I implement onActivityResult and onNewIntent on FlutterActivity
I would like to implement onActivityResult and onNewIntent on my Android native side of flutter app.

For example, I would like to be able to run "startActivityForResult", and open my app using a deep link.

My main activity is flutter, but I have some work I need to do on the native part.

Is there a way to accomplish this without writing an external plugin?

```<code>package com.test.flutter_app

import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterActivity() {
    override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
        GeneratedPluginRegistrant.registerWith(flutterEngine);
    }
}
</code>```

As I understand from the documentation, I need to use PluginRegistry.Registrar addActivityResultListener. But who is my Registrar? how can I get it/use it?
Code examples would be much appreciated.

答:
No need to write a plugin, You can use MethodChannel for platform-specific code.

https://flutter.dev/docs/development/platform-integration/platform-channels

Body:
I would like to implement onActivityResult and onNewIntent on my Android native side of flutter app.

For example, I would like to be able to run "startActivityForResult", and open my app using a deep link.

My main activity is flutter, but I have some work I need to do on the native part.

Is there a way to accomplish this without writing an external plugin?

package com.test.flutter_app

import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterActivity() {
    override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
        GeneratedPluginRegistrant.registerWith(flutterEngine);
    }
}

As I understand from the documentation, I need to use PluginRegistry.Registrar addActivityResultListener. But who is my Registrar? how can I get it/use it?
Code examples would be much appreciated.


问:
Error on google function deploy, service account doesn't exist
Please can you help me, I'm receiving this error when I'm trying to deploy a google cloud function:

```<code>HTTP Error: 400, Default service account 'project-name@appspot.gserviceaccount.com' doesn't exist. Please recreate this account (for example by disabling and enabling the Cloud Functions API), or specify a different account.
</code>```

The command used to deploy is:

```<code>firebase deploy --only functions
</code>```

A temporary solution is fine, but if you can help me to solve it permanently is better.

Thanks in advance.

答: try to  select Google Cloud Platform (GCP) resource location  in Setting of Firebase. enter image description here

Body:
Please can you help me, I'm receiving this error when I'm trying to deploy a google cloud function:

HTTP Error: 400, Default service account 'project-name@appspot.gserviceaccount.com' doesn't exist. Please recreate this account (for example by disabling and enabling the Cloud Functions API), or specify a different account.

The command used to deploy is:

firebase deploy --only functions

A temporary solution is fine, but if you can help me to solve it permanently is better.

Thanks in advance.


问:
stop table expanding off screen
I have a page in ASP.net that has a table that gets autogenerated based upon a datatable and shown using a Telerik RadGrid, I want the page size to remain unchanged and if the table is too wide it should have its own scroll bars.

I have tested using IE9 and Firefox and they both put a scroll bar on the page instead of the table.

if I use the web dev toolbar in IE9 and set the mode to IE7 it renders how I want with the scroll on the table!

The ASP markup code looks as follows:

```<code><%@ Page Title="Data Audit" Language="C#" Theme="Editor" MasterPageFile="~/MasterPages/MasterPlanEditor.Master"
    AutoEventWireup="True" CodeBehind="DataAudit.aspx.cs" Inherits="IFMA.MasterPlan.Web.Modules.Administrator.DataAuditing.DataAudit" %>

<%@ Register Src="../../../Common/Controls/ContentTitleBar.ascx" TagName="ContentTitleBar"
    TagPrefix="IFMA" %>
<%@ Register Src="../../../Common/Controls/CMSSection.ascx" TagName="CMSSection"
    TagPrefix="IFMA" %>
<%@ Register Src="../../../Common/Controls/PageMessage.ascx" TagName="PageMessage"
    TagPrefix="IFMA" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
    <!-- AJAX --->
    <telerik:RadAjaxManager ID="AjaxManager" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxPanel">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel" LoadingPanelID="AjaxLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel" runat="server" Skin="Default" />
    <telerik:RadTabStrip ID="TabStrip" runat="server" Skin="Default">
        <Tabs>
            <telerik:RadTab Text="Data Audit" Selected="true">
            </telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>
    <div class="BlueContentContainer">
        <div class="PaddingContentContainer">
            <IFMA:PageMessage ID="pageMessage" runat="server" />
            Please select the audit entity:
            <telerik:RadComboBox ID="cmbAuditSelection" runat="server" AllowCustomText="false"
                OnItemsRequested="cmdAuditSelection_OnItemsRequested" EnableLoadOnDemand="true"
                Width="350px" OnSelectedIndexChanged="cmbAuditSelection_OnSelectedIndexChanged"
                CausesValidation="false" AppendDataBoundItems="true" EmptyMessage="Please Select"
                AutoPostBack="true" Skin="Office2007" />
            <br />
            <br />
            <asp:Panel ID="GridPanel" BorderderStyle="Solid" BorderColor="MenuBar" ScrollBars="Auto"
                Height="98%" runat="server">
                <telerik:RadGrid ID="Grid" Skin="Office2007" AllowPaging="false" Style="width: auto"
                    ShowGroupPanel="false" runat="server" OnColumnCreated="Grid_OnColumnCreated"
                    GridLines="Both">
                    <MasterTableView AutoGenerateColumns="True" HeaderStyle-Wrap="false" ShowHeadersWhenNoRecords="false" />
                </telerik:RadGrid>
            </asp:Panel>
        </div>
    </div>
</asp:Content>
</code>```

and the css

I'm going crazy trying to figure this out, I haven't done a lot of CSS so hopefully someone here might know.

答:
you can wrap the table with a </p>

```<code><div style="overflow:auto">

your table here

</div>
</code>```

ContentLicense: CC BY-SA 3.0

Title: stop table expanding off screen

Body:
I have a page in ASP.net that has a table that gets autogenerated based upon a datatable and shown using a Telerik RadGrid, I want the page size to remain unchanged and if the table is too wide it should have its own scroll bars.

I have tested using IE9 and Firefox and they both put a scroll bar on the page instead of the table.

if I use the web dev toolbar in IE9 and set the mode to IE7 it renders how I want with the scroll on the table!

The ASP markup code looks as follows:

<%@ Page Title="Data Audit" Language="C#" Theme="Editor" MasterPageFile="~/MasterPages/MasterPlanEditor.Master"
    AutoEventWireup="True" CodeBehind="DataAudit.aspx.cs" Inherits="IFMA.MasterPlan.Web.Modules.Administrator.DataAuditing.DataAudit" %>

<%@ Register Src="../../../Common/Controls/ContentTitleBar.ascx" TagName="ContentTitleBar"
    TagPrefix="IFMA" %>
<%@ Register Src="../../../Common/Controls/CMSSection.ascx" TagName="CMSSection"
    TagPrefix="IFMA" %>
<%@ Register Src="../../../Common/Controls/PageMessage.ascx" TagName="PageMessage"
    TagPrefix="IFMA" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">

    <telerik:RadAjaxManager ID="AjaxManager" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxPanel">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadAjaxPanel" LoadingPanelID="AjaxLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel" runat="server" Skin="Default" />
    <telerik:RadTabStrip ID="TabStrip" runat="server" Skin="Default">
        <Tabs>
            <telerik:RadTab Text="Data Audit" Selected="true">
            </telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>

            <IFMA:PageMessage ID="pageMessage" runat="server" />
            Please select the audit entity:
            <telerik:RadComboBox ID="cmbAuditSelection" runat="server" AllowCustomText="false"
                OnItemsRequested="cmdAuditSelection_OnItemsRequested" EnableLoadOnDemand="true"
                Width="350px" OnSelectedIndexChanged="cmbAuditSelection_OnSelectedIndexChanged"
                CausesValidation="false" AppendDataBoundItems="true" EmptyMessage="Please Select"
                AutoPostBack="true" Skin="Office2007" />

            <asp:Panel ID="GridPanel" BorderderStyle="Solid" BorderColor="MenuBar" ScrollBars="Auto"
                Height="98%" runat="server">
                <telerik:RadGrid ID="Grid" Skin="Office2007" AllowPaging="false" Style="width: auto"
                    ShowGroupPanel="false" runat="server" OnColumnCreated="Grid_OnColumnCreated"
                    GridLines="Both">
                    <MasterTableView AutoGenerateColumns="True" HeaderStyle-Wrap="false" ShowHeadersWhenNoRecords="false" />
                </telerik:RadGrid>
            </asp:Panel>

</asp:Content>

and the css

I'm going crazy trying to figure this out, I haven't done a lot of CSS so hopefully someone here might know.

Body:
you can wrap the table with a

<div style="overflow:auto">

your table here

</div>


问:
ASP.NET MVC - How to find out why Index-method is called?
I am currently working on an ASP.NET MVC web application using DevExpress controls and I ran into a very annoying issue that I could not fix so far.

I am implementing a page/view which consists of multiple partial views. One of those partial views contains a DevExpress GridView control which contains a so called "DetailRow". This detail row is meant to show additional information about a row when clicking on a small "+" button on the left side of each row. I already use a very similar (basically almost identical) GridView inside of a DevExpress "PopupControl" on another page of my website without any problems, but on the new page I am currently working on it just does not work.

The page actually loads just fine when I open it, but as soon as I click on the small "+" in a row my controller's Index-method is called and I do not understand why. On the other page which has the GridView inside a PopupControl, only the method for the partial which contains the GridView and the method for the actual content of the DetailRow is called, which is what I would expect to happen on my new page as well.

I have already recorded the network communication between the site and the server and I do not see any GET request either which would result in the Index-method getting called. There is only a POST for the partial which contains the GridView. I also get the following DevExpress-specific error logged in the console when this happens:

Invalid server response. It is required that a Partial View contains
  only the extension definition code, without any additional markup. To
  learn more, see https://www.devexpress.com/kbid=KA20010.

Unfortunately the linked article in that error did not help me figure out the problem either. It talks about making sure that all extensions are defined in a separate PartialView with no extra tags but I already have it like that, there are no extra tags anywhere in my partial views. I also do not assign a unique SettingsBase.Name value so that cannot be the problem either.

Does anyone know what is going wrong here or how I can further debug the problem? I do not know any way of finding out why the Index-method of my controller is being called so I have no clue what to do.

答: I just managed to find the solution for my problem. There was something wrong with my routing so the POST request I mentioned in my question was routed to the wrong controller. I fixed the routing and now everything works as expected.</p>


问:
Cannot complie xquery : err:XPST0003 the ':=' notation is no longer accepted in map expression
I'm trying eXist-db replication with ActiveMQ. When I configure for the consumer instance, it needs to execute a XQuery like this to register JMS receiver:

```<code>xquery version "3.0";
import module namespace replication="http://exist-db.org/xquery/replication" at "java:org.exist.jms.xquery.ReplicationModule";
let $jmsConfiguration := map {
    "java.naming.factory.initial"
            := "org.apache.activemq.jndi.ActiveMQInitialContextFactory",
    "java.naming.provider.url" := "tcp://localhost:61616",
    "connection-factory" := "ConnectionFactory",
    "destination" := "dynamicTopics/eXistdb-replication-example",
    "subscriber.name" := "SubscriptionId",
    "connection.client-id" := "ClientId"
}

return
    replication:register($jmsConfiguration)
</code>```

When I run this query, it returns an error like the title. I'm new to XQuery, so can you help me to check it ?

答: Michael Kay is correct. eXist-db 4.x.x allowed the legacy draft syntax as well as the later standardised syntax. eXist-db 5.x.x oy supports the later standardised syntax.</p>

Body:
I'm trying eXist-db replication with ActiveMQ. When I configure for the consumer instance, it needs to execute a XQuery like this to register JMS receiver:

xquery version "3.0";
import module namespace replication="http://exist-db.org/xquery/replication" at "java:org.exist.jms.xquery.ReplicationModule";
let $jmsConfiguration := map {
    "java.naming.factory.initial"
            := "org.apache.activemq.jndi.ActiveMQInitialContextFactory",
    "java.naming.provider.url" := "tcp://localhost:61616",
    "connection-factory" := "ConnectionFactory",
    "destination" := "dynamicTopics/eXistdb-replication-example",
    "subscriber.name" := "SubscriptionId",
    "connection.client-id" := "ClientId"
}

return
    replication:register($jmsConfiguration)

When I run this query, it returns an error like the title. I'm new to XQuery, so can you help me to check it ?


问:
Getting a fatal error when I try to customize theme?

Fatal error: Uncaught Exception: Supplied nav_menu_item value missing property: description in D:\laragon\www\woodlea\wp-includes\customize\class-wp-customize-nav-menu-item-setting.php:183

Screenshot : https://prnt.sc/q32uc8

答:
I think you can fix it with this code in function.php:</p>

```<code>add_filter('wp_get_nav_menu_items', 'my_wp_get_nav_menu_items', 10, 3);
function my_wp_get_nav_menu_items($items, $menu, $args) {
    foreach($items as $key => $item)
        $items[$key]->description = '';

    return $items;
}
</code>```

Body:
I think you can fix it with this code in function.php:

add_filter('wp_get_nav_menu_items', 'my_wp_get_nav_menu_items', 10, 3);
function my_wp_get_nav_menu_items($items, $menu, $args) {
    foreach($items as $key => $item)
        $items[$key]->description = '';

    return $items;
}


问:
Pass the first value that changes in a list
I have a list of vectors.
e.g.

```<code>[1 0 1]
[1 0 1]
[1 0 1]
[2 1 1]
[2 1 1]
[3 4 0]
...
</code>```

Now I want to pass my vectors to a function but every same vector only once:

```<code>[1 0 1]
[2 1 1]
[3 4 0]
...
</code>```

I already calculated the number of different elements in the list like this:

```<code>clusternumber = [x for n, x in enumerate(X_list) if x not in X_list[:n]]
n = len(clusternumber)
</code>```

Is there maybe a way to combine it?
What is the fastest way to achieve this?

Thanks in advance

答:
You can use set:

data = [[1,0,1],[1,0,1],[1,0,1],[2,1,1],[2,1,1],[3,4,0]]
unique_data = [list(x) for x in set(tuple(x) for x in data)]
print(unique_data)
```

<p>Output:</p>

<pre class="lang-py prettyprint-override"><code>[[2, 1, 1], [3, 4, 0], [1, 0, 1]]
</code>```

Body:
I have a list of vectors.
e.g.

[1 0 1]
[1 0 1]
[1 0 1]
[2 1 1]
[2 1 1]
[3 4 0]
...

Now I want to pass my vectors to a function but every same vector only once:

[1 0 1]
[2 1 1]
[3 4 0]
...

I already calculated the number of different elements in the list like this:

clusternumber = [x for n, x in enumerate(X_list) if x not in X_list[:n]]
n = len(clusternumber)

Is there maybe a way to combine it?
What is the fastest way to achieve this?

Thanks in advance

Body:
You can use set:

data = [[1,0,1],[1,0,1],[1,0,1],[2,1,1],[2,1,1],[3,4,0]]
unique_data = [list(x) for x in set(tuple(x) for x in data)]
print(unique_data)

Output:

[[2, 1, 1], [3, 4, 0], [1, 0, 1]]


问:
Custom range slider issue on Internet Explorer
Below is the css for my slider. The problem is that the slider is totally failing on IE.
Here is also the online version: https://codepen.io/mariomez/pen/yLNYdRg
I tried using MS fillers but it didn't go well as I am not familiar with how to properly use them.

```<code>.valeurPrix {
  position: absolute;
  top: -59px;
  left: 177px;
}

.range-slider {
  position: relative;
  width: 450px;
  float: left;
  margin-right: 5px;
}

.range-slider .input-range {
  -webkit-appearance: none;
  width: 449px;
  height: 5px;
  border-radius: 5px;
  background: #ccc;
  outline: none;
}

.range-slider .input-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #164188;
  cursor: pointer;
  -webkit-transition: background .15s ease-in-out;
  transition: background .15s ease-in-out;
}

.range-slider .input-range::-webkit-slider-thumb:hover {
  background: #164188;
}

.range-slider .input-range:active::-webkit-slider-thumb {
  background: #164188;
}

.range-slider .input-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: #164188;
  cursor: pointer;
  -webkit-transition: background .15s ease-in-out;
  transition: background .15s ease-in-out;
}

.range-slider .input-range::-moz-range-thumb:hover {
  background: #164188;
}

.range-slider .input-range:active::-moz-range-thumb {
  background: #164188;
}

.range-slider .range-value {
  display: inline-block;
  position: relative;
  width: 100px;
  color: #fff;
  font-size: 23px;
  line-height: 32px;
  text-align: center;
  border-radius: 3px;
  background: #164188;
  padding: 5px 10px;
  margin-left: 7px;
}

::-moz-range-track {
  background: #ccc;
  border: 0;
}

input::-moz-focus-inner {
  border: 0;
}
</code>```

Can you please guide me on how to use MS fillers on this code?

答:
First, since the input event only supports input of type text and password in the IE browser, I suggest you could try to use the mouseup event to get the range value. Code as below:

```<code>var range = $('.input-range'),
  value = $('.range-value');

value.html(range.attr('value') + ' %');

range.on('mouseup', function() {
  value.html(this.value + ' %');
});
</code>```

Second, please try to use the following CSS style:

```<code><style>
    * {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
    }

    .PrixMin {
        float: left;
        color: #164188;
        font-size: 19px;
        margin-right: 5px;
    }

    .selecteurPrix {
        padding-top: 15px;
    }

    body {
        font-family: sans-serif;
        padding: 40px;
    }

    .valeurPrix {
        position: absolute;
        top: -59px;
        left: 177px;
    }

    .range-slider {
        position: relative;
        width: 450px;
        float: left;
        margin-right: 5px;
    }

    @media (-webkit-min-device-pixel-ratio:0) {
        /* Non-IE styles here*/
        .range-slider .input-range {
            -webkit-appearance: none;
            width: 449px;
            height: 5px;
            border-radius: 5px;
            background: #ccc;
            outline: none;
        }
    }

    @media (-ms-high-contrast:none),(-ms-high-contrast:active) {
        /* IE styles here*/
        .range-slider .input-range {
            /*removes default webkit styles*/
            -webkit-appearance: none;
            /*fix for FF unable to apply focus style bug */
            border: 1px solid white;
            /*required for proper track sizing in FF*/
            width: 450px;
            outline: none;
        }
    }

    .range-slider .input-range::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #164188;
        cursor: pointer;
        -webkit-transition: background .15s ease-in-out;
        transition: background .15s ease-in-out;
    }

                .range-slider .input-range::-webkit-slider-thumb:hover {
                    background: #164188;
                }

            .range-slider .input-range:active::-webkit-slider-thumb {
                background: #164188;
            }

            .range-slider .input-range::-moz-range-thumb {
                width: 20px;
                height: 20px;
                border: 0;
                border-radius: 50%;
                background: #164188;
                cursor: pointer;
                -webkit-transition: background .15s ease-in-out;
                transition: background .15s ease-in-out;
            }

                .range-slider .input-range::-moz-range-thumb:hover {
                    background: #164188;
                }

            .range-slider .input-range:active::-moz-range-thumb {
                background: #164188;
            }

        .range-slider .range-value {
            display: inline-block;
            position: relative;
            width: 100px;
            color: #fff;
            font-size: 23px;
            line-height: 32px;
            text-align: center;
            border-radius: 3px;
            background: #164188;
            padding: 5px 10px;
            margin-left: 7px;
        }
    ::-moz-range-track {
        background: #ccc;
        border: 0;
    }
    input::-moz-focus-inner {
        border: 0;
    }

    input[type=range] {
        margin: 2px;
    }

        input[type=range]::-ms-track {
            width: 450px;
            height: 5px;
            /*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */
            background: transparent;
            /*leave room for the larger thumb to overflow with a transparent border */
            border-color: transparent;
            border-width: 6px 0;
            /*remove default tick marks*/
            color: transparent;
        }

        input[type=range]::-ms-fill-lower {
            background: #ccc;
            border-radius: 10px;
        }

        input[type=range]::-ms-fill-upper {
            background: #ccc;
            border-radius: 10px;
        }

        input[type=range]::-ms-thumb {
            border: none;
            height: 16px;
            width: 16px;
            border-radius: 50%;
            background: #164188;
        }

        input[type=range]:focus::-ms-fill-lower {
            background: #ccc;
        }

        input[type=range]:focus::-ms-fill-upper {
            background: #ccc;
        }
</style>
</code>```

The result in IE browser as below (you could find the whole sample code from here):

Body:
Below is the css for my slider. The problem is that the slider is totally failing on IE.
Here is also the online version: https://codepen.io/mariomez/pen/yLNYdRg
I tried using MS fillers but it didn't go well as I am not familiar with how to properly use them.

.valeurPrix {
  position: absolute;
  top: -59px;
  left: 177px;
}

.range-slider {
  position: relative;
  width: 450px;
  float: left;
  margin-right: 5px;
}

.range-slider .input-range {
  -webkit-appearance: none;
  width: 449px;
  height: 5px;
  border-radius: 5px;
  background: #ccc;
  outline: none;
}

.range-slider .input-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #164188;
  cursor: pointer;
  -webkit-transition: background .15s ease-in-out;
  transition: background .15s ease-in-out;
}

.range-slider .input-range::-webkit-slider-thumb:hover {
  background: #164188;
}

.range-slider .input-range:active::-webkit-slider-thumb {
  background: #164188;
}

.range-slider .input-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: #164188;
  cursor: pointer;
  -webkit-transition: background .15s ease-in-out;
  transition: background .15s ease-in-out;
}

.range-slider .input-range::-moz-range-thumb:hover {
  background: #164188;
}

.range-slider .input-range:active::-moz-range-thumb {
  background: #164188;
}

.range-slider .range-value {
  display: inline-block;
  position: relative;
  width: 100px;
  color: #fff;
  font-size: 23px;
  line-height: 32px;
  text-align: center;
  border-radius: 3px;
  background: #164188;
  padding: 5px 10px;
  margin-left: 7px;
}

::-moz-range-track {
  background: #ccc;
  border: 0;
}

input::-moz-focus-inner {
  border: 0;
}

Can you please guide me on how to use MS fillers on this code?

Body:
First, since the input event only supports input of type text and password in the IE browser, I suggest you could try to use the mouseup event to get the range value. Code as below:

var range = $('.input-range'),
  value = $('.range-value');

value.html(range.attr('value') + ' %');

range.on('mouseup', function() {
  value.html(this.value + ' %');
});

Second, please try to use the following CSS style:

<style>
    * {
        -webkit-box-sizing: border-box;
        -moz-box-sizing: border-box;
        box-sizing: border-box;
    }

    .PrixMin {
        float: left;
        color: #164188;
        font-size: 19px;
        margin-right: 5px;
    }

    .selecteurPrix {
        padding-top: 15px;
    }

    body {
        font-family: sans-serif;
        padding: 40px;
    }

    .valeurPrix {
        position: absolute;
        top: -59px;
        left: 177px;
    }

    .range-slider {
        position: relative;
        width: 450px;
        float: left;
        margin-right: 5px;
    }

    @media (-webkit-min-device-pixel-ratio:0) {
        /* Non-IE styles here*/
        .range-slider .input-range {
            -webkit-appearance: none;
            width: 449px;
            height: 5px;
            border-radius: 5px;
            background: #ccc;
            outline: none;
        }
    }

    @media (-ms-high-contrast:none),(-ms-high-contrast:active) {
        /* IE styles here*/
        .range-slider .input-range {
            /*removes default webkit styles*/
            -webkit-appearance: none;
            /*fix for FF unable to apply focus style bug */
            border: 1px solid white;
            /*required for proper track sizing in FF*/
            width: 450px;
            outline: none;
        }
    }

    .range-slider .input-range::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #164188;
        cursor: pointer;
        -webkit-transition: background .15s ease-in-out;
        transition: background .15s ease-in-out;
    }

                .range-slider .input-range::-webkit-slider-thumb:hover {
                    background: #164188;
                }

            .range-slider .input-range:active::-webkit-slider-thumb {
                background: #164188;
            }

            .range-slider .input-range::-moz-range-thumb {
                width: 20px;
                height: 20px;
                border: 0;
                border-radius: 50%;
                background: #164188;
                cursor: pointer;
                -webkit-transition: background .15s ease-in-out;
                transition: background .15s ease-in-out;
            }

                .range-slider .input-range::-moz-range-thumb:hover {
                    background: #164188;
                }

            .range-slider .input-range:active::-moz-range-thumb {
                background: #164188;
            }

        .range-slider .range-value {
            display: inline-block;
            position: relative;
            width: 100px;
            color: #fff;
            font-size: 23px;
            line-height: 32px;
            text-align: center;
            border-radius: 3px;
            background: #164188;
            padding: 5px 10px;
            margin-left: 7px;
        }
    ::-moz-range-track {
        background: #ccc;
        border: 0;
    }
    input::-moz-focus-inner {
        border: 0;
    }

    input[type=range] {
        margin: 2px;
    }

        input[type=range]::-ms-track {
            width: 450px;
            height: 5px;
            /*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */
            background: transparent;
            /*leave room for the larger thumb to overflow with a transparent border */
            border-color: transparent;
            border-width: 6px 0;
            /*remove default tick marks*/
            color: transparent;
        }

        input[type=range]::-ms-fill-lower {
            background: #ccc;
            border-radius: 10px;
        }

        input[type=range]::-ms-fill-upper {
            background: #ccc;
            border-radius: 10px;
        }

        input[type=range]::-ms-thumb {
            border: none;
            height: 16px;
            width: 16px;
            border-radius: 50%;
            background: #164188;
        }

        input[type=range]:focus::-ms-fill-lower {
            background: #ccc;
        }

        input[type=range]:focus::-ms-fill-upper {
            background: #ccc;
        }
</style>

The result in IE browser as below (you could find the whole sample code from here):


问:
How do I send multiple dySeries to a secondary axis based on checkbox input in shiny?
I'm trying to plot a dyGraph using the lungDeaths timeseries, but I want "mdeaths" and "fdeaths" to be on the secondary axis, if at least one of them is selected alongside "ldeaths".

Here's a working example:

global.R

```<code>library(dygraphs)
library(shiny)
library(datasets)
library(stringr)

lungDeaths <- cbind(mdeaths, fdeaths)
</code>```

ui.R

```<code>shinyUI(fluidPage(

titlePanel("Predicted Deaths from Lung Disease (UK)"),

sidebarLayout(
    sidebarPanel(

        id="sidebar", width = 3,
        div(
            checkboxGroupInput(
                inputId = "selection", label = "Variables:",
                choiceNames = list("ldeaths",
                                   strong("mdeaths"),
                                   strong("fdeaths")
                                   ),
                choiceValues = c("ldeaths",
                                 "mdeaths",
                                 "fdeaths"), selected = "ldeaths"),
            uiOutput("rendered"),
            style = "font-size:75%"
        )

    ),
    mainPanel(
        dygraphOutput("dygraph")
    )
)
))
</code>```

server.R

```<code>shinyServer(function(input, output) {

lungDeaths <- cbind(mdeaths, fdeaths, ldeaths)

rData <- reactive({
    rData <- ts(lungDeaths[,input$selection])
})

output$dygraph <- renderDygraph({

    if(length(input$selection) > 1 & length(str_subset(input$selection, 'ldeaths$'))>0){

        if(length(str_subset(input$selection, 'fdeaths$'))>0 & length(str_subset(input$selection, 'mdeaths$'))>0){
            dygraph(rData(), main = "Deaths from Lung Disease (UK)") %>%
                dySeries("mdeaths", axis = 'y2') %>%
                dySeries("fdeaths", axis = 'y2')
        }

        else if(length(str_subset(input$selection, 'mdeaths$'))>0){
            dygraph(rData(), main = "Deaths from Lung Disease (UK)") %>%
            dySeries("mdeaths", axis = 'y2')
        }
        else if(length(str_subset(input$selection, 'fdeaths$'))>0){
            dygraph(rData(), main = "Deaths from Lung Disease (UK)") %>%
            dySeries("fdeaths", axis = 'y2')

        }
    }
    else
        dygraph(rData(), main = "Deaths from Lung Disease (UK)")
})
})
</code>```

This code does what I want it to do, but I wanted to avoid using so many if's and else's, because the project I'm actually working with has 6 items that should go to y2 when selected. Is there any way to do it without having to specify each possibility?

I've already researched on how to add dySeries based on input and how to do conditional evaluation when using pipes, but the answers I found so far don't work for me. I usually get an error that says:

$ operator is invalid for atomic vectors

答:
You should do something like:</p>

```<code>dg = dygraphs(rData, main="...") %>%
  dyAxis("y", label="...") %>%
  dyAxis("y2", label="...")

for(col in leftCols)
  dg = dg %>% dySeries(col, axis="y")
for(col in rightCols)
  dg = dg %>% dySeries(col, axis="y2")
</code>```

Body:
I'm trying to plot a dyGraph using the lungDeaths timeseries, but I want "mdeaths" and "fdeaths" to be on the secondary axis, if at least one of them is selected alongside "ldeaths".

Here's a working example:

global.R

library(dygraphs)
library(shiny)
library(datasets)
library(stringr)

lungDeaths <- cbind(mdeaths, fdeaths)

ui.R

shinyUI(fluidPage(

titlePanel("Predicted Deaths from Lung Disease (UK)"),

sidebarLayout(
    sidebarPanel(

        id="sidebar", width = 3,
        div(
            checkboxGroupInput(
                inputId = "selection", label = "Variables:",
                choiceNames = list("ldeaths",
                                   strong("mdeaths"),
                                   strong("fdeaths")
                                   ),
                choiceValues = c("ldeaths",
                                 "mdeaths",
                                 "fdeaths"), selected = "ldeaths"),
            uiOutput("rendered"),
            style = "font-size:75%"
        )

    ),
    mainPanel(
        dygraphOutput("dygraph")
    )
)
))

server.R

shinyServer(function(input, output) {

lungDeaths <- cbind(mdeaths, fdeaths, ldeaths)

rData <- reactive({
    rData <- ts(lungDeaths[,input$selection])
})

output$dygraph <- renderDygraph({

    if(length(input$selection) > 1 & length(str_subset(input$selection, 'ldeaths$'))>0){

        if(length(str_subset(input$selection, 'fdeaths$'))>0 & length(str_subset(input$selection, 'mdeaths$'))>0){
            dygraph(rData(), main = "Deaths from Lung Disease (UK)") %>%
                dySeries("mdeaths", axis = 'y2') %>%
                dySeries("fdeaths", axis = 'y2')
        }

        else if(length(str_subset(input$selection, 'mdeaths$'))>0){
            dygraph(rData(), main = "Deaths from Lung Disease (UK)") %>%
            dySeries("mdeaths", axis = 'y2')
        }
        else if(length(str_subset(input$selection, 'fdeaths$'))>0){
            dygraph(rData(), main = "Deaths from Lung Disease (UK)") %>%
            dySeries("fdeaths", axis = 'y2')

        }
    }
    else
        dygraph(rData(), main = "Deaths from Lung Disease (UK)")
})
})

This code does what I want it to do, but I wanted to avoid using so many if's and else's, because the project I'm actually working with has 6 items that should go to y2 when selected. Is there any way to do it without having to specify each possibility?

I've already researched on how to add dySeries based on input and how to do conditional evaluation when using pipes, but the answers I found so far don't work for me. I usually get an error that says:

$ operator is invalid for atomic vectors

Body:
You should do something like:

dg = dygraphs(rData, main="...") %>%
  dyAxis("y", label="...") %>%
  dyAxis("y2", label="...")

for(col in leftCols)
  dg = dg %>% dySeries(col, axis="y")
for(col in rightCols)
  dg = dg %>% dySeries(col, axis="y2")


答:
Quote from the manual

time, timestamp, and interval accept an optional precision value p which specifies the number of fractional digits retained in the seconds field. By default, there is no explicit bound on precision. The allowed range of p is from 0 to 6

So just define your column as timestamp(0), e.g.:

```<code>create table foo
(
   some_timestamp timestamp(0)
);
</code>```

If you have an existing table with data, you can simply ALTER the column:

```<code>alter table some_table
   alter column some_timestamp type timestamp(0);
</code>```

If you now insert a timestamp with milliseconds, the value will be rounded to remove the milliseconds.

Note that technically you still have milliseconds in the stored value, but they are always set to 0

Title: Is there a native technique in PostgreSQL to force "timestamp without time zone" to not include milliseconds?

Body:
I am using PostgreSQL 9.6.17. (Migrating from MySQL)

A java program writes dates inside a table. The date formats is the following:
2019-01-01 09:00:00

But it can also be 2019-01-01 09:00:00.00 or 2019-01-01 09:00:00.000 when inserted in the database, which messes up my date management in my program when retrieved.

On insertion, I would like all the date to have the very same format: 2019-01-01 09:00:00. The datatype used by the column is timestamp without a time zone.

How can I tell postgresql to not input milliseconds in timestamp without timezone via configuration or SQL query ?

This data types doc does not provide any information about that.

Body:
Quote from the manual

time, timestamp, and interval accept an optional precision value p which specifies the number of fractional digits retained in the seconds field. By default, there is no explicit bound on precision. The allowed range of p is from 0 to 6

So just define your column as timestamp(0), e.g.:

create table foo
(
   some_timestamp timestamp(0)
);

If you have an existing table with data, you can simply ALTER the column:

alter table some_table
   alter column some_timestamp type timestamp(0);

If you now insert a timestamp with milliseconds, the value will be rounded to remove the milliseconds.

Note that technically you still have milliseconds in the stored value, but they are always set to 0


问:
How to handle Risk in TFS scrum templates
In the TFS CMMI template, I can find the Risk work item and it's very useful for us.
But I couldn't find this work item in the Scrum and the Agile template.
Please let me know how to handle the Risk within the TFS Scrum and Agile template.</p>

答:
Having a Risk Work Item is mostly considered an unnecessary overhead and is not required to meet CMMI. Since Risks don't change often, and should not abound, I would keep them on a list on the Team wall. If you have so many risks that you and your team cant remember them then that should set alarm bells off!

Wherever you keep them they should be visible and accessible by the engineers.

Option 1: Stickies on the wall (best)
Option 2: In Excel, printed and on the wall
Option 3: Create your own Risk work item


问:
Cut off from the text if its too long
Where i am listing the products, i dont want to show the full lead of them, so now i cut it off with max-height:90px.

Its working, but how can add some ...-after the text end? I tryed text-allipsis and white space no-wrap, but in that version, only 1 row text was showned, and not 4.

My code now for the text:

```<code>.item_list_text{max-height:90px;overflow:hidden;}
</code>```

答:
There's a way to do it using unofficial line-clamp syntax, and
starting with Firefox 68 it works with all major browsers.

```<code>.item_list_text {
   overflow: hidden;
   text-overflow: ellipsis;
   display: -webkit-box;
   -webkit-box-orient: vertical;
   -webkit-line-clamp: N; /* number of lines to show */
}
</code>```

body {
   margin: 20px;
}

.item_list_text {
  overflow: hidden;
   text-overflow: ellipsis;
   display: -webkit-box;
   -webkit-line-clamp: 3; /* number of lines to show */
   -webkit-box-orient: vertical;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="item_list_text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam consectetur venenatis blandit. Praesent vehicula, libero non pretium vulputate, lacus arcu facilisis lectus, sed feugiat tellus nulla eu dolor. Nulla porta bibendum lectus quis euismod. Aliquam volutpat ultricies porttitor. Cras risus nisi, accumsan vel cursus ut, sollicitudin vitae dolor. Fusce scelerisque eleifend lectus in bibendum. Suspendisse lacinia egestas felis a volutpat.
        </div></code>```

Unless you care about IE users, there is no need to do line-height and max-height fallbacks.

Title: Cut off from the text if its too long

Body:
Where i am listing the products, i dont want to show the full lead of them, so now i cut it off with max-height:90px.

Its working, but how can add some ...-after the text end? I tryed text-allipsis and white space no-wrap, but in that version, only 1 row text was showned, and not 4.

My code now for the text:

.item_list_text{max-height:90px;overflow:hidden;}

Body:
There's a way to do it using unofficial line-clamp syntax, and
starting with Firefox 68 it works with all major browsers.

.item_list_text {
   overflow: hidden;
   text-overflow: ellipsis;
   display: -webkit-box;
   -webkit-box-orient: vertical;
   -webkit-line-clamp: N; /* number of lines to show */
}

body {
   margin: 20px;
}

.item_list_text {
  overflow: hidden;
   text-overflow: ellipsis;
   display: -webkit-box;
   -webkit-line-clamp: 3; /* number of lines to show */
   -webkit-box-orient: vertical;
}

<div class="item_list_text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam consectetur venenatis blandit. Praesent vehicula, libero non pretium vulputate, lacus arcu facilisis lectus, sed feugiat tellus nulla eu dolor. Nulla porta bibendum lectus quis euismod. Aliquam volutpat ultricies porttitor. Cras risus nisi, accumsan vel cursus ut, sollicitudin vitae dolor. Fusce scelerisque eleifend lectus in bibendum. Suspendisse lacinia egestas felis a volutpat.
        </div>

Unless you care about IE users, there is no need to do line-height and max-height fallbacks.


问:
Regex - Select pattern within string
I'm new to Regex and facing a complicated !

I want to select ONLY the amount + the currency from the following list item.

Exemple: 150,00 Euro - 100,00 Libra ESTERLINA etc.

```<code>Monto: 150,00 EURO
Monto: 7.350,00 PESO URUGUAY | Pesos: 12.495,00 |Sucursal: 36|
Monto: 2.500,00 PESO URUGUAY
Monto: 200,00 U$S EEUU | Pesos: 12.550,00
Monto: 50,00 U$S EEUU
Monto: 700,00 REAL | Pesos: 10.500,00 | Sucursal: 101
Monto: 100,00 LIBRA ESTERLINA | Pesos: 8.500,00 | Sucursal: 12
Monto: 5.000,00 PESO CHILENO | Pesos: 400,00 | Sucursal: 101
</code>```

My regex test: https://regex101.com/r/R5Edrk/2

```<code>[0-9,.].+(Euro|URUGUAY|EEUU|CHILENO|ESTERLINA|REAL)
</code>```

I tried various combinations and formula but dont succeed to isolate amount + currency.
I also tried to select all the string untile the boundary "|" (the first vertical bar) but it didnt work...

Any help and explication is welcomed, thanks community ! :)

答:
You could make the pattern more specific by combining the amount and the currency in the alternation.

```<code>\b[0-9]+(?:[.,][0-9]+)*[ \t]+(?:Euro|PESO URUGUAY|U\$S EEUU|REAL|LIBRA ESTERLINA|PESO CHILENO)
</code>```

\b Word boundary to prevent the word being part of a longer word

[0-9]+ Match 1+ digits

(?:[.,][0-9]+)* Repeat 0+ times matching either a dot or comma and 1+ digits

[ \t]+ Match 1+ spaces or tabs

(?: Non capture group to match one of the alternatives

Euro|PESO URUGUAY|U\$S EEUU|REAL|LIBRA ESTERLINA|PESO CHILENO

) Close non capture group

Regex demo

The documentation about re2 states To match a metacharacter, escape it with a backslash

You could look into the documentation to see if you are using the right function that accepts a regex.

Title: Regex - Select pattern within string

Body:
I'm new to Regex and facing a complicated !

I want to select ONLY the amount + the currency from the following list item.

Exemple: 150,00 Euro - 100,00 Libra ESTERLINA etc.

Monto: 150,00 EURO
Monto: 7.350,00 PESO URUGUAY | Pesos: 12.495,00 |Sucursal: 36|
Monto: 2.500,00 PESO URUGUAY
Monto: 200,00 U$S EEUU | Pesos: 12.550,00
Monto: 50,00 U$S EEUU
Monto: 700,00 REAL | Pesos: 10.500,00 | Sucursal: 101
Monto: 100,00 LIBRA ESTERLINA | Pesos: 8.500,00 | Sucursal: 12
Monto: 5.000,00 PESO CHILENO | Pesos: 400,00 | Sucursal: 101

My regex test: https://regex101.com/r/R5Edrk/2

[0-9,.].+(Euro|URUGUAY|EEUU|CHILENO|ESTERLINA|REAL)

I tried various combinations and formula but dont succeed to isolate amount + currency.
I also tried to select all the string untile the boundary "|" (the first vertical bar) but it didnt work...

Any help and explication is welcomed, thanks community ! :)

Body:
You could make the pattern more specific by combining the amount and the currency in the alternation.

\b[0-9]+(?:[.,][0-9]+)*[ \t]+(?:Euro|PESO URUGUAY|U\$S EEUU|REAL|LIBRA ESTERLINA|PESO CHILENO)

\b Word boundary to prevent the word being part of a longer word

[0-9]+ Match 1+ digits

(?:[.,][0-9]+)* Repeat 0+ times matching either a dot or comma and 1+ digits

[ \t]+ Match 1+ spaces or tabs

(?: Non capture group to match one of the alternatives

Euro|PESO URUGUAY|U\$S EEUU|REAL|LIBRA ESTERLINA|PESO CHILENO

) Close non capture group

Regex demo

The documentation about re2 states To match a metacharacter, escape it with a backslash

You could look into the documentation to see if you are using the right function that accepts a regex.


问:
try-catch blocks with the return type
If I have a method that returns something, like

```<code>public DataTable ReturnSomething()
{
   try
   {
      //logic here
     return ds.Tables[0];
   }
   catch (Exception e)
   {
      ErrorString=e.Message;
   }
}
</code>```

This produces compiler error, obviously because catch{} block does not return anything.

So when I have methods with return values I don't use try-catch block, which is a bad practice. If there is an error, I would like to set error string to that error. But then I need a return value as well. Advice?

答:
The ErrorString variable looks suspiciously like an error code variable.  Recommended practice is to use exceptions to pass error information directly, where necessary, rather than storing things off into error codes.

You are effectively doing the same thing with your ErrorString as you would be if you just let the exception be caught by the caller: removing the responsibility of responding to an error from the method itself.  This is a good goal to have.  But the use of an error string doesn't gain you anything over the use of an exception.  In fact, you lose information this way.  There are any number of types of errors that could occur, and many have special exceptions associated with them, with their own special properties to hold contextual info about the failure.  By just storing off the message in a String, you're losing this information.

So unless your goal is specifically to hide the type of error that is occurring from the caller, you can only gain by letting the exception through.

Another thing to consider is whether this is truly an error scenario. If it is, it's very unlikely that your calling method is going to care at all what the return value is.  In which case, you have nothing to worry about by just letting the exception go and not returning anything.  If it's NOT really an error scenario, and the caller is just going to continue on and do something else, well, that's for the caller to decide, right?  There's still not much benefit to obtain by returning an error string and a dummy DataTable or a null, over throwing the exception with all its contextual failure info.

OwnerDisplayName: Julia

LastEditorDisplayName: Daniel L

ContentLicense: CC BY-SA 2.5

Title: try-catch blocks with the return type

Body:
If I have a method that returns something, like

public DataTable ReturnSomething()
{
   try
   {
      //logic here
     return ds.Tables[0];
   }
   catch (Exception e)
   {
      ErrorString=e.Message;
   }
}

This produces compiler error, obviously because catch{} block does not return anything.

So when I have methods with return values I don't use try-catch block, which is a bad practice. If there is an error, I would like to set error string to that error. But then I need a return value as well. Advice?

OwnerDisplayName: Turbulent Intellect


问:
Make elements of container fill height of container by wrapping
I have an issue with trying to make the items within a container take up the space the way i want. The main issue seems to be that flex box and css grid are made adjust to changes in width and not height, where as i need the opposite behaviour.This is basically what I want my elements to do

Check the desired effect here.

I have tried using both flex box and css grid.
This is my current code, also containing some residue of my previous attempt. It just makes the images display in their actual size.
The media-container's height is changed via javascript.

.display-img {
  padding:0px;
  margin-top:-4px;
  margin-bottom:-4px;
  flex:0 1 auto;
  height:auto;
}

.media-container{
  width: auto;
  height:800px;
  display:flex;
  //grid-template-rows: repeat(auto-fit,auto);
  //grid-template-columns: repeat(auto-fit,minmax(200px,0.5fr));
  flex-direction: row;
  align-items: flex-start;
  flex-wrap: wrap;
  visibility: hidden;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="media-container">
  <img class="display-img" src="assets/projects/feierlichkeiten/23.png"></img>
  <img class="display-img" src="assets/projects/feierlichkeiten/22.png"></img>
  <img class="display-img" src="assets/projects/feierlichkeiten/21.png"></img>
  <img class="display-img" src="assets/projects/feierlichkeiten/20.png"></img>
  <img class="display-img" src="assets/projects/feierlichkeiten/19.png"></img>
</div></code>```

Thanks to everyone who has some idea.

答:
I am also pretty confused by your request tbh. The screenshot you posted, that you want to replicate, is just standard behaviour with css grid. So maybe I misunderstood. Here is the codepen with correct settings to replicate the screenshot you posted:

https://codepen.io/doughballs/pen/bGdeBQa

On the container we set:

```<code>main {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  border: 2px solid red;
  padding: 20px;
}
</code>```

Which tells the contents to be a minimum of 200px wide, and to wrap if there isn't enough space.

And on the images:

```<code>img {
  display: block;
  width:100%;
  border: 2px solid black;

}
</code>```

This is a great resource from Jen Simmons:

https://www.youtube.com/watch?v=tFKrK4eAiUQ&t=218s

Body:
I have an issue with trying to make the items within a container take up the space the way i want. The main issue seems to be that flex box and css grid are made adjust to changes in width and not height, where as i need the opposite behaviour.This is basically what I want my elements to do

Check the desired effect here.

I have tried using both flex box and css grid.
This is my current code, also containing some residue of my previous attempt. It just makes the images display in their actual size.
The media-container's height is changed via javascript.

.display-img {
  padding:0px;
  margin-top:-4px;
  margin-bottom:-4px;
  flex:0 1 auto;
  height:auto;
}

.media-container{
  width: auto;
  height:800px;
  display:flex;
  //grid-template-rows: repeat(auto-fit,auto);
  //grid-template-columns: repeat(auto-fit,minmax(200px,0.5fr));
  flex-direction: row;
  align-items: flex-start;
  flex-wrap: wrap;
  visibility: hidden;
}

Thanks to everyone who has some idea.

Body:
I am also pretty confused by your request tbh. The screenshot you posted, that you want to replicate, is just standard behaviour with css grid. So maybe I misunderstood. Here is the codepen with correct settings to replicate the screenshot you posted:

https://codepen.io/doughballs/pen/bGdeBQa

On the container we set:

main {
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  border: 2px solid red;
  padding: 20px;
}

Which tells the contents to be a minimum of 200px wide, and to wrap if there isn't enough space.

And on the images:

img {
  display: block;
  width:100%;
  border: 2px solid black;

}

This is a great resource from Jen Simmons:

https://www.youtube.com/watch?v=tFKrK4eAiUQ&t=218s


问:
update curl on centos
There is curl v7.19.7 on my cnetos. Since I want to develop c++ program to send email, I got the curl v7.50.3 source code and install it(configure, make, make install). Although my c++ program build successfully, but when I try to execute it, there are errors:

```<code>* Protocol smtp not supported or disabled in libcurl
* Unsupported protocol
curl_easy_perform() failed: Unsupported protocol
</code>```

When I proceed command: curl --version, it shows:

```<code>curl 7.50.3 (x86_64-pc-linux-gnu) libcurl/7.19.7 NSS/3.13.6.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
</code>```

It seems libcurl still refer to the older version!

Although I try to

```<code>1. rpm -q curl
2. rpm -e --nodeps curl-7.19.7-35.el6.x86_64
</code>```

but it comes out no difference. I also add "/usr/local/lib" in /etc/ld.so.conf, still not working!

How can I do to remove old version curl library(v7.19.7) clearly, let my c++ program refer to the new version curl(v7.50.3)?

答:
You can use following commands;

```<code>rpm -Uvh http://www.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-2-1.rhel6.noarch.rpm
yum --enablerepo=city-fan.org update curl
</code>```

Enter this command to see the version;

```<code>curl -V
</code>```

Title: update curl on centos

Body:
There is curl v7.19.7 on my cnetos. Since I want to develop c++ program to send email, I got the curl v7.50.3 source code and install it(configure, make, make install). Although my c++ program build successfully, but when I try to execute it, there are errors:

* Protocol smtp not supported or disabled in libcurl
* Unsupported protocol
curl_easy_perform() failed: Unsupported protocol

When I proceed command: curl --version, it shows:

curl 7.50.3 (x86_64-pc-linux-gnu) libcurl/7.19.7 NSS/3.13.6.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2

It seems libcurl still refer to the older version!

Although I try to

1. rpm -q curl
2. rpm -e --nodeps curl-7.19.7-35.el6.x86_64

but it comes out no difference. I also add "/usr/local/lib" in /etc/ld.so.conf, still not working!

How can I do to remove old version curl library(v7.19.7) clearly, let my c++ program refer to the new version curl(v7.50.3)?

Body:
You can use following commands;

rpm -Uvh http://www.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-2-1.rhel6.noarch.rpm
yum --enablerepo=city-fan.org update curl

Enter this command to see the version;

curl -V


问:
How to find a unique word with regular expression from the log files in linux
I need to search the unique value of a strings from a log file like

```<code>tsetasjbvasgfsabggc Test: [ABC]
tsetasjbvasgfsabggc Test: [DEF]
</code>```

How can I find the values Test: [ABC] and Test: [DEF]

答:
This should work: cat "yourLogFile" | grep '\[...\]'

For mutliple files use:

```<code>for f in $(ls | find *log* ); do cat $f| grep 'Test:\s\[.*\]';done
</code>```

Just customize the find *log* part to find all of your log files.

Body:
I need to search the unique value of a strings from a log file like

tsetasjbvasgfsabggc Test: [ABC]
tsetasjbvasgfsabggc Test: [DEF]

How can I find the values Test: [ABC] and Test: [DEF]

Body:
This should work: cat "yourLogFile" | grep '\[...\]'

For mutliple files use:

for f in $(ls | find *log* ); do cat $f| grep 'Test:\s\[.*\]';done

Just customize the find *log* part to find all of your log files.


问:
Parallel.ForEach missing items
I've following code:

```<code>HttpContext httpContext = HttpContext.Current;
RequestContext currentContext = RequestContextManager.CurrentContext;
ILifetimeScope currentSessionScope = PlatformContext.LifeTimeScope;

ConcurrentQueue<Exception> exceptions = new ConcurrentQueue<Exception>();
ConcurrentBag<ParallelCalculateObj> forEachResult = new ConcurrentBag<ParallelCalculateObj>();
ConcurrentBag<ParallelCalculateObj> testForEachPassResult = new ConcurrentBag<ParallelCalculateObj>();

ParallelLoopResult loopResult = Parallel.ForEach(applications, () =>
{
    HttpContext.Current = httpContext;
    RequestContextManager.SetCustomCurrentContext(currentContext);
    PlatformContext.LifeTimeScope = currentSessionScope;
    return new ParallelCalculateObj();
}, (application, pls, localObj) =>
{
    try
    {
        // some code
    }
    catch (Exception e)
    {
        exceptions.Enqueue(e);
    }
    testForEachPassResult.Add(localObj);
    return localObj;
}, forEachResult.Add);
</code>```

where applications.Count = 3. After executing above code I got forEachResult.Count = 2 and testForEachPassResult.Count = 3

Why forEachResult collection does not contain all of elements?
There is no exception and ParallelLoopResult.IsCompleted = true.

One thing that might be helpful in resolving my problem is that this three items was run under two threads:

Item01 -> Thread.CurrentThread.ManagedThreadId is 14

Item02 -> Thread.CurrentThread.ManagedThreadId is 10

Item03 -> Thread.CurrentThread.ManagedThreadId is 14

答:
There are 3 ways, two of which are mentioned already.

(1) Each loop creates a collection and adds its result to this task-result collection. When completed all task-results are combined. I would use this as default because if avoids lock contention.

(2) A common collection is created outside of all tasks. All tasks write to the collection but the write to this collection (adding items) must be synchronized with a lock because it is not atomic. I would use this if there are only a few 100 items to process but the processing time per item is one second or more. In this case the locking time is negligible.

(3) Create an array outside of all tasks and give each task a region to write the results to. Even though all tasks write to the same array the memory locations they write to are different. So there is no need for synchronization.

Example for (3)

```<code>// Source must be array or IList.
var source = Enumerable.Range(0, 100000).ToArray();

// Partition the entire source array.
var rangePartitioner = Partitioner.Create(0, source.Length);

double[] results = new double[source.Length];

// Loop over the partitions in parallel.
Parallel.ForEach(rangePartitioner, (range, loopState) =>
{
    // Loop over each range element without a delegate invocation.
    for (int i = range.Item1; i < range.Item2; i++)
    {
        results[i] = source[i] * Math.PI;
    }
});
</code>```

Code from: https://learn.microsoft.com/en-us/dotnet/standard/parallel-programming/custom-partitioners-for-plinq-and-tpl#configuring-static-range-partitioners-for-parallelforeach

Title: Parallel.ForEach missing items

Body:
I've following code:

HttpContext httpContext = HttpContext.Current;
RequestContext currentContext = RequestContextManager.CurrentContext;
ILifetimeScope currentSessionScope = PlatformContext.LifeTimeScope;

ConcurrentQueue<Exception> exceptions = new ConcurrentQueue<Exception>();
ConcurrentBag<ParallelCalculateObj> forEachResult = new ConcurrentBag<ParallelCalculateObj>();
ConcurrentBag<ParallelCalculateObj> testForEachPassResult = new ConcurrentBag<ParallelCalculateObj>();

ParallelLoopResult loopResult = Parallel.ForEach(applications, () =>
{
    HttpContext.Current = httpContext;
    RequestContextManager.SetCustomCurrentContext(currentContext);
    PlatformContext.LifeTimeScope = currentSessionScope;
    return new ParallelCalculateObj();
}, (application, pls, localObj) =>
{
    try
    {
        // some code
    }
    catch (Exception e)
    {
        exceptions.Enqueue(e);
    }
    testForEachPassResult.Add(localObj);
    return localObj;
}, forEachResult.Add);

where applications.Count = 3. After executing above code I got forEachResult.Count = 2 and testForEachPassResult.Count = 3

Why forEachResult collection does not contain all of elements?
There is no exception and ParallelLoopResult.IsCompleted = true.

One thing that might be helpful in resolving my problem is that this three items was run under two threads:

Item01 -> Thread.CurrentThread.ManagedThreadId is 14

Item02 -> Thread.CurrentThread.ManagedThreadId is 10

Item03 -> Thread.CurrentThread.ManagedThreadId is 14

Body:
There are 3 ways, two of which are mentioned already.

(1) Each loop creates a collection and adds its result to this task-result collection. When completed all task-results are combined. I would use this as default because if avoids lock contention.

(2) A common collection is created outside of all tasks. All tasks write to the collection but the write to this collection (adding items) must be synchronized with a lock because it is not atomic. I would use this if there are only a few 100 items to process but the processing time per item is one second or more. In this case the locking time is negligible.

(3) Create an array outside of all tasks and give each task a region to write the results to. Even though all tasks write to the same array the memory locations they write to are different. So there is no need for synchronization.

Example for (3)

// Source must be array or IList.
var source = Enumerable.Range(0, 100000).ToArray();

// Partition the entire source array.
var rangePartitioner = Partitioner.Create(0, source.Length);

double[] results = new double[source.Length];

// Loop over the partitions in parallel.
Parallel.ForEach(rangePartitioner, (range, loopState) =>
{
    // Loop over each range element without a delegate invocation.
    for (int i = range.Item1; i < range.Item2; i++)
    {
        results[i] = source[i] * Math.PI;
    }
});

Code from: https://learn.microsoft.com/en-us/dotnet/standard/parallel-programming/custom-partitioners-for-plinq-and-tpl#configuring-static-range-partitioners-for-parallelforeach


问:
Language for non-unicode programs change ini reading
I've a non-unicode application which is using unicode versions of the ini reading functions like GetPrivateProfileSectionW and GetPrivateProfileStringW. The program is working well when "Language for non-unicode programs" is set to English.

When I change this setting to Chinese (PRC), the functions GetPrivateProfileSectionW and GetPrivateProfileStringW return null.

I must keep this setting at Chinese, because when English is selected for "Language for non-unicode programs", CComBSTR.LoadString is not working as expected, it loads the Chinese characters in a resource DLL as question marks.

Any ideas?

Thanks.

答: Michael Kaplan explains. The solution is to use Unicode INI files, which don't depend on the "Language for non-unicode programs".</p>


问:
Perl next if regex stored in array
i have a piece of code with a a while loop and a couple of next if's like this in the loop :

```<code>LOOP:
while (something) {
   next if $UPUPRF =~ /^T[0-9]{6}/;
   next if $UPUPRF =~ /^SECURITE.*/;
   next if $UPUPRF =~ /^AUDIT[A-Z]{2}/;
}
</code>```

i would like to put these regexes in my configuation file (a perl data structure) instead of having them "hardcoded" in the script, so that the user can edit them easily by just editing the configuration file,  and would like your advice regarding this.

what is the cleanest way of doing this ?

first, i guess i can store the regexes like this in the configuration file ? (with qr//):

```<code> ....
 exclude_acct => [
                    qr/^T[0-9]{6}/,
                    qr/^AUDIT[A-Z]{2}/,
                    qr/^SECURITE.*/,
                 ],
 ....
</code>```

and in my loop, should i use something like this ? :

```<code>foreach (@{ $myhash{exclude_acct} }) {
    next LOOP if $UPUPRF =~ /$_/;
}
</code>```

thanks for your advices.

regards

note : i haven't tried this code yet, just guessing that i could do it like that, but i'm mainly wondering if this is "clean" or if there is a cleaner way of doing it

答:
That's fine, but starting the regex engine is relatively expensive, so it would be faster than create one regex from the many.

```<code># Once, before the loop.
my $pat = join "|", @{ $myhash{exclude_acct} };
my $re = qr/$pat/;

# In the loop.
next LOOP if $UPUPRF =~ $re;
</code>```

This can break backreferences (\1), though.

Title: Perl next if regex stored in array

Body:
i have a piece of code with a a while loop and a couple of next if's like this in the loop :

LOOP:
while (something) {
   next if $UPUPRF =~ /^T[0-9]{6}/;
   next if $UPUPRF =~ /^SECURITE.*/;
   next if $UPUPRF =~ /^AUDIT[A-Z]{2}/;
}

i would like to put these regexes in my configuation file (a perl data structure) instead of having them "hardcoded" in the script, so that the user can edit them easily by just editing the configuration file,  and would like your advice regarding this.

what is the cleanest way of doing this ?

first, i guess i can store the regexes like this in the configuration file ? (with qr//):

 ....
 exclude_acct => [
                    qr/^T[0-9]{6}/,
                    qr/^AUDIT[A-Z]{2}/,
                    qr/^SECURITE.*/,
                 ],
 ....

and in my loop, should i use something like this ? :

foreach (@{ $myhash{exclude_acct} }) {
    next LOOP if $UPUPRF =~ /$_/;
}

thanks for your advices.

regards

note : i haven't tried this code yet, just guessing that i could do it like that, but i'm mainly wondering if this is "clean" or if there is a cleaner way of doing it

Body:
That's fine, but starting the regex engine is relatively expensive, so it would be faster than create one regex from the many.

# Once, before the loop.
my $pat = join "|", @{ $myhash{exclude_acct} };
my $re = qr/$pat/;

# In the loop.
next LOOP if $UPUPRF =~ $re;

This can break backreferences (\1), though.


问:
I can get any emulators running in vs code
When I ever I try to create a new emulator I get this error
I can get any emulators running in vs code. I am getting No suitable Android AVD system images are available. You may need to install these using sdkmanager, for example: sdkmanager "system-images;android-27;google_apis_playstore;x86"”</p>

答:
```<code>Open Android Studio -> Configure -> AVD Manager -> Run Your Virtual Device
Visual studio code -> View -> Command palette... -> Flutter: Select Device -> choose your android device
</code>```


问:
Not able to get the text property of custom stepper used in the xaml file to its cs file in xamarin forms
Here group binding is done and the products are listed under the corresponding dealers. I want to multiply the price and quantity of each products under one dealer and store it in a List_model-OrderModel when the View Order button is clicked. I am not able to access the quantity value in the custom stepper text in my cs file.
I tried var qty = stepper.Text. but the name stepper is not coming. CustomStepper and Stepper is coming the dropdown.

This is my custom stepper:

```<code>/*Created this class to make a custon stepper to add quantity */
public class CustomStepper : StackLayout
{
    Button PlusBtn;
    Button MinusBtn;
    Label QtyLbl;

    public static readonly BindableProperty TextProperty =
      BindableProperty.Create(
         propertyName: "Text",
          returnType: typeof(int),
          declaringType: typeof(CustomStepper),
          defaultValue: 0,
          defaultBindingMode: BindingMode.TwoWay);

    public int Text
    {
        get { return (int)GetValue(TextProperty); }
        set { SetValue(TextProperty, value); }
    }

    public CustomStepper()
    {
        PlusBtn = new Button { Text = "+", WidthRequest = 23, HeightRequest = 25, FontSize = 11, BackgroundColor = Color.LightGray, Padding = 0};
        MinusBtn = new Button { Text = "-", WidthRequest = 23, HeightRequest = 25, FontSize = 11, BackgroundColor = Color.LightGray, Padding = 0};

        Orientation = StackOrientation.Horizontal;
        PlusBtn.Clicked += PlusBtn_Clicked;
        MinusBtn.Clicked += MinusBtn_Clicked;

        QtyLbl = new Label { FontSize = 11, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, WidthRequest = 20   };
        QtyLbl.SetBinding(Entry.TextProperty, new Binding(nameof(Text), BindingMode.TwoWay, source:this));

        Children.Add(MinusBtn);
        Children.Add(QtyLbl);
        Children.Add(PlusBtn);
    }

    private void MinusBtn_Clicked(object sender, EventArgs e)
    {
        if (Text > 0)
            Text--;
    }

    private void PlusBtn_Clicked(object sender, EventArgs e)
    {
        if (Text < 10)
            Text++;
    }
}
</code>```

This is my Model class code:

```<code>public partial class AllProductListview
{
    public decimal PK { get; set; }
    public decimal VendorFK { get; set; }
    public string Vendorname { get; set; }
    public string distance { get; set; }
    public string NameE { get; set; }
    public string NameC { get; set; }
    public float SalesPrice { get; set; }
    public int Quantity { get; set; }
    public decimal DChargeMode { get; set; }
    public string VatForm { get; set; }
    public float TotalAmount { get; set; }
    public string DeliveryCharge { get; set; }

  }

public class OrderModel
{
    public int PK { get; set; }
    public int VendorFK { get; set; }

    public string NameE { get; set; }
    public string NameC { get; set; }
    public float SalesPrice { get; set; }
    public int DChargeMode { get; set; }
    public string VatForm { get; set; }
    public string DeliveryCharge { get; set; }
    public int Quantity { get; set; }
    public float TotalAmount { get; set; }
    public string Delete { get; set; }
}
</code>```

I have this in my button click in the corresponding cs file:

```<code>private async void viewOrderBtn_Clicked(object sender, EventArgs e)
    {
        var item = (Button)sender;

        /*item.BindingContext contains all the values [whn i did step by step debugging] as in AllProductListview..now I have to put it in a loop and calculate the total by multiplying the price and quantity and store it in OrderModel by adding the record into the Orderlist*/
        var productList = item.BindingContext as AllProductListview;
        List<OrderModel> Orderlist = new List<OrderModel>();
    }
</code>```

My xaml file :

```<code><Grid Grid.Row="3">
            <Frame HasShadow="True"
                   BackgroundColor="White"
                   Margin="1"
                   Padding="5"> <!--@ambi : changed margin from 2 to 1 padding-10-->
                <ListView
                        x:Name="Prodlistview"
                        IsGroupingEnabled="True"
                        ItemsSource="{Binding GroupedData}"
                        GroupDisplayBinding="{Binding Key}"
                        ItemSelected="Prodlistview_ItemSelected"
                        SeparatorVisibility="Default">

                    <ListView.GroupHeaderTemplate>
                        <DataTemplate>
                            <ViewCell Height="5"><!--@ambi : height-15-->
                                <StackLayout VerticalOptions="CenterAndExpand"
                                             Padding="0,0"
                                             Orientation="Horizontal"

                                            BackgroundColor="#e3e2de">
                                    <!--padding - 10  FontAttributes="Bold"-->
                                    <Label Text="{Binding Key}"
                                           TextColor="Black"
                                           VerticalOptions="CenterAndExpand"
                                           HorizontalOptions="CenterAndExpand"
                                           FontSize="12"
                                           Style="{StaticResource listlabel}"/>

                                    <Button x:Name="viewOrderBtn"
                                            Text= "{lang:Translate DriverViewOrder}"
                                            HorizontalOptions="EndAndExpand"
                                            FontAttributes="None"
                                            CommandParameter="{Binding Key}"
                                            Clicked="viewOrderBtn_Clicked"
                                            Margin="2,5"
                                            Padding="1"
                                            FontSize="12"/> <!--@ambi : added button in the group view-->
                                </StackLayout>
                            </ViewCell>
                        </DataTemplate>

                    </ListView.GroupHeaderTemplate>

                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <local:ListViewSelectionColorRender SelectedBackgroundColor="Transparent">
                                <ViewCell.View>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="*"/>    <!--qty..width 0.55-->
                                        </Grid.ColumnDefinitions>
                                        <Label Grid.Column="0" Text="{Binding NameE}"
                                               Style="{StaticResource listlabel}" MaxLines="1"
                                               HorizontalTextAlignment="Start"
                                               LineBreakMode="TailTruncation"/>
                                        <!--@ambi : HorizontalTextAlignment="Start"-->
                                        <Label Grid.Column="1" Text="{Binding distance}" Style="{StaticResource listlabel}"
                                               TextColor="DarkGoldenrod"/>

                                        <Label Grid.Column="2" Text="{Binding SalesPrice}"
                                               Padding="0,0,15,0"
                                               HorizontalTextAlignment="End"
                                               Style="{StaticResource listlabel}"/>

                                        <StackLayout Grid.Column="3" VerticalOptions="Center" x:Name="Container">
                                            <!--<Frame BorderColor="Gray" HeightRequest="30" WidthRequest="40"
                                                   CornerRadius="7" Padding="5,0" Margin="0,0" HasShadow="False">
                                                <local:BorderlessPicker x:Name="picker"
                                                                        Title="{lang:Translate Select}"
                                                                        Style="{StaticResource picker}"
                                                                        SelectedIndex="{Binding Pickerindex}"
                                                                        ItemsSource="{Binding QtyListModel}"
                                                                        SelectedIndexChanged="QtyPicker_SelectedIndexChanged"
                                                                        ItemDisplayBinding="{Binding Quantity}"
                                                                        TextColor="Black"/>
                                            </Frame>-->
                                            <!--@ambi : Custom stepper added to check a different method-->
                                                <local:CustomStepper x:Name="stepper"
                                                                     Text="{Binding Quantity, Mode=TwoWay}"
                                                                     Padding="3,0" />
                                        </StackLayout>
                                    </Grid>
                                </ViewCell.View>
                            </local:ListViewSelectionColorRender>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </Frame>
        </Grid>
</code>```

Image :
My screen

Update :
I have attached the pic of my debug window. Please walk me from here. I could bring the data from the xaml. I'm new to xamarin forms. No idea how to go from here.

```<code>private async void viewOrderBtn_Clicked(object sender, EventArgs e)
    {
        /*item.BindingContext contains all the values [whn i did step by step *debugging] as in AllProductListview..now I have to put it in a loop and *calculate the total by multiplying the price and quantity and store it in *OrderModel by adding the record into the Orderlist*/
        var item = (Button)sender;
        var itemobj = item?.BindingContext as AllProductListview;
        List<OrderModel> Orderlist = new List<OrderModel>();
        int ID = Convert.ToInt32(itemobj.PK); //showing no value assigned
        int vendorfk = Convert.ToInt32(itemobj.VendorFK); //showing no value assigned
        float price = itemobj.SalesPrice; //showing no value assigned
        int quantity = itemobj.Quantity; //showing no value assigned
        float total = price * quantity;
    }
</code>```

Debug window

答:
@chetan Thanks for the time and patience you took to help me out.

This is the final code.

```<code> private async void viewOrderBtn_Clicked(object sender, EventArgs e)
    {
        var item = (Button)sender;
        List<OrderModel> Orderlist = new List<OrderModel>();
        bool Issame = true;
        OrderData.Clear();
        int vendorfk;
        foreach (var items in GroupedData)
        {
            foreach (var orderdet in items)
            {
                var productname = orderdet.NameE;
                float price = orderdet.SalesPrice;
                int quantity = orderdet.Quantity;
                float total = price * quantity;
                vendorfk = Convert.ToInt32(orderdet.VendorFK);
                if (quantity != 0)
                {
                    Orderlist.Add(new OrderModel
                    {
                        PK = Convert.ToInt32(orderdet.PK),
                        VendorFK = Convert.ToInt32(orderdet.VendorFK),
                        NameE = orderdet.NameE,
                        NameC = orderdet.NameC,
                        SalesPrice = orderdet.SalesPrice,
                        DChargeMode = Convert.ToInt32(orderdet.DChargeMode),
                        VatForm = orderdet.VatForm,
                        DeliveryCharge = orderdet.DeliveryCharge,
                        Quantity = quantity,
                        TotalAmount = total,
                        Delete = "delete.png"
                    });
                }
            }
        }

        int count = Orderlist.Count;
        for (int i = 0; i < count; i++)
        {
            OrderData.Add(new OrderModel
            {
                PK = Orderlist[i].PK,
                VendorFK = Orderlist[i].VendorFK,
                NameE = Orderlist[i].NameE,
                NameC = Orderlist[i].NameC,
                SalesPrice = Orderlist[i].SalesPrice,
                DChargeMode = Orderlist[i].DChargeMode,
                VatForm = Orderlist[i].VatForm,
                DeliveryCharge = Orderlist[i].DeliveryCharge,
                Quantity = Orderlist[i].Quantity,
                TotalAmount = Orderlist[i].TotalAmount,
                Delete = Orderlist[i].Delete
            });
            if (Orderlist[i].VendorFK == OrderData[0].VendorFK)
            {
                Isexecute = true;
                Issame = true;
            }
            else
            {
                Isexecute = false;
                Issame = false;
            }
        }
        if(Issame == false)
        {
            await DisplayAlert(LangResource.Alert, "You must order from the same dealer only.", LangResource.ok);
            Isexecute = false;
        }

        if (Isexecute)
        {
            UploadPopUpPage orderPage = new UploadPopUpPage(OrderData);
            orderPage.EventPass += OrderPage_EventPass;
            await PopupNavigation.PushAsync(orderPage);
        }
    }
</code>```

Body:
Here group binding is done and the products are listed under the corresponding dealers. I want to multiply the price and quantity of each products under one dealer and store it in a List_model-OrderModel when the View Order button is clicked. I am not able to access the quantity value in the custom stepper text in my cs file.
I tried var qty = stepper.Text. but the name stepper is not coming. CustomStepper and Stepper is coming the dropdown.

This is my custom stepper:

/*Created this class to make a custon stepper to add quantity */
public class CustomStepper : StackLayout
{
    Button PlusBtn;
    Button MinusBtn;
    Label QtyLbl;

    public static readonly BindableProperty TextProperty =
      BindableProperty.Create(
         propertyName: "Text",
          returnType: typeof(int),
          declaringType: typeof(CustomStepper),
          defaultValue: 0,
          defaultBindingMode: BindingMode.TwoWay);

    public int Text
    {
        get { return (int)GetValue(TextProperty); }
        set { SetValue(TextProperty, value); }
    }

    public CustomStepper()
    {
        PlusBtn = new Button { Text = "+", WidthRequest = 23, HeightRequest = 25, FontSize = 11, BackgroundColor = Color.LightGray, Padding = 0};
        MinusBtn = new Button { Text = "-", WidthRequest = 23, HeightRequest = 25, FontSize = 11, BackgroundColor = Color.LightGray, Padding = 0};

        Orientation = StackOrientation.Horizontal;
        PlusBtn.Clicked += PlusBtn_Clicked;
        MinusBtn.Clicked += MinusBtn_Clicked;

        QtyLbl = new Label { FontSize = 11, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, WidthRequest = 20   };
        QtyLbl.SetBinding(Entry.TextProperty, new Binding(nameof(Text), BindingMode.TwoWay, source:this));

        Children.Add(MinusBtn);
        Children.Add(QtyLbl);
        Children.Add(PlusBtn);
    }

    private void MinusBtn_Clicked(object sender, EventArgs e)
    {
        if (Text > 0)
            Text--;
    }

    private void PlusBtn_Clicked(object sender, EventArgs e)
    {
        if (Text < 10)
            Text++;
    }
}

This is my Model class code:

public partial class AllProductListview
{
    public decimal PK { get; set; }
    public decimal VendorFK { get; set; }
    public string Vendorname { get; set; }
    public string distance { get; set; }
    public string NameE { get; set; }
    public string NameC { get; set; }
    public float SalesPrice { get; set; }
    public int Quantity { get; set; }
    public decimal DChargeMode { get; set; }
    public string VatForm { get; set; }
    public float TotalAmount { get; set; }
    public string DeliveryCharge { get; set; }

  }

public class OrderModel
{
    public int PK { get; set; }
    public int VendorFK { get; set; }

    public string NameE { get; set; }
    public string NameC { get; set; }
    public float SalesPrice { get; set; }
    public int DChargeMode { get; set; }
    public string VatForm { get; set; }
    public string DeliveryCharge { get; set; }
    public int Quantity { get; set; }
    public float TotalAmount { get; set; }
    public string Delete { get; set; }
}

I have this in my button click in the corresponding cs file:

private async void viewOrderBtn_Clicked(object sender, EventArgs e)
    {
        var item = (Button)sender;

        /*item.BindingContext contains all the values [whn i did step by step debugging] as in AllProductListview..now I have to put it in a loop and calculate the total by multiplying the price and quantity and store it in OrderModel by adding the record into the Orderlist*/
        var productList = item.BindingContext as AllProductListview;
        List<OrderModel> Orderlist = new List<OrderModel>();
    }

My xaml file :

<Grid Grid.Row="3">
            <Frame HasShadow="True"
                   BackgroundColor="White"
                   Margin="1"
                   Padding="5">
                <ListView
                        x:Name="Prodlistview"
                        IsGroupingEnabled="True"
                        ItemsSource="{Binding GroupedData}"
                        GroupDisplayBinding="{Binding Key}"
                        ItemSelected="Prodlistview_ItemSelected"
                        SeparatorVisibility="Default">

                    <ListView.GroupHeaderTemplate>
                        <DataTemplate>
                            <ViewCell Height="5">
                                <StackLayout VerticalOptions="CenterAndExpand"
                                             Padding="0,0"
                                             Orientation="Horizontal"

                                            BackgroundColor="#e3e2de">

                                    <Button x:Name="viewOrderBtn"
                                            Text= "{lang:Translate DriverViewOrder}"
                                            HorizontalOptions="EndAndExpand"
                                            FontAttributes="None"
                                            CommandParameter="{Binding Key}"
                                            Clicked="viewOrderBtn_Clicked"
                                            Margin="2,5"
                                            Padding="1"
                                            FontSize="12"/>
                                </StackLayout>
                            </ViewCell>
                        </DataTemplate>

                    </ListView.GroupHeaderTemplate>

                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <local:ListViewSelectionColorRender SelectedBackgroundColor="Transparent">
                                <ViewCell.View>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="*"/>
                                            <ColumnDefinition Width="*"/>
                                        </Grid.ColumnDefinitions>

                                        <StackLayout Grid.Column="3" VerticalOptions="Center" x:Name="Container">

                                                <local:CustomStepper x:Name="stepper"
                                                                     Text="{Binding Quantity, Mode=TwoWay}"
                                                                     Padding="3,0" />
                                        </StackLayout>
                                    </Grid>
                                </ViewCell.View>
                            </local:ListViewSelectionColorRender>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </Frame>
        </Grid>

Image :
My screen

Update :
I have attached the pic of my debug window. Please walk me from here. I could bring the data from the xaml. I'm new to xamarin forms. No idea how to go from here.

private async void viewOrderBtn_Clicked(object sender, EventArgs e)
    {
        /*item.BindingContext contains all the values [whn i did step by step *debugging] as in AllProductListview..now I have to put it in a loop and *calculate the total by multiplying the price and quantity and store it in *OrderModel by adding the record into the Orderlist*/
        var item = (Button)sender;
        var itemobj = item?.BindingContext as AllProductListview;
        List<OrderModel> Orderlist = new List<OrderModel>();
        int ID = Convert.ToInt32(itemobj.PK); //showing no value assigned
        int vendorfk = Convert.ToInt32(itemobj.VendorFK); //showing no value assigned
        float price = itemobj.SalesPrice; //showing no value assigned
        int quantity = itemobj.Quantity; //showing no value assigned
        float total = price * quantity;
    }

Debug window

Body:
@chetan Thanks for the time and patience you took to help me out.

This is the final code.

 private async void viewOrderBtn_Clicked(object sender, EventArgs e)
    {
        var item = (Button)sender;
        List<OrderModel> Orderlist = new List<OrderModel>();
        bool Issame = true;
        OrderData.Clear();
        int vendorfk;
        foreach (var items in GroupedData)
        {
            foreach (var orderdet in items)
            {
                var productname = orderdet.NameE;
                float price = orderdet.SalesPrice;
                int quantity = orderdet.Quantity;
                float total = price * quantity;
                vendorfk = Convert.ToInt32(orderdet.VendorFK);
                if (quantity != 0)
                {
                    Orderlist.Add(new OrderModel
                    {
                        PK = Convert.ToInt32(orderdet.PK),
                        VendorFK = Convert.ToInt32(orderdet.VendorFK),
                        NameE = orderdet.NameE,
                        NameC = orderdet.NameC,
                        SalesPrice = orderdet.SalesPrice,
                        DChargeMode = Convert.ToInt32(orderdet.DChargeMode),
                        VatForm = orderdet.VatForm,
                        DeliveryCharge = orderdet.DeliveryCharge,
                        Quantity = quantity,
                        TotalAmount = total,
                        Delete = "delete.png"
                    });
                }
            }
        }

        int count = Orderlist.Count;
        for (int i = 0; i < count; i++)
        {
            OrderData.Add(new OrderModel
            {
                PK = Orderlist[i].PK,
                VendorFK = Orderlist[i].VendorFK,
                NameE = Orderlist[i].NameE,
                NameC = Orderlist[i].NameC,
                SalesPrice = Orderlist[i].SalesPrice,
                DChargeMode = Orderlist[i].DChargeMode,
                VatForm = Orderlist[i].VatForm,
                DeliveryCharge = Orderlist[i].DeliveryCharge,
                Quantity = Orderlist[i].Quantity,
                TotalAmount = Orderlist[i].TotalAmount,
                Delete = Orderlist[i].Delete
            });
            if (Orderlist[i].VendorFK == OrderData[0].VendorFK)
            {
                Isexecute = true;
                Issame = true;
            }
            else
            {
                Isexecute = false;
                Issame = false;
            }
        }
        if(Issame == false)
        {
            await DisplayAlert(LangResource.Alert, "You must order from the same dealer only.", LangResource.ok);
            Isexecute = false;
        }

        if (Isexecute)
        {
            UploadPopUpPage orderPage = new UploadPopUpPage(OrderData);
            orderPage.EventPass += OrderPage_EventPass;
            await PopupNavigation.PushAsync(orderPage);
        }
    }


问:
How can we copy or download files from windows share path(UNC) to linux servers in Azure Devops tool/TFS?
I am trying to copy war and ear files from windows share path(UNC) to linux target servers where jboss jvm is running and then deploy these files using our custom script. this is for applications that are still not using tfs to do their build. i tried download from file share task in azure devops but that is only copying to the agent location but not to the target server. if anyone has come across this situation and found a solution please do share your thoughts. appreciate it. thanks.</p>

答:
You need to use two tasks/steps to handle this situation.

Copy/download files from windows share path(UNC) to a folder path in build agent machine, such as $(Agent.BuildDirectory)

Copy files from a source folder to a target folder on a remote Linux server machine over SSH.

Since you have successfully download from file share task in Azure DevOps to agent machine. Then you just need to use Copy Files Over SSH task.

Use this task in a build or release pipeline to copy files from a
  source folder to a target folder on a remote machine over SSH.

This task allows you to connect to a remote machine using SSH and copy
  files matching a set of minimatch patterns from specified source
  folder to target folder on the remote machine. Supported protocols for
  file transfer are SFTP and SCP via SFTP. In addition to Linux, macOS
  is partially supported.

More detail configuration about this task please refer official link here-- Copy Files Over SSH task


问:
Date range issue
I have shifted our live server to a new server configuration Windows 2008 server and sql server 2008.

But  I am having following exception while adding date field data :

2011-05-15 18:00:44,263 ERROR Error
  caught : the details of the error are
  System.Data.SqlTypes.SqlTypeException:
  SqlDateTime overflow. Must be between
  1/1/1753 12:00:00 AM and 12/31/9999
  11:59:59 PM.  at
  System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan
  value)

But the same code is working fine on local machine and was also working fine on old server.

I have even changed the date field explicitly into "mm/dd/yy" format.
But still not found the solution.
Can anyone provide me the solution.

答:
Hey here are a few links to help you with your problem, with what I have read it seems that

the DataTime.MinValue is equivalent to 00:00:00.0000000, January 1, 0001.

so you'll have to change that if you are using it, anyways here are the links

link1

link2

link3

Hope it helped !

Title: Date range issue