问:
How to find Control in TemplateField of GridView?
How does FindControl method works if I need to find any Control which is inside GridView Template, more specifically ItemTemplate?

I have a hyperlink but it is not able to find the same.

Question updated with code

GridView Code is below:

```<code><asp:GridView ID="grvYourOpportunities" runat="server" AllowPaging="True" AutoGenerateColumns="False"
        DataKeyNames="ID#,B,H" PageSize="20" CellPadding="4" ForeColor="#333333" GridLines="Both"
        OnRowDataBound="grvYourOpt_RowDataBound">
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <Columns>
          <asp:TemplateField>
                <HeaderTemplate>
                    i
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("i") %>
                </ItemTemplate>
            </asp:TemplateField>

            <asp:TemplateField>
                <HeaderTemplate>
                    H
                </HeaderTemplate>
                <ItemTemplate>

                    <%--<a href="javascript:ShowChildGrid('div<%# Eval("ID#") %>');">
                    <img id="imgdiv<%# Eval("ID#") %>" alt="Click" border="0" src="plus.gif" runat="server" />  </a>  --%>

                    <asp:HyperLink runat="server" ID="hlPlus" ImageUrl="~/plus.gif"></asp:HyperLink>

                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    B
                </HeaderTemplate>
                <ItemTemplate>
                    <%--<%# Eval("B") %>--%>
                    <a href="javascript:ShowChildGridForBCol('div1<%# Eval("ID#") %>');">
                        <img id="imgdiv1<%# Eval("ID#") %>" alt="Click here" border="0" src="tempY.png" />
                    </a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    ID.Nr.
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("ID#")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Entry Date
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Entry Date") %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderStyle-Width="20px" ItemStyle-Width="20px">
                <HeaderTemplate>
                    BU
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("BU")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    BE
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("BE")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Product Family
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Product Family")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Project Name
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Project Name")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    SOP
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("SOP")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Award Date
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Award Date")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Milestone Next Date
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Milestone Next Date")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Contract Status
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Contract Status")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Prob.Of Success
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("ProbSuccess")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Key Account
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Key Account")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Sales SubRegion
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Sales SubRegion")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Growth
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Growth")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Sales p.a.OE mio$
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("SalesOE")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Sales p.a.AM mio$
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("SalesAM")%>
                </ItemTemplate>
            </asp:TemplateField>
            <%--GridView 2, 3--%>
            <asp:TemplateField>
                <ItemTemplate>
                    <tr>
                        <td align="left" style="margin-left: 10px;" colspan="5">
                            <div id="div<%# Eval("ID#") %>" style="display: none; position: relative; left: 110px;">
                                <asp:GridView ID="GridView2" runat="server" Width="40%" AutoGenerateColumns="false"
                                    DataKeyNames="Entry Date" EmptyDataText="No orders for this customer." CellPadding="0"
                                    ForeColor="#333333" GridLines="Both">
                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                    <HeaderStyle CssClass="header" />
                                    <RowStyle CssClass="row" />
                                    <Columns>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("ID#")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Entry Date") %>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("ID#")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField ItemStyle-Wrap="false">
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Other Text") %>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td align="left" colspan="19">
                            <div id="div1<%# Eval("ID#") %>" style="display: none; position:relative; left: 110px;">
                                <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="false" DataKeyNames="Entry Date"
                                    EmptyDataText="No orders for this customer." CellPadding="0" ForeColor="#333333"
                                    GridLines="Both" Width="100%">
                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                    <%--<HeaderStyle CssClass="header" />
                                    <RowStyle CssClass="row" />--%>
                                    <Columns>

                                        <%--<asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                            </ItemTemplate>
                                        </asp:TemplateField>--%>

                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("ID#")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                       <%-- <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Entry Date") %>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderStyle-Width="20px" ItemStyle-Width="20px">
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("BU")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("BE")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Product Family")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Project Name")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("SOP")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Award Date")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Milestone Next Date")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Contract Status")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("ProbSuccess")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Key Account")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Sales SubRegion")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Growth")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("SalesOE")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("SalesAM")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>--%>
                                    </Columns>
                                </asp:GridView>
                            </div>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
</code>```

The RowDataBound event of the parent GridView is as below;

```<code>Protected void grvYourOpt_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        string colId = grvYourOpportunities.DataKeys[e.Row.RowIndex].Values[0].ToString();
        string colB = grvYourOpportunities.DataKeys[e.Row.RowIndex].Values[1].ToString();
        string colH = grvYourOpportunities.DataKeys[e.Row.RowIndex].Values[2].ToString();

        #region "Commented Code for Col.B"

        //if (colB == "Y")
        //{
        //    e.Row.Cells[2].Text = "<img src='tempY.png'>";

        //}
        //else
        //{
        //    e.Row.Cells[2].Text = "<img src='tempN.png'>";
        //}
        #endregion

        #region "Commented code for Col.H"

        if (colH == "1")
        {
            e.Row.Cells[1].Text = string.Empty;
            //e.Row.Cells[1].Text = "<a href=''> <img id='13' alt='Click' border='0' src='plus.gif'/> </a>";
            string js = string.Format("javascript:ShowChildGrid('div{0}');", colId);
            HyperLink lnk = (HyperLink)e.Row.FindControl("hlPlus");
            if (lnk!=null)
            {
                lnk.NavigateUrl = js;
                lnk.ImageUrl = "plus.gif";
                lnk.Visible = true;
            }
            //Page.ClientScript.RegisterStartupScript(this.GetType(), "HCol", "ShowChildGrid("+ colId + ");", true);
        }
        else
        {
            e.Row.Cells[1].Text = string.Empty;
            e.Row.Cells[1].Text = "";
        }
        #endregion

        DataTable dt1 = new DataTable();
        DataTable dt2 = new DataTable();

        DataRow dr1 = null;
        DataRow dr2 = null;
        DataRow dr3 = null;
        DataRow dr4 = null;
        DataRow dr5 = null;
        DataRow dr7 = null;

        DataRow r = dt1.NewRow();

        DataSet ds1 = new DataSet();
        DataSet ds2 = new DataSet();

        dt1.TableName = "Opportunity1";

        dt1.Columns.Add(new System.Data.DataColumn("ID#", typeof(System.String)));
        dt1.Columns.Add(new System.Data.DataColumn("Entry Date", typeof(System.String)));
        dt1.Columns.Add(new System.Data.DataColumn("Other Text", typeof(System.String)));
        ds1.Tables.Add(dt1);

        dt2.Columns.Add(new System.Data.DataColumn("ID#", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Entry Date", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("BU", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("BE", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Product Family", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Project Name", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("SOP", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Award Date", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Milestone Next Date", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Contract Status", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("ProbSuccess", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Key Account", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Sales SubRegion", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Growth", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("SalesOE", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("SalesAM", typeof(System.String)));
        ds2.Tables.Add(dt2);

        dr2 = dt1.NewRow();
        dr3 = dt1.NewRow();
        dr4 = dt1.NewRow();
        dr5 = dt1.NewRow();

        dr1["ID#"] = "";
        dr2["ID#"] = "";
        dr3["ID#"] = "";
        dr4["ID#"] = "";
        dr5["ID#"] = "";

        dr1["Entry Date"] = "18/01/2010";
        dr2["Entry Date"] = "19/01/2010";
        dr3["Entry Date"] = "20/01/2010";
        dr4["Entry Date"] = "21/01/2010";
        dr5["Entry Date"] = "14/01/2010";

        dr1["Other Text"] = "17:25CET changed by"; // - product family: ABS, Milestone Date: 23.02.1022, Contract Status: Signed, Probability of success: 100%";
        dr2["Other Text"] = "18:44CET changed by"; //- product family: ABS, Milestone Date: 23.02.1022, Contract Status: Signed, Probability of success: 100%";
        dr3["Other Text"] = "19:25CET changed by"; //- product family: ABS, Milestone Date: 23.02.1022, Contract Status: Signed, Probability of success: 100%";
        dr4["Other Text"] = "14:25CET changed by"; //- product family: ABS, Milestone Date: 23.02.1022, Contract Status: Signed, Probability of success: 100%";
        dr5["Other Text"] = "11:25CET changed by"; //- product family: ABS, Milestone Date: 23.02.1022, Contract Status: Signed, Probability of success: 100%";

        dt1.Rows.Add(dr1);
        dt1.Rows.Add(dr2);
        dt1.Rows.Add(dr3);
        dt1.Rows.Add(dr4);
        dt1.Rows.Add(dr5);

        GridView gv12 = (GridView)e.Row.FindControl("GridView2");
        gv12.DataSource = ds1.Tables[0];
        gv12.DataBind();

        for (int i = 0; i < gv12.Rows.Count; i++)
        {
            gv12.RowStyle.BackColor = System.Drawing.Color.Gray;
        }

        dr7 = dt2.NewRow();

        dr7["ID#"] = "11-0101";
        dr7["Entry Date"] = "19/01/2010";
        dr7["BU"] = "VDC";
        dr7["BE"] = "ASES";
        dr7["Product Family"] = "Car Air Systems";
        dr7["Project Name"] = "Example";
        dr7["SOP"] = "09/08/2011";
        dr7["Award Date"] = "10/2011";
        dr7["Milestone Next Date"] = System.DateTime.Today.ToString("dd.MM.yyyy");
        dr7["Contract Status"] = "won";
        dr7["ProbSuccess"] = "70%";
        dr7["Key Account"] = "E-Paccar";
        dr7["Sales SubRegion"] = "North America";
        dr7["Growth"] = "10%";
        dr7["SalesOE"] = "150";
        dr7["SalesAM"] = "18";

        dt2.Rows.Add(dr7);

        GridView gv13 = (GridView)e.Row.FindControl("GridView3");
        gv13.DataSource = ds2.Tables[0];
        gv13.DataBind();
    }
}
</code>```

The hyperlink hlPlus is a hyperlink field inside GridView's Template Field(Item Template).

答:
```<code>protected void gvTurnos_RowDataBound(object sender, GridViewRowEventArgs e)
{
    try
    {

        if (e.Row.RowType == DataControlRowType.EmptyDataRow)
        {
            LinkButton btn = (LinkButton)e.Row.FindControl("btnAgregarVacio");
            if (btn != null)
            {
                btn.Visible = rbFiltroEstatusCampus.SelectedValue == "1" ? true : false;
            }
        }
    }
    catch (Exception ex)
    {
        throw ex;
    }
}
</code>```

Body:
How does FindControl method works if I need to find any Control which is inside GridView Template, more specifically ItemTemplate?

I have a hyperlink but it is not able to find the same.

Question updated with code

GridView Code is below:

<asp:GridView ID="grvYourOpportunities" runat="server" AllowPaging="True" AutoGenerateColumns="False"
        DataKeyNames="ID#,B,H" PageSize="20" CellPadding="4" ForeColor="#333333" GridLines="Both"
        OnRowDataBound="grvYourOpt_RowDataBound">
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <Columns>
          <asp:TemplateField>
                <HeaderTemplate>
                    i
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("i") %>
                </ItemTemplate>
            </asp:TemplateField>

            <asp:TemplateField>
                <HeaderTemplate>
                    H
                </HeaderTemplate>
                <ItemTemplate>

                    <%--<a href="javascript:ShowChildGrid('div<%# Eval("ID#") %>');">
                    <img id="imgdiv<%# Eval("ID#") %>" alt="Click" border="0" src="plus.gif" runat="server" />    --%>

                    <asp:HyperLink runat="server" ID="hlPlus" ImageUrl="~/plus.gif"></asp:HyperLink>

                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    B
                </HeaderTemplate>
                <ItemTemplate>
                    <%--<%# Eval("B") %>--%>
                    <a href="javascript:ShowChildGridForBCol('div1<%# Eval("ID#") %>');">
                        <img id="imgdiv1<%# Eval("ID#") %>" alt="Click here" border="0" src="tempY.png" />

                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    ID.Nr.
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("ID#")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Entry Date
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Entry Date") %>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderStyle-Width="20px" ItemStyle-Width="20px">
                <HeaderTemplate>
                    BU
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("BU")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    BE
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("BE")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Product Family
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Product Family")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Project Name
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Project Name")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    SOP
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("SOP")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Award Date
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Award Date")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Milestone Next Date
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Milestone Next Date")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Contract Status
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Contract Status")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Prob.Of Success
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("ProbSuccess")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Key Account
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Key Account")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Sales SubRegion
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Sales SubRegion")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Growth
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("Growth")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Sales p.a.OE mio$
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("SalesOE")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Sales p.a.AM mio$
                </HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("SalesAM")%>
                </ItemTemplate>
            </asp:TemplateField>
            <%--GridView 2, 3--%>
            <asp:TemplateField>
                <ItemTemplate>

                            <div id="div<%# Eval("ID#") %>" style="display: none; position: relative; left: 110px;">
                                <asp:GridView ID="GridView2" runat="server" Width="40%" AutoGenerateColumns="false"
                                    DataKeyNames="Entry Date" EmptyDataText="No orders for this customer." CellPadding="0"
                                    ForeColor="#333333" GridLines="Both">
                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                    <HeaderStyle CssClass="header" />
                                    <RowStyle CssClass="row" />
                                    <Columns>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("ID#")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Entry Date") %>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("ID#")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField ItemStyle-Wrap="false">
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Other Text") %>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>

                            <div id="div1<%# Eval("ID#") %>" style="display: none; position:relative; left: 110px;">
                                <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="false" DataKeyNames="Entry Date"
                                    EmptyDataText="No orders for this customer." CellPadding="0" ForeColor="#333333"
                                    GridLines="Both" Width="100%">
                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                    <%--<HeaderStyle CssClass="header" />
                                    <RowStyle CssClass="row" />--%>
                                    <Columns>

                                        <%--<asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                            </ItemTemplate>
                                        </asp:TemplateField>--%>

                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("ID#")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                       <%-- <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Entry Date") %>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderStyle-Width="20px" ItemStyle-Width="20px">
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("BU")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("BE")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Product Family")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Project Name")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("SOP")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Award Date")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Milestone Next Date")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Contract Status")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("ProbSuccess")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Key Account")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Sales SubRegion")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("Growth")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("SalesOE")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField>
                                            <HeaderTemplate>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <%# Eval("SalesAM")%>
                                            </ItemTemplate>
                                        </asp:TemplateField>--%>
                                    </Columns>
                                </asp:GridView>

                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>

The RowDataBound event of the parent GridView is as below;

Protected void grvYourOpt_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        string colId = grvYourOpportunities.DataKeys[e.Row.RowIndex].Values[0].ToString();
        string colB = grvYourOpportunities.DataKeys[e.Row.RowIndex].Values[1].ToString();
        string colH = grvYourOpportunities.DataKeys[e.Row.RowIndex].Values[2].ToString();

        #region "Commented Code for Col.B"

        //if (colB == "Y")
        //{
        //    e.Row.Cells[2].Text = "";

        //}
        //else
        //{
        //    e.Row.Cells[2].Text = "";
        //}
        #endregion

        #region "Commented code for Col.H"

        if (colH == "1")
        {
            e.Row.Cells[1].Text = string.Empty;
            //e.Row.Cells[1].Text = "  ";
            string js = string.Format("javascript:ShowChildGrid('div{0}');", colId);
            HyperLink lnk = (HyperLink)e.Row.FindControl("hlPlus");
            if (lnk!=null)
            {
                lnk.NavigateUrl = js;
                lnk.ImageUrl = "plus.gif";
                lnk.Visible = true;
            }
            //Page.ClientScript.RegisterStartupScript(this.GetType(), "HCol", "ShowChildGrid("+ colId + ");", true);
        }
        else
        {
            e.Row.Cells[1].Text = string.Empty;
            e.Row.Cells[1].Text = "";
        }
        #endregion

        DataTable dt1 = new DataTable();
        DataTable dt2 = new DataTable();

        DataRow dr1 = null;
        DataRow dr2 = null;
        DataRow dr3 = null;
        DataRow dr4 = null;
        DataRow dr5 = null;
        DataRow dr7 = null;

        DataRow r = dt1.NewRow();

        DataSet ds1 = new DataSet();
        DataSet ds2 = new DataSet();

        dt1.TableName = "Opportunity1";

        dt1.Columns.Add(new System.Data.DataColumn("ID#", typeof(System.String)));
        dt1.Columns.Add(new System.Data.DataColumn("Entry Date", typeof(System.String)));
        dt1.Columns.Add(new System.Data.DataColumn("Other Text", typeof(System.String)));
        ds1.Tables.Add(dt1);

        dt2.Columns.Add(new System.Data.DataColumn("ID#", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Entry Date", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("BU", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("BE", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Product Family", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Project Name", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("SOP", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Award Date", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Milestone Next Date", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Contract Status", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("ProbSuccess", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Key Account", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Sales SubRegion", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("Growth", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("SalesOE", typeof(System.String)));
        dt2.Columns.Add(new System.Data.DataColumn("SalesAM", typeof(System.String)));
        ds2.Tables.Add(dt2);

        dr2 = dt1.NewRow();
        dr3 = dt1.NewRow();
        dr4 = dt1.NewRow();
        dr5 = dt1.NewRow();

        dr1["ID#"] = "";
        dr2["ID#"] = "";
        dr3["ID#"] = "";
        dr4["ID#"] = "";
        dr5["ID#"] = "";

        dr1["Entry Date"] = "18/01/2010";
        dr2["Entry Date"] = "19/01/2010";
        dr3["Entry Date"] = "20/01/2010";
        dr4["Entry Date"] = "21/01/2010";
        dr5["Entry Date"] = "14/01/2010";

        dr1["Other Text"] = "17:25CET changed by"; // - product family: ABS, Milestone Date: 23.02.1022, Contract Status: Signed, Probability of success: 100%";
        dr2["Other Text"] = "18:44CET changed by"; //- product family: ABS, Milestone Date: 23.02.1022, Contract Status: Signed, Probability of success: 100%";
        dr3["Other Text"] = "19:25CET changed by"; //- product family: ABS, Milestone Date: 23.02.1022, Contract Status: Signed, Probability of success: 100%";
        dr4["Other Text"] = "14:25CET changed by"; //- product family: ABS, Milestone Date: 23.02.1022, Contract Status: Signed, Probability of success: 100%";
        dr5["Other Text"] = "11:25CET changed by"; //- product family: ABS, Milestone Date: 23.02.1022, Contract Status: Signed, Probability of success: 100%";

        dt1.Rows.Add(dr1);
        dt1.Rows.Add(dr2);
        dt1.Rows.Add(dr3);
        dt1.Rows.Add(dr4);
        dt1.Rows.Add(dr5);

        GridView gv12 = (GridView)e.Row.FindControl("GridView2");
        gv12.DataSource = ds1.Tables[0];
        gv12.DataBind();

        for (int i = 0; i < gv12.Rows.Count; i++)
        {
            gv12.RowStyle.BackColor = System.Drawing.Color.Gray;
        }

        dr7 = dt2.NewRow();

        dr7["ID#"] = "11-0101";
        dr7["Entry Date"] = "19/01/2010";
        dr7["BU"] = "VDC";
        dr7["BE"] = "ASES";
        dr7["Product Family"] = "Car Air Systems";
        dr7["Project Name"] = "Example";
        dr7["SOP"] = "09/08/2011";
        dr7["Award Date"] = "10/2011";
        dr7["Milestone Next Date"] = System.DateTime.Today.ToString("dd.MM.yyyy");
        dr7["Contract Status"] = "won";
        dr7["ProbSuccess"] = "70%";
        dr7["Key Account"] = "E-Paccar";
        dr7["Sales SubRegion"] = "North America";
        dr7["Growth"] = "10%";
        dr7["SalesOE"] = "150";
        dr7["SalesAM"] = "18";

        dt2.Rows.Add(dr7);

        GridView gv13 = (GridView)e.Row.FindControl("GridView3");
        gv13.DataSource = ds2.Tables[0];
        gv13.DataBind();
    }
}

The hyperlink hlPlus is a hyperlink field inside GridView's Template Field(Item Template).


来源: stackexchange

问:
What does it mean for Redis to be an "in memory" database?
Wikipedia says that Redis is an in-memory database, but it also says that it can persist "data to the disk at least every 2 seconds".  I feel like these two things are mutually exclusive.  How can it be considered in-memory yet (it can) store data on disk?  I assumed the definition of in-memory meant that it does not store to disk.

This is a similar question: Redis concept: In memory or DB?  The difference is that he's asking about the persistence implementation.  My question is about the concept of in-memory vs persistence.

答: Redis is an In-Memory Database(IMDB) as it relies on main memory of computer for data storage while others use Disk Storage database mechanism. That is why Redis is faster than disk-optimized databases because disk access is slower than memory access.</p>

ContentLicense: CC BY-SA 3.0


问:
Replacement for source in sh
I need to set the environment variables,  usually we do this by

```<code>source script.sh
</code>```

But now, I am automating it during the boot process and it looks like the root boots by default with sh shell.  How do I source this script in sh?

答:
The dot command '.' is the equivalent of the C Shell (and Bash) source command.  It is specified by POSIX (see dot), and supported by the Bourne and Korn shells (and zsh, I believe).

```<code>. somefile
</code>```

Note that the shell looks for the file using $PATH, but the file only has to be readable, not executable.

As noted in the comments below, you can of course specify a relative or absolute pathname for the file — any name containing a slash will not be searched for using $PATH.  So:

```<code>. /some/where/somefile
. some/where/somefile
. ./somefile
</code>```

could all be used to find somefile if it existed in the three different specified locations (if you could replace . with ls -l and see a file listed).

Pedants of the world unite!  Yes, if the current directory is the root directory, then /some/where/somefile and ./some/where/somefile would refer to the same file — with the same real path — even without links, symbolic or hard, playing a role (and so would ../../some/where/somefile).

Title: Replacement for source in sh

Body:
I need to set the environment variables,  usually we do this by

source script.sh

But now, I am automating it during the boot process and it looks like the root boots by default with sh shell.  How do I source this script in sh?

Body:
The dot command '.' is the equivalent of the C Shell (and Bash) source command.  It is specified by POSIX (see dot), and supported by the Bourne and Korn shells (and zsh, I believe).

. somefile

Note that the shell looks for the file using $PATH, but the file only has to be readable, not executable.

As noted in the comments below, you can of course specify a relative or absolute pathname for the file — any name containing a slash will not be searched for using $PATH.  So:

. /some/where/somefile
. some/where/somefile
. ./somefile

could all be used to find somefile if it existed in the three different specified locations (if you could replace . with ls -l and see a file listed).

Pedants of the world unite!  Yes, if the current directory is the root directory, then /some/where/somefile and ./some/where/somefile would refer to the same file — with the same real path — even without links, symbolic or hard, playing a role (and so would ../../some/where/somefile).


问:
Need help in editing a tab in Woocommerce product page
I am trying to change the name of a tab in product page of woocommerce to a different name.

I am trying to find which PHP file has that particular code but I am unable to do that. Have also used plugins like WhatTheFile (it said the product page is loaded from single-product.php, but I couldn't find the html to edit there) and String Locator and they couldn't help even. Please have a look at this video I made and you will better understand my problem.

https://www.dropbox.com/s/bruhb2n83lhfnp6/Code.mp4?dl=0

I am using G5Plus April theme

Thank you

答:
you can add code like this in functions.php of your theme to customize the product description tab title. For more details, Link 1, Link 2

```<code>add_filter( 'woocommerce_product_tabs', 'woo_customize_tabs', 100, 1 );
function woo_customize_tabs( $tabs ) {
   $tabs['description']['title'] = __( 'More Information' ); // Rename the description tab

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

Hope this will helps you.

Body:
you can add code like this in functions.php of your theme to customize the product description tab title. For more details, Link 1, Link 2

add_filter( 'woocommerce_product_tabs', 'woo_customize_tabs', 100, 1 );
function woo_customize_tabs( $tabs ) {
   $tabs['description']['title'] = __( 'More Information' ); // Rename the description tab

   return $tabs;
}

Hope this will helps you.


问:
Recently Deployed My App - Some Users Cannot Run Now From Older Devices (64 bit issue)
I recently put out a large update for my app and now my old iPhone 5 users cannot run it. I wanted to get some information to see if there was anything I can do, or if they just have to upgrade their phones.

My understanding is that a few years ago, Apple started to make those pop-ups for people who were running 32-bit applications telling them that their device may be slowed down running this app until the developer updates.

So I took this as an opportunity to make sure my app was 64 bit. I'm not entirely sure what I did (I don't frankly remember it's been a while) but now my older users are out of luck it would appear.

Is there a way to make my app run both 32 bit and 64 bit, or is this a bad idea / I do not want to do that?

Curious what options I have on the table.

Thanks!

答:
Your app should include 32 bit symbols in addition to 64 bit symbols. You might have removed 32 bit symbols from your app. That causes your app to crash on 32 bit devices.

To do that, set your Architecture in your target's build settings to $(ARCHS_STANDARD). ARCHS_STANDARD includes both arm64 and armv7 architectures.


问:
How to automatically set checkbox to true when dropdownlist on change?
I have multiple group which each of them consist of a checkbox and a dropdownlist which group together, when the dropdown list for the particular group is changed then the checkbox also will automatically set to checked.

```<code><div class="form-group">
        <div class="input-group col-md-12">
          <span class="input-group-addon">
            <input type="checkbox" name="filter[]" value="1">
          </span>
            <select class="dateselectpicker form-control"id="filter"title="Filter">
                <option>a</option>
                <option>b</option>
            </select>
        </div>
    </div>

<div class="form-group">
            <div class="input-group col-md-12">
              <span class="input-group-addon">
                <input type="checkbox" name="filter[]" value="2">
              </span>
                <select class="dateselectpicker form-control"id="filter1"title="Filter">
                    <option>a</option>
                    <option>b</option>
                </select>
            </div>
        </div>
</code>```

For example, when i select the first filter, then the checkbox for first filter will set to checked. Only when dropdown list on change. How can i do this?

Updated: It is not working when selectpicker is applied.

答:
You can simply do it using change event listener in jquery like this

$( "select" ).change(function() {
 $(this).prev(".input-group-addon").find(":checkbox").prop("checked",true);
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">

<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>

<body>
  <div class="form-group">
    <div class="input-group col-md-12">
      <span class="input-group-addon">
            <input type="checkbox" name="filter[]" value="1">
          </span>
      <select class="dateselectpicker form-control" id="filter" title="Filter">
                <option>a</option>
                <option>b</option>
            </select>
    </div>
  </div>

  <div class="form-group">
    <div class="input-group col-md-12">
      <span class="input-group-addon">
                <input type="checkbox" name="filter[]" value="2">
              </span>
      <select class="dateselectpicker form-control" id="filter1" title="Filter">
                    <option>a</option>
                    <option>b</option>
                </select>
    </div>
  </div>

</body>

</html></code>```

Body:
I have multiple group which each of them consist of a checkbox and a dropdownlist which group together, when the dropdown list for the particular group is changed then the checkbox also will automatically set to checked.

            <input type="checkbox" name="filter[]" value="1">

            <select class="dateselectpicker form-control"id="filter"title="Filter">
                <option>a</option>
                <option>b</option>
            </select>

                <input type="checkbox" name="filter[]" value="2">

                <select class="dateselectpicker form-control"id="filter1"title="Filter">
                    <option>a</option>
                    <option>b</option>
                </select>

For example, when i select the first filter, then the checkbox for first filter will set to checked. Only when dropdown list on change. How can i do this?

Updated: It is not working when selectpicker is applied.

Body:
You can simply do it using change event listener in jquery like this

$( "select" ).change(function() {
 $(this).prev(".input-group-addon").find(":checkbox").prop("checked",true);
});

<!DOCTYPE html>
<html lang="en">

<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>

<body>
  <div class="form-group">
    <div class="input-group col-md-12">
      <span class="input-group-addon">
            <input type="checkbox" name="filter[]" value="1">
          </span>
      <select class="dateselectpicker form-control" id="filter" title="Filter">
                <option>a</option>
                <option>b</option>
            </select>
    </div>
  </div>

  <div class="form-group">
    <div class="input-group col-md-12">
      <span class="input-group-addon">
                <input type="checkbox" name="filter[]" value="2">
              </span>
      <select class="dateselectpicker form-control" id="filter1" title="Filter">
                    <option>a</option>
                    <option>b</option>
                </select>
    </div>
  </div>

</body>

</html>


问:
Project Euler 1:Find the sum of all the multiples of 3 or 5 below 1000, works for 10 numbers but doesn't work for 1000

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.

So I decided to try and solve some problems on Euler site to improve with programming. While trying to solve the first problem I wrote a quick code to count the sum and it worked for 10 numbers, but for 1000 it shows me the answer: 166833 which is wrong and I can't really find an issue here. If someone could give me a hint to improve my algorythm so it would work.

```<code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Multiplies_of_3_and_5
{
  class Program
  {
    static void Main(string[] args)
    {
        int[] array = new int[7000];

        for (int j = 0; j<array.Length ;j++)
        {
            array[j] = j + 1;
        }

        int n = 1;
        int z = 1;
        int numbers = 0;

        for (int i = 0; i<999; i++)
        {
            if (array[i] == 3 * n )
            {
                n++;
                numbers += array[i];
            }

            else if (array[i] == 5 * z)
            {
                z++;
                numbers += array[i];
            }
        }
        Console.WriteLine(string.Join(" ", numbers));
        Console.ReadLine();
      }
   }
}
</code>```

答:
Idea count 3s, 5s and deduct 15s as they are in both but only need counting once.

```<code>int maxNum = 999;
int num3s = maxNum/3; // rounded down 333
int num5s = maxNum/5; // rounded down 199

int num15s = maxNum/15; // rounded down 66
</code>```

Knowing how many still isn't going to tell us the sum. Pythagoras to the rescue.

```<code>sum3s = 3+6+9+12+15 (=45)
sum5s = 5+10+15     (=30)
sum15s = 15         (=15)
</code>```

average = (max+min)/2

Either there is an odd number of 3's, 5's or 15's and you get an even average. Or there is an even number in which case /2 and the even cancel each other.

So we get

```<code>sumXs = (min+max)*numXs
</code>```

In the above case we get

```<code>sum3s = (3+15)/2*5 = 45
sum5s = (5+15)/2*3 = 30
sum15s = (15+15)/2*1 = 15

int sum = sum3s+sum5s-sum15s = 60;
</code>```

Another example 11

```<code>sum = (3+9)/2*3 + (5+10)/2*2 - 0 = 33
</code>```

And finally sum of 3s and 5s up to 999

```<code>sum = (3+999)/2*333 + (5+995)/2*199 - (15+990)/2*66
    = 501*333 + 500*199 - (1005)*66/2
    = 501*333 + 500*199 - 1005*33
    =  166833 +   99500 -   33165
    =  233168
</code>```

Which is also the result of the programs.

Body:
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000.

So I decided to try and solve some problems on Euler site to improve with programming. While trying to solve the first problem I wrote a quick code to count the sum and it worked for 10 numbers, but for 1000 it shows me the answer: 166833 which is wrong and I can't really find an issue here. If someone could give me a hint to improve my algorythm so it would work.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Multiplies_of_3_and_5
{
  class Program
  {
    static void Main(string[] args)
    {
        int[] array = new int[7000];

        for (int j = 0; j<array.Length ;j++)
        {
            array[j] = j + 1;
        }

        int n = 1;
        int z = 1;
        int numbers = 0;

        for (int i = 0; i<999; i++)
        {
            if (array[i] == 3 * n )
            {
                n++;
                numbers += array[i];
            }

            else if (array[i] == 5 * z)
            {
                z++;
                numbers += array[i];
            }
        }
        Console.WriteLine(string.Join(" ", numbers));
        Console.ReadLine();
      }
   }
}

Body:
Idea count 3s, 5s and deduct 15s as they are in both but only need counting once.

int maxNum = 999;
int num3s = maxNum/3; // rounded down 333
int num5s = maxNum/5; // rounded down 199

int num15s = maxNum/15; // rounded down 66

Knowing how many still isn't going to tell us the sum. Pythagoras to the rescue.

sum3s = 3+6+9+12+15 (=45)
sum5s = 5+10+15     (=30)
sum15s = 15         (=15)

average = (max+min)/2

Either there is an odd number of 3's, 5's or 15's and you get an even average. Or there is an even number in which case /2 and the even cancel each other.

So we get

sumXs = (min+max)*numXs

In the above case we get

sum3s = (3+15)/2*5 = 45
sum5s = (5+15)/2*3 = 30
sum15s = (15+15)/2*1 = 15

int sum = sum3s+sum5s-sum15s = 60;

Another example 11

sum = (3+9)/2*3 + (5+10)/2*2 - 0 = 33

And finally sum of 3s and 5s up to 999

sum = (3+999)/2*333 + (5+995)/2*199 - (15+990)/2*66
    = 501*333 + 500*199 - (1005)*66/2
    = 501*333 + 500*199 - 1005*33
    =  166833 +   99500 -   33165
    =  233168

Which is also the result of the programs.


问:
sqoop incremental import to hive table
I am trying to do a sqoop incremental import (lastmodified) to a hive table . It is working in sqoop 1.4.5 but not in sqoop 1.4.6 .

It is throwing the following error

**Log Upload Time: Mon Nov 13 17:57:58 +0530 2017

```<code>        Log Length: 246
      --incremental lastmodified option for hive imports is not supported. Please remove the parameter --incremental lastmodified.
</code>```

Intercepting System.exit(1)
Failing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.SqoopMain], exit code [1]**

答:
Sqoop 1.4.6 doesn't support incremental import to a hive table directly.

However you can import the incremental data without using the --hive-import option and place the incremental data in the HDFS location which is mapped to the hive table using the --target-dir option.

For example

Consider there's a table sqoop_pract with location set to /user/hive/warehouse/sqoop_pract

If you want to perform incremental import for this table you can use a query similar to the following

```<code>sqoop import --connect jdbc:mysql://hostname/sample_db --username demo --table sqoop_pract --target-dir /user/hive/warehouse/sqoop_pract --incremental lastmodified --check-column Ts --last-value '2017-11-08 03:51:42' --append -P
</code>```

In the above command the --target-dir points to the hive table's location, this way you can achieve incremental import to a hive table using sqoop.

Title: sqoop incremental import to hive table

Body:
I am trying to do a sqoop incremental import (lastmodified) to a hive table . It is working in sqoop 1.4.5 but not in sqoop 1.4.6 .

It is throwing the following error

**Log Upload Time: Mon Nov 13 17:57:58 +0530 2017

        Log Length: 246
      --incremental lastmodified option for hive imports is not supported. Please remove the parameter --incremental lastmodified.

Intercepting System.exit(1)
Failing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.SqoopMain], exit code [1]**

Body:
Sqoop 1.4.6 doesn't support incremental import to a hive table directly.

However you can import the incremental data without using the --hive-import option and place the incremental data in the HDFS location which is mapped to the hive table using the --target-dir option.

For example

Consider there's a table sqoop_pract with location set to /user/hive/warehouse/sqoop_pract

If you want to perform incremental import for this table you can use a query similar to the following

sqoop import --connect jdbc:mysql://hostname/sample_db --username demo --table sqoop_pract --target-dir /user/hive/warehouse/sqoop_pract --incremental lastmodified --check-column Ts --last-value '2017-11-08 03:51:42' --append -P

In the above command the --target-dir points to the hive table's location, this way you can achieve incremental import to a hive table using sqoop.


问:
OCMOD Implementation OpenCart 2.0
Have anybody have implemented OCMOD for plugin development in opencart 2.0 ?
Do we need to install VQMOD to execute OCMOD?

I found https://github.com/opencart/opencart/wiki/Modification-System but still
unable to get clear idea.

Any help would be really appreciated.
Thanks

答:
Have anybody have implemented OCMOD for plugin development in opencart 2.0 ?

Ans: Yes

Do we need to install VQMOD to execute OCMOD?

Ans: No

OCMOD Folder structure like this for Opencart

```<code>-upload -admin...(if you have required)
        -catalog..(if you have required)
        - - - -
- install.xml
</code>```

Zip these and named like this .ocmod.zip

Then You can able to install with Opencart Installer

Title: OCMOD Implementation OpenCart 2.0

Body:
Have anybody have implemented OCMOD for plugin development in opencart 2.0 ?

Ans: Yes

Do we need to install VQMOD to execute OCMOD?

Ans: No

OCMOD Folder structure like this for Opencart

-upload -admin...(if you have required)
        -catalog..(if you have required)
        - - - -
- install.xml

Zip these and named like this .ocmod.zip

Then You can able to install with Opencart Installer


问:
how to get selectedvalue from DataGridViewComboBoxColumn?
i have a datagridview which has a DataGridViewComboBoxColumn for unit i want to get the selectedvalue of each DataGridViewComboBoxColumn how could i get this?</p>

答:
You can use this -</p>

```<code>dataGridView1.Rows["YourRowNumber"].Cells["YourColumnNameOrNumber"].Value;
</code>```

ContentLicense: CC BY-SA 2.5

Body:
You can use this -

dataGridView1.Rows["YourRowNumber"].Cells["YourColumnNameOrNumber"].Value;


问:
Infinispan : change dynamically jgroups multicast port
We recently deployed an app using infinispan (first time)
This app runs in 3 environments (test (2 nodes), pilote (2 nodes) and production (4 nodes)).

My issue is that each node sees the 7 others. It's normal because the jgroups UDP config file is the same for everyone so they all talk using the same port.

I would like to set by code a specific port for each environment to avoid maintaining a specific config

Our config file is stored in our custom stack, (shared with all of our projects and I don't want the stack to depend on the projects environments definition)

I found the "Protocol" class but I have difficulties to get the link with the infinispan manager

Do you have any solution ?

答:
You could use a variable for the mcast port, e.g. <UDP mcast_port="${my.mcast.port:15000}". Setting system property my.mcast.port would override the default of 15000.

You can get the UDP protocol and change the port programmatically in JGroups, but in Infinispan, this doesn't make any sense as - by the time the cache has been created - JGroups has already been started and the port cannot be changed after the JChannel has been connected.


问:
uwsgi produce a lot of strange process,just like defunct process
I have a web project,use nginx ,uwsgi ,web.py ,nginx is used for load balancing,uwsgi is used as a web server,web.py is a web frameworks

I start it with this commond "/usr/local/bin/uwsgi -d /home/sheng/www/lr-server/../log/lr-server/uwsgi.log -s 127.0.0.1:8666 -w rc_main -t 20 -M -p 20 --pidfile /home/sheng/www/lr-server/master.pid --enable-threads -R 800"

this commond means it will produce twenty process to receive request, and each process receive 800 requests as most

as show below is normal process

```<code>sheng     12414 15051 21 10:04 ?        00:01:45 /usr/local/bin/uwsgi -d /home/sheng/www/lr-server/../log/lr-server/uwsgi.log -s 127.0.0.1:8666 -w rc_main -t 20 -M -p 20 --pidfile /home/sheng/www/lr-server/master.pid --enable-threads -R 800
</code>```

15051 is parent pid

usually it works normal ,but it will produce strange process when server is very busy and many requests take a long time, as shown below is strange process:

```<code>sheng     23370     1  0 09:08 ?        00:00:00 /usr/local/bin/uwsgi -d /home/sheng/www/lr-server/../log/lr-server/uwsgi.log -s 127.0.0.1:8666 -w rc_main -t 20 -M -p 20 --pidfile /home/sheng/www/lr-server/master.pid --enable-threads -R 800
</code>```

you will notice,this process's pid is 23370,but it's parent pid is 1,it like a defunct process.However, in fact，this process take up memory and will not receive any request

I had hoped to produce 20 normal process to receive request,but now ,it process more then 80 starnge process,who can tell me why and what can I do to solve this problem

答:
I have found out the reason

In my python project , sometimes python will use R to make a scientific calculation

R is slow ,so a colleague of mine use parallel technology,R will fork some child process to calculate

Unfortunately，if a request take more than 20 seconds ,uwsgi will kill the python process,but due to unknown reasons, those child process which R forked will not be killed ,they are just strange process what I see

Body:
I have a web project,use nginx ,uwsgi ,web.py ,nginx is used for load balancing,uwsgi is used as a web server,web.py is a web frameworks

I start it with this commond "/usr/local/bin/uwsgi -d /home/sheng/www/lr-server/../log/lr-server/uwsgi.log -s 127.0.0.1:8666 -w rc_main -t 20 -M -p 20 --pidfile /home/sheng/www/lr-server/master.pid --enable-threads -R 800"

this commond means it will produce twenty process to receive request, and each process receive 800 requests as most

as show below is normal process

sheng     12414 15051 21 10:04 ?        00:01:45 /usr/local/bin/uwsgi -d /home/sheng/www/lr-server/../log/lr-server/uwsgi.log -s 127.0.0.1:8666 -w rc_main -t 20 -M -p 20 --pidfile /home/sheng/www/lr-server/master.pid --enable-threads -R 800

15051 is parent pid

usually it works normal ,but it will produce strange process when server is very busy and many requests take a long time, as shown below is strange process:

sheng     23370     1  0 09:08 ?        00:00:00 /usr/local/bin/uwsgi -d /home/sheng/www/lr-server/../log/lr-server/uwsgi.log -s 127.0.0.1:8666 -w rc_main -t 20 -M -p 20 --pidfile /home/sheng/www/lr-server/master.pid --enable-threads -R 800

you will notice,this process's pid is 23370,but it's parent pid is 1,it like a defunct process.However, in fact，this process take up memory and will not receive any request

I had hoped to produce 20 normal process to receive request,but now ,it process more then 80 starnge process,who can tell me why and what can I do to solve this problem


问:
Issue in copying rows based on certain conditions in Vba
```<code>Set ws4 = Workbooks("A.xlsx").Worksheets(1)
Lastrowto = ws4.Cells(Rows.Count, "B").End(xlUp).Row

For y = Lastrowto To 1 Step -1
    If ws4.Cells(y, "B").Value = "Not found" Then
        ws4.Rows(y).EntireRow.Copy
    End If
Next y
</code>```

The above piece of vba code copies only 1 (the first one) row but I want to copy all those rows for which the given condition is met, kindly suggest me the correct version of code.

答:
You are copying but there is no paste line.

An example, with a paste line destination of ws1.Cells(counter,"B"), assuming another worksheet variable ws1 might be:

```<code> ws4.Rows(y).EntireRow.Copy ws1.Cells(counter,"B")
</code>```

See the following where a msgbox shows you each time you are entering loop and have met the condition so are copying:

```<code>Public Sub test1()

    Dim ws4 As Worksheet
    Dim lastrowto As Long
    Dim y As Long
    Dim counter As Long

    Set ws4 = ThisWorkbook.Worksheets("Ben")
    lastrowto = ws4.Cells(ws4.Rows.Count, "B").End(xlUp).Row 'fully qualify
    counter = 0

    For y = lastrowto To 1 Step -1

        If ws4.Cells(y, "B").Value = "Not found" Then
            ws4.Rows(y).EntireRow.Copy 'put paste destination code here e.g. ws1.Cells(counter,"B") where ws1 would be another sheet variable
            counter = counter + 1
            Msgbox counter 'if has entered loop print current count

        End If

    Next y

End Sub
</code>```

Body:
Set ws4 = Workbooks("A.xlsx").Worksheets(1)
Lastrowto = ws4.Cells(Rows.Count, "B").End(xlUp).Row

For y = Lastrowto To 1 Step -1
    If ws4.Cells(y, "B").Value = "Not found" Then
        ws4.Rows(y).EntireRow.Copy
    End If
Next y

The above piece of vba code copies only 1 (the first one) row but I want to copy all those rows for which the given condition is met, kindly suggest me the correct version of code.

Body:
You are copying but there is no paste line.

An example, with a paste line destination of ws1.Cells(counter,"B"), assuming another worksheet variable ws1 might be:

 ws4.Rows(y).EntireRow.Copy ws1.Cells(counter,"B")

See the following where a msgbox shows you each time you are entering loop and have met the condition so are copying:

Public Sub test1()

    Dim ws4 As Worksheet
    Dim lastrowto As Long
    Dim y As Long
    Dim counter As Long

    Set ws4 = ThisWorkbook.Worksheets("Ben")
    lastrowto = ws4.Cells(ws4.Rows.Count, "B").End(xlUp).Row 'fully qualify
    counter = 0

    For y = lastrowto To 1 Step -1

        If ws4.Cells(y, "B").Value = "Not found" Then
            ws4.Rows(y).EntireRow.Copy 'put paste destination code here e.g. ws1.Cells(counter,"B") where ws1 would be another sheet variable
            counter = counter + 1
            Msgbox counter 'if has entered loop print current count

        End If

    Next y

End Sub


问:
SQL SERVER XML modify OUTPUT add NameSpace and root
I need to modify my XML in SQL Server 2016 to add a Namespace and a couple of header tags. Currently I have a Select Query That gives me this block

Select @MAXML, @TRANSXML,@HOSTSETTINGSXML FOR XML PATH

```<code>  <merchantAuthentication>
  <name>myName</name>
  <transactionKey>myKey</transactionKey>
 </merchantAuthentication>
      <transactionRequest>
    <amount>5.500000000000000e+000</amount>
  </transactionRequest>
  <hostedPaymentSettings>
    <settingName>hostedPaymentBillingAddressOptions</settingName>
    <settingValue>{"show": true, "required":true}</settingValue>
  </hostedPaymentSettings>
  <hostedPaymentSettings>
    <settingName>hostedPaymentButtonOptions</settingName>
    <settingValue>{"text": "Pay"}</settingValue>
  </hostedPaymentSettings>
  <hostedPaymentSettings>
    <settingName>hostedPaymentReturnOptions</settingName>
    <settingValue>anyValue</settingValue>
  </hostedPaymentSettings>
</code>```

And this should be my output:

```<code><Request>
    <Body>
        <Xml>
            <getHostedPaymentPageRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
                 My xml from above
        </getHostedPaymentPageRequest>
    </Xml>
</Body>
</Request>
</code>```

I am stuck. tried a number of times but could not get the exact xml. Thanks is advance.

答:
I will give my own answer, it might be helpful to others.
Step1: Convert entire XML to string and add headers as string
Step2: Convert the new string back to XML

Step1:

```<code>Set @strXML = '<Request><Body><Xml><getHostedPaymentPageRequest
xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">'+
                Convert(nvarchar(MAX),@x)+
                 '</getHostedPaymentPageRequest></Xml></Body></Request>'
</code>```

Step2:

```<code>SET @RequestXML = (SELECT CONVERT(XML,(SELECT CAST(@strXML AS XML))))
</code>```

Body:
I need to modify my XML in SQL Server 2016 to add a Namespace and a couple of header tags. Currently I have a Select Query That gives me this block

Select @MAXML, @TRANSXML,@HOSTSETTINGSXML FOR XML PATH

  <merchantAuthentication>
  <name>myName</name>
  <transactionKey>myKey</transactionKey>
 </merchantAuthentication>
      <transactionRequest>
    <amount>5.500000000000000e+000</amount>
  </transactionRequest>
  <hostedPaymentSettings>
    <settingName>hostedPaymentBillingAddressOptions</settingName>
    <settingValue>{"show": true, "required":true}</settingValue>
  </hostedPaymentSettings>
  <hostedPaymentSettings>
    <settingName>hostedPaymentButtonOptions</settingName>
    <settingValue>{"text": "Pay"}</settingValue>
  </hostedPaymentSettings>
  <hostedPaymentSettings>
    <settingName>hostedPaymentReturnOptions</settingName>
    <settingValue>anyValue</settingValue>
  </hostedPaymentSettings>

And this should be my output:

<Request>

        <Xml>
            <getHostedPaymentPageRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
                 My xml from above
        </getHostedPaymentPageRequest>
    </Xml>

</Request>

I am stuck. tried a number of times but could not get the exact xml. Thanks is advance.

Body:
I will give my own answer, it might be helpful to others.
Step1: Convert entire XML to string and add headers as string
Step2: Convert the new string back to XML

Step1:

Set @strXML = '<Request><Body><Xml><getHostedPaymentPageRequest
xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">'+
                Convert(nvarchar(MAX),@x)+
                 '</getHostedPaymentPageRequest></Xml></Body></Request>'

Step2:

SET @RequestXML = (SELECT CONVERT(XML,(SELECT CAST(@strXML AS XML))))


问:
Flickity carousel as navigation for another
So, I'm using this https://codepen.io/desandro/pen/wByaqj

And I activated the prevNextButtons: true, like this:

```<code>$('.characters-main').flickity({
      prevNextButtons: false,
      wrapAround: false,
      pageDots: false,
      autoPlay: 10000
    });
    $('.characters-nav').flickity({
      asNavFor: '.characters-main',
      cellAlign: 'right',
      prevNextButtons: true,
      contain: true,
      pageDots: false,
      arrowShape: {
        x0: 10,
        x1: 70, y1: 50,
        x2: 70, y2: 50,
        x3: 35
      }
    });
</code>```

I want that, when I click on the prevNextButtons for .characters-nav to automatically select the element from .characters-main.

This is how it works now:

答:
Please try to use following code. I used flickity event 'select'. You can try settle as well.</p>

```<code>var $carousel2 = $('.characters-main').flickity({
    prevNextButtons: false,
    wrapAround: false,
    pageDots: false,
    autoPlay: 10000
});

var $carousel = $('.characters-nav').flickity({
    asNavFor: '.characters-main',
    cellAlign: 'right',
    prevNextButtons: true,
    contain: true,
    pageDots: false,
    arrowShape: {
        x0: 10,
        x1: 70, y1: 50,
        x2: 70, y2: 50,
        x3: 35
    }
});
$carousel.on( 'select.flickity', function(event, pointer, cellElement, cellIndex) {
    if ( typeof cellIndex == 'number' ) {
        $carousel2.flickity( 'select', cellIndex );
    }
});
</code>```

Body:
So, I'm using this https://codepen.io/desandro/pen/wByaqj

And I activated the prevNextButtons: true, like this:

$('.characters-main').flickity({
      prevNextButtons: false,
      wrapAround: false,
      pageDots: false,
      autoPlay: 10000
    });
    $('.characters-nav').flickity({
      asNavFor: '.characters-main',
      cellAlign: 'right',
      prevNextButtons: true,
      contain: true,
      pageDots: false,
      arrowShape: {
        x0: 10,
        x1: 70, y1: 50,
        x2: 70, y2: 50,
        x3: 35
      }
    });

I want that, when I click on the prevNextButtons for .characters-nav to automatically select the element from .characters-main.

This is how it works now:

Body:
Please try to use following code. I used flickity event 'select'. You can try settle as well.

var $carousel2 = $('.characters-main').flickity({
    prevNextButtons: false,
    wrapAround: false,
    pageDots: false,
    autoPlay: 10000
});

var $carousel = $('.characters-nav').flickity({
    asNavFor: '.characters-main',
    cellAlign: 'right',
    prevNextButtons: true,
    contain: true,
    pageDots: false,
    arrowShape: {
        x0: 10,
        x1: 70, y1: 50,
        x2: 70, y2: 50,
        x3: 35
    }
});
$carousel.on( 'select.flickity', function(event, pointer, cellElement, cellIndex) {
    if ( typeof cellIndex == 'number' ) {
        $carousel2.flickity( 'select', cellIndex );
    }
});