text:
Q: Error in Table based Jasperreport deployed at Tomcat server I have a table based jasperreport which works fine on Jasperstudio Preview but shows error when I compile and deploy it on Tomcat. Reports other than Table compenent works fine on tomcat.
Error for table based report:
java.lang.NullPointerException
    net.sf.jasperreports.components.table.fill.TableReport.createCell(TableReport.java:1629)
    net.sf.jasperreports.components.table.fill.TableReport$ReportBandCreator.createColumnCell(TableReport.java:521)
    net.sf.jasperreports.components.table.fill.TableReport$ColumnHeaderCreator.createColumnCell(TableReport.java:733)
    net.sf.jasperreports.components.table.fill.TableReport$ColumnHeaderCreator.createColumnCell(TableReport.java:710)
    net.sf.jasperreports.components.table.fill.TableReport$ReportBandCreator.visitColumn(TableReport.java:500)
    net.sf.jasperreports.components.table.fill.TableReport$ReportBandCreator.visitColumn(TableReport.java:466)
    net.sf.jasperreports.components.table.StandardColumn.visitColumn(StandardColumn.java:74)
    net.sf.jasperreports.components.table.fill.TableReport$ReportBandCreator.visit(TableReport.java:579)
    net.sf.jasperreports.components.table.fill.TableReport.createColumnHeader(TableReport.java:1141)
    net.sf.jasperreports.components.table.fill.TableReport.<init>(TableReport.java:324)
    net.sf.jasperreports.components.table.fill.FillTable.createFillTableSubreportFactory(FillTable.java:335)
    net.sf.jasperreports.components.table.fill.FillTable.createFillSubreport(FillTable.java:309)
    net.sf.jasperreports.components.table.fill.FillTable.evaluate(FillTable.java:131)
    net.sf.jasperreports.engine.fill.JRFillComponentElement.evaluate(JRFillComponentElement.java:110)
    net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:381)
    net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:500)
    net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummaryNoLastFooterSamePage(JRVerticalFiller.java:1064)
    net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummary(JRVerticalFiller.java:1025)
    net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:161)
    net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:582)
    net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:396)
    net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:90)
    net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:286)
    de.oc.integration.jasper.webapp.ReportWrapper.service(Unknown Source)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

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

<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Iteminwardslandscape" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="8a465670-cc4a-4270-965f-8efb86e33b71">
    <property name="template.engine" value="tabular_template"/>
    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="test connection"/>

    <subDataset name="tableDataset" uuid="5bda4d95-20f7-4d38-bc52-cdecce81ae1b">
        <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
        <property name="com.jaspersoft.studio.data.defaultdataadapter" value="test connection"/>
        <parameter name="STOCK_ID" class="java.lang.String"/>
        <queryString language="SQL">
            <![CDATA[select * from t_stock_detail sd join
t_stock_master sm on sd.stock_id = sm.stock_id
join t_unit_measure uom on sd.uom_id = uom.id
join t_items  i on sd.item_id = i.item_id
join t_item_condition ic on sd.item_condition_id = ic.item_condition_id
join t_ledger l on l.ledger_id = i.ledger_id
WHERE sm.stock_id =  $P{STOCK_ID}]]>
        </queryString>
        <field name="ID" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="ID"/>
        </field>
        <field name="STOCK_ID" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="STOCK_ID"/>
        </field>
        <field name="ITEM_ID" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="ITEM_ID"/>
        </field>
        <field name="ORIGINAL" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="ORIGINAL"/>
        </field>
        <field name="ACTUAL" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="ACTUAL"/>
        </field>
        <field name="WIDTH" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="WIDTH"/>
        </field>
        <field name="LENGTH" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="LENGTH"/>
        </field>
        <field name="STOCKQTY" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="STOCKQTY"/>
        </field>
        <field name="KANTA" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="KANTA"/>
        </field>
        <field name="RATE" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="RATE"/>
        </field>
        <field name="PACKET" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="PACKET"/>
        </field>
        <field name="LABEL_METER" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="LABEL_METER"/>
        </field>
        <field name="NAME" class="java.lang.String">
            <property name="com.jaspersoft.studio.field.label" value="NAME"/>
        </field>
        <field name="LEDGER_ID" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="LEDGER_ID"/>
        </field>
        <field name="COLUMN_31" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="ITEM_CONDITION_ID"/>
        </field>
        <field name="CONDITION" class="java.lang.String">
            <property name="com.jaspersoft.studio.field.label" value="CONDITION"/>
        </field>
        <field name="COLUMN_33" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="ACTIVE"/>
        </field>
        <field name="COLUMN_34" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="LEDGER_ID"/>
        </field>
        <field name="ACCOUNT_CODE" class="java.lang.String">
            <property name="com.jaspersoft.studio.field.label" value="ACCOUNT_CODE"/>
        </field>
        <field name="ACCOUNT_NATURE" class="java.lang.String">
            <property name="com.jaspersoft.studio.field.label" value="ACCOUNT_NATURE"/>
        </field>
        <field name="ADDRESS1" class="java.lang.String">
            <property name="com.jaspersoft.studio.field.label" value="ADDRESS1"/>
        </field>
        <field name="ADDRESS2" class="java.lang.String">
            <property name="com.jaspersoft.studio.field.label" value="ADDRESS2"/>
        </field>
        <field name="MOBILE" class="java.lang.String">
            <property name="com.jaspersoft.studio.field.label" value="MOBILE"/>
        </field>
        <field name="LANDLINE" class="java.lang.String">
            <property name="com.jaspersoft.studio.field.label" value="LANDLINE"/>
        </field>
        <field name="FAX" class="java.lang.String">
            <property name="com.jaspersoft.studio.field.label" value="FAX"/>
        </field>
        <field name="EMAIL" class="java.lang.String">
            <property name="com.jaspersoft.studio.field.label" value="EMAIL"/>
        </field>
        <field name="NTN_NO" class="java.lang.String">
            <property name="com.jaspersoft.studio.field.label" value="NTN_NO"/>
        </field>
        <field name="SALES_TAX_NO" class="java.lang.String">
            <property name="com.jaspersoft.studio.field.label" value="SALES_TAX_NO"/>
        </field>
        <field name="CNIC" class="java.lang.String">
            <property name="com.jaspersoft.studio.field.label" value="CNIC"/>
        </field>
        <field name="PAYMENT_TERMS" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="PAYMENT_TERMS"/>
        </field>
        <field name="CREATED_ON" class="java.sql.Timestamp">
            <property name="com.jaspersoft.studio.field.label" value="CREATED_ON"/>
        </field>
        <field name="CREATED_BY" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="CREATED_BY"/>
        </field>
        <field name="UPDATED_ON" class="java.sql.Timestamp">
            <property name="com.jaspersoft.studio.field.label" value="UPDATED_ON"/>
        </field>
        <field name="UPDATED_BY" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="UPDATED_BY"/>
        </field>
        <field name="COLLECTOR_ID" class="java.math.BigDecimal">
            <property name="com.jaspersoft.studio.field.label" value="COLLECTOR_ID"/>
        </field>
        <field name="LEDGER_DESCRIPTION" class="java.lang.String">
            <property name="com.jaspersoft.studio.field.label" value="LEDGER_DESCRIPTION"/>
        </field>
    </subDataset>
    <parameter name="STOCK_ID" class="java.lang.String"/>
    <queryString>
        <![CDATA[]]>
    </queryString>
    <title>
        <band height="56" splitType="Stretch">
            <staticText>
                <reportElement x="-20" y="0" width="822" height="56" uuid="1a03a12c-458b-4eca-8787-8a9d54804390"/>
                <textElement textAlignment="Center">

                </textElement>
                <text><![CDATA[Item Inwards Report]]></text>
            </staticText>
        </band>
    </title>
    <pageFooter>
        <band height="38" splitType="Stretch"/>
    </pageFooter>

        <band height="200" splitType="Stretch">
            <property name="local_mesure_unitheight" value="pixel"/>
            <componentElement>
                <reportElement x="0" y="0" width="820" height="200" uuid="4d9aaea1-bd91-47d4-aef5-d74e66e37240">
                    <property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/>
                    <property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/>
                    <property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/>
                </reportElement>
                <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" whenNoDataType="Blank">
                    <datasetRun subDataset="tableDataset" uuid="f1b23deb-5b3f-45b3-acaa-fa56d0c6824e">
                        <datasetParameter name="STOCK_ID">
                            <datasetParameterExpression><![CDATA[$P{STOCK_ID}]]></datasetParameterExpression>
                        </datasetParameter>
                        <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    </datasetRun>
                    <jr:column width="66" uuid="d5acd7c1-830d-410a-b053-a4e90fefb28d">
                        <jr:tableHeader style="Table_TH" height="30"/>
                        <jr:tableFooter style="Table_TH" height="30"/>
                        <jr:columnHeader style="Table_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="66" height="30" uuid="c15e662d-17c5-4ffd-933c-e9a30cd6f8d5"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <text><![CDATA[ID]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30"/>
                        <jr:detailCell style="Table_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="66" height="30" uuid="fe490009-312c-4a2d-a8eb-3d42505e50eb"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <textFieldExpression><![CDATA[$F{ID}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="66" uuid="0a780390-af03-4d1a-84c4-9eb94f2e5ba7">
                        <jr:tableHeader style="Table_TH" height="30"/>
                        <jr:tableFooter style="Table_TH" height="30"/>
                        <jr:columnHeader style="Table_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="66" height="30" uuid="8306656d-ef07-4d8c-a931-72a0131cf6f7"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <text><![CDATA[ITEM_ID]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30"/>
                        <jr:detailCell style="Table_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="66" height="30" uuid="fdc1a3d1-2364-4e3f-831e-e868ac812a17"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <textFieldExpression><![CDATA[$F{ITEM_ID}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="66" uuid="8126feca-69cf-458d-bd89-744d00917cfd">
                        <jr:tableHeader style="Table_TH" height="30"/>
                        <jr:tableFooter style="Table_TH" height="30"/>
                        <jr:columnHeader style="Table_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="66" height="30" uuid="64407eea-0f3c-4935-9034-aa7434dbaa17"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <text><![CDATA[NAME]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30"/>
                        <jr:detailCell style="Table_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="66" height="30" uuid="c64ce848-434d-4c89-95cc-75467edba62e"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <textFieldExpression><![CDATA[$F{NAME}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="82" uuid="3ba4ada4-897b-481c-8c56-3418d463cb76">
                        <jr:tableHeader style="Table_TH" height="30"/>
                        <jr:tableFooter style="Table_TH" height="30"/>
                        <jr:columnHeader style="Table_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="82" height="30" uuid="c17e874e-f0a4-4f6e-afb3-638ecdbf702a"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <text><![CDATA[CONDITION]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30"/>
                        <jr:detailCell style="Table_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="82" height="30" uuid="11a27a61-8a7d-4fb9-949d-09d910f13d7d"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <textFieldExpression><![CDATA[$F{CONDITION}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="70" uuid="06227fe0-3be2-4b38-9a86-80f2cfc20731">
                        <jr:tableHeader style="Table_TH" height="30"/>
                        <jr:tableFooter style="Table_TH" height="30"/>
                        <jr:columnHeader style="Table_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="70" height="30" uuid="1113d914-14c1-409f-8314-2d00ea6c088c"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <text><![CDATA[ORIGINAL]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30"/>
                        <jr:detailCell style="Table_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="70" height="30" uuid="2840bfe5-8016-4728-9ac8-b955b9002cfe"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <textFieldExpression><![CDATA[$F{ORIGINAL}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="66" uuid="84c3b038-62cf-4b4c-8bf3-6f497a81fc78">
                        <jr:tableHeader style="Table_TH" height="30"/>
                        <jr:tableFooter style="Table_TH" height="30"/>
                        <jr:columnHeader style="Table_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="66" height="30" uuid="8a80be66-64b8-4c01-8265-0f0edc683abc"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <text><![CDATA[ACTUAL]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30"/>
                        <jr:detailCell style="Table_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="66" height="30" uuid="20cb7ba3-845e-464a-a1d6-4c1a783bb299"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <textFieldExpression><![CDATA[$F{ACTUAL}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="66" uuid="07e2f7c9-80ec-4e47-808d-3126856af4f2">
                        <jr:tableHeader style="Table_TH" height="30"/>
                        <jr:tableFooter style="Table_TH" height="30"/>
                        <jr:columnHeader style="Table_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="66" height="30" uuid="116b5911-e01e-4e63-a222-a3185d57fcc6"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <text><![CDATA[WIDTH]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30"/>
                        <jr:detailCell style="Table_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="66" height="30" uuid="6734c42e-33b5-4c1f-b846-b1dc97d33694"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <textFieldExpression><![CDATA[$F{WIDTH}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="66" uuid="5ab03631-2b44-4d8a-afd6-a03198387fa8">
                        <jr:tableHeader style="Table_TH" height="30"/>
                        <jr:tableFooter style="Table_TH" height="30"/>
                        <jr:columnHeader style="Table_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="66" height="30" uuid="9d6293fb-bdab-471e-9a68-3956ae3563bd"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <text><![CDATA[LENGTH]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30"/>
                        <jr:detailCell style="Table_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="66" height="30" uuid="bc091e6b-c2f0-40a2-a77c-4ebf2ce1b9dc"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <textFieldExpression><![CDATA[$F{LENGTH}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="66" uuid="c451bb94-ff75-4650-af1b-64aeeb245f70">
                        <jr:tableHeader style="Table_TH" height="30"/>
                        <jr:tableFooter style="Table_TH" height="30"/>
                        <jr:columnHeader style="Table_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="66" height="30" uuid="ec0c6421-d2e9-4c6b-a686-c5a45995fa4a"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <text><![CDATA[KANTA]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30"/>
                        <jr:detailCell style="Table_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="66" height="30" uuid="193c889d-bb33-414b-a843-54af34863029"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <textFieldExpression><![CDATA[$F{KANTA}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="76" uuid="4ee20376-8573-4c62-b211-3d5fe444078d">
                        <jr:tableHeader style="Table_TH" height="30"/>
                        <jr:tableFooter style="Table_TH" height="30"/>
                        <jr:columnHeader style="Table_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="76" height="30" uuid="957fe4de-cad1-4c99-b75a-4429d654d7a8"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <text><![CDATA[QUANTITY]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30"/>
                        <jr:detailCell style="Table_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="76" height="30" uuid="6edcef3e-e6ba-4445-af51-62ffb268a9dc"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <textFieldExpression><![CDATA[$F{STOCKQTY}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="66" uuid="c641a72e-f78c-497b-aabd-46ef0ee484f4">
                        <jr:tableHeader style="Table_TH" height="30"/>
                        <jr:tableFooter style="Table_TH" height="30"/>
                        <jr:columnHeader style="Table_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="66" height="30" uuid="8f5a5208-1bc1-4953-80f0-b5581599b253"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <text><![CDATA[METER]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30"/>
                        <jr:detailCell style="Table_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="66" height="30" uuid="4930bdd8-24ca-430e-b97d-de0bc4a38a0a"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <textFieldExpression><![CDATA[$F{LABEL_METER}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                    <jr:column width="66" uuid="44628f40-c2a8-4fc1-9083-5d8826589c3a">
                        <jr:tableHeader style="Table_TH" height="30"/>
                        <jr:tableFooter style="Table_TH" height="30"/>
                        <jr:columnHeader style="Table_CH" height="30">
                            <staticText>
                                <reportElement x="0" y="0" width="66" height="30" uuid="bb083ce6-4ace-4dc6-af8c-11bc087181f7"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <text><![CDATA[LEDGER]]></text>
                            </staticText>
                        </jr:columnHeader>
                        <jr:columnFooter style="Table_CH" height="30"/>
                        <jr:detailCell style="Table_TD" height="30">
                            <textField>
                                <reportElement x="0" y="0" width="66" height="30" uuid="dca8c816-3ec8-4cce-880c-538a6b8b6b02"/>
                                <box leftPadding="2"/>
                                <textElement textAlignment="Center" verticalAlignment="Middle">

                                </textElement>
                                <textFieldExpression><![CDATA[$F{LEDGER_DESCRIPTION}]]></textFieldExpression>
                            </textField>
                        </jr:detailCell>
                    </jr:column>
                </jr:table>
            </componentElement>
        </band>

</jasperReport>

I'm using
tomcat-8.5.56
Java-Runtime-Version: 14.0.1
Jaspersoft® Studio 6.12.2


text:
Q: how to divide gridview with equal space for each column I have grid which contains 8 Columns , out of that 4 columns covered by radio buttons..
I want to divide each column equally by spacing ,, but it didn't work ?
What should i do ??/
<asp:GridView ID="gvRelatives" runat="server" AutoGenerateColumns="False" EmptyDataText="Sorry, No Records Available !" CellPadding="4" ForeColor="#333333" GridLines="None"  CellSpacing ="2" onselectedindexchanged="gvRelatives_SelectedIndexChanged" AutoPostBack="True" onrowcreated="gvRelatives_RowCreated"                         onrowdatabound="gvRelatives_RowDataBound" BorderWidth ="2"
ondatabound="gvRelatives_DataBound" EnableSortingAndPagingCallbacks="False" >
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" HorizontalAlign="center" />
<Columns>
<%--<asp:BoundField DataField="QTN_NO" HeaderText="Question Number" SortExpression="Name" InsertVisible ="false" />--%>
<asp:BoundField DataField="QTN_DESC" HeaderText="Question Description" SortExpression="Name" InsertVisible ="false"  />
<asp:BoundField DataField="SQTN_NO" HeaderText="Sub Question No" SortExpression="Name" />
<asp:BoundField DataField="SQTN_DESC" HeaderText="Sub Question Name" SortExpression="Name" />
<asp:TemplateField HeaderText ="Strongly Disagree"></asp:TemplateField>
<asp:TemplateField HeaderText ="Disagree"></asp:TemplateField>
<asp:TemplateField HeaderText ="Agree"></asp:TemplateField>
<asp:TemplateField HeaderText ="Strongly Agree"></asp:TemplateField>
</Columns>
<asp:GridView>

A: Try putting a width value in each field
      <asp:BoundField DataField="QTN_NO" HeaderText="Question Number" SortExpression="Name" Width="100px" InsertVisible ="false"/>

A: Add width to each header BoundField Element.
<asp:BoundField DataField="Title" HeaderText="Title">
<HeaderStyle HorizontalAlign="Center" Width="400"></HeaderStyle>
</asp:BoundField>`

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do I add a role to new members discord I've tried different things but they never work. I tried to add the code to my new user joined task
public async Task AnnounceJoinedUser(SocketGuildUser user) //welcomes New Players
{
    var channel = Client.GetChannel(447147292617736203) as SocketTextChannel; //gets channel to send message in
    await channel.SendMessageAsync("Welcome " + user.Mention + " to the server! Have a great time"); //Welcomes the new user
}

But I dont know how to add a role to new user

A: Get the role from the guild that the user joined in first, then add the role to the user using user.AddRoleAsync().
private async Task UserJoined(SocketGuildUser socketGuildUser) {
    ulong roleID = 123; //Some hard-coded roleID
    var role = socketGuildUser.Guild.GetRole(roleID);
    await socketGuildUser.AddRoleAsync(role);

    //Without ID...
    string roleName = "The role name to add to user"; //Or some other property
    //Get the list of roles in the guild.
    var guildRoles = socketGuildUser.Guild.Roles;
    //Loop through the list of roles in the guild.
    foreach(var guildRole in guildRoles) {
        //If the current iteration of role matches the rolename
        if(guildRole.Name.Equals(roleName, StringComparison.OrdinalIgnoreCase)) {
            //Assign the role to the user.
            await socketGuildUser.AddRoleAsync(guildRole);
            //Exit Loop.
            break;
        }
    }
}


text:
Q: Silverlight 3 - ListBox : how to achieve Smooth Scroll and catch MouseDown/MouseUp events I'm trying to adapt the behaviour of the ListBox for my needs and I ran into several problems
1) How can you programatically set the scrolling position of the ListBox
The ListBox does not provide an accessor to its inner ScrollViewer so that you cannot scroll it to wherever you want.
2) How to accurately set the vertical scrolling (i.e how to have a smooth scrolling) ?
By default, there is no way to scroll the list other by scrolling one complete element at a time (the Listbox will always make sure that the first element is shown entirely)
This behaviour is ok in most cases, but not mine : I want a smooth movement...),
There is a solution to this problem with WPF, but not with Silverlight (see question "is-it-possible-to-implement-smooth-scroll-in-a-wpf-listview" ).
3) How to catch the MouseDown and MouseUp events :
If you subclass the ListBox , you might be able to catch the MouseUp and MouseMove events. However the MouseUp event is never fired (I suspect it is being eaten by the ListBox subelements)

A: I have found the answer, so I will answer myself.

1) How to make the ListBox scroll smoothly :
This problem did not happen in SilverLight 2, and it happens only with SilverLight 3, in which the VirtualizedStackPanel was introduced.
The VirtualizedStackPanel enables much faster refresh in the case of huge lists (as only the visible elements are drawn)
There is a workaround for this (beware, it should not be used on huge lists) : you redefine the ListBox's ItemPanelTemplate, so that it uses StackPanel :
<navigation:Page.Resources>
    <ItemsPanelTemplate x:Key="ItemsPanelTemplate">
        <StackPanel/>
    </ItemsPanelTemplate>
</navigation:Page.Resources>

<StackPanel Orientation="Vertical"  x:Name="LayoutRoot">
        <ListBox x:Name="list" ItemsPanel="{StaticResource ItemsPanelTemplate}">
        </ListBox>
</StackPanel>

2) How to programatically change the scrolling position
See the subclass of ListBox below : it provides an accessor to the internal ScrollViewer of the ListBox

3) How to catch the MouseDown / Move / Up events in the listbox :
Create a subclass of ListBox as shown below. The 3 methods :
 internal void MyOnMouseLeftButtonDown(MouseButtonEventArgs e)
 protected override void OnMouseMove(MouseEventArgs e)
 protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)

will be called and you can do whatever you want with them. There is one subtle trick which is that the OnMouseLeftButtonDown method of ListBox is never called : you need to implement a subclass of ListBoxItem where you can handle this event.
using System;
using System.Collections.Generic;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace MyControls
{
  //In order for this class to be usable as a control, you need to create a folder
  //named "generic" in your project, and a "generic.xaml" file in this folder
  //(this is where you can edit the default look of your controls)
  //
  /*
   * Typical content of an "empty" generic.xaml file :
    <ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:VideoControls">
    </ResourceDictionary>
   */
  public class MyListBox : ListBox
  {
    public MyListBox()
    {
        DefaultStyleKey = typeof(ListBox);
    }

    public override void OnApplyTemplate()
    {
      base.OnApplyTemplate();
    }

    #region ScrollViewer / unlocking access related code
    private ScrollViewer _scrollHost;
    public ScrollViewer ScrollViewer
    {
      get
      {
        if (_scrollHost == null)
          _scrollHost = FindVisualChildOfType<ScrollViewer>(this);
        return _scrollHost;
      }
    }

    public static childItemType FindVisualChildOfType<childItemType>(DependencyObject obj)
      where childItemType : DependencyObject
    {
      // Search immediate children first (breadth-first)
      for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
      {
        DependencyObject child = VisualTreeHelper.GetChild(obj, i);

        if (child != null && child is childItemType)
          return (childItemType)child;

        else
        {
          childItemType childOfChild = FindVisualChildOfType<childItemType>(child);

          if (childOfChild != null)
            return childOfChild;
        }
      }

      return null;
    }
    #endregion

    //Modify MyListBox so that it uses MyListBoxItem instead of ListBoxItem
    protected override DependencyObject GetContainerForItemOverride()
    {
      MyListBoxItem item = new MyListBoxItem(this);
      if (base.ItemContainerStyle != null)
      {
        item.Style = base.ItemContainerStyle;
      }

      return item;
    }

    //OnMouseLeftButtonUp is never reached, since it is eaten by the Items in the list...
    /*
    protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
    {
      base.OnMouseLeftButtonDown(e);
      e.Handled = false;
    }
    */

    internal void MyOnMouseLeftButtonDown(MouseButtonEventArgs e)
    {
    }

    protected override void OnMouseMove(MouseEventArgs e)
    {
      base.OnMouseMove(e);
    }

    protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
    {
      base.OnMouseLeftButtonUp(e);
    }

  }

  public class MyListBoxItem : ListBoxItem
  {
    MyListBox _customListBoxContainer;

    public MyListBoxItem()
    { }

    public MyListBoxItem(MyListBox customListBox)
    {
      this._customListBoxContainer = customListBox;
    }

    protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
    {
      base.OnMouseLeftButtonDown(e);

      if (this._customListBoxContainer != null)
      {
        this._customListBoxContainer.MyOnMouseLeftButtonDown(e);
      }

    }
  }
}


text:
Q: How to add element into HTTP header in SoapWrapper Laravel? I had no problem running the following code in my controller.
SoapWrapper::add(function ($service) {
               $service
               ->name('Testing')
               ->wsdl('http://example.asmx?WSDL')
               ->trace(true);
             });

        // Using the added service
        SoapWrapper::service('Testing', function ($service) use ($data) {
            print_r($service->call('Function1', []));
            //print_r($service->getLastRequestHeaders());
        });

Following is my request HTTP header.
POST http://example.asmx HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://tempuri.org/Function1"
Content-Length: 214
Host: some_host
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
randomName:some_session_id  //<------------which i want to add

But let say I want to add randomName: some_session_id into the HTTP header, what/how should I do it? Have try -header() and customHeader() but this only add into the xml envelope header which is not I want.

A: For adding data into http header you need to do it like it's on documentation
$data = [
            'CurrencyFrom' => 'USD',
            'CurrencyTo'   => 'EUR',
            'RateDate'     => '2014-06-05',
            'Amount'       => '1000'
        ];

        // Using the added service
        SoapWrapper::service('currency', function ($service) use ($data) {
            var_dump($service->getFunctions());
            var_dump($service->call('GetConversionAmount', [$data])->GetConversionAmountResult);
        });

In  your case you don't send any additional data in your service call so you should do it like it's below
SoapWrapper::add(function ($service) {
               $service
               ->name('Testing')
               ->wsdl('http://example.asmx?WSDL')
               ->trace(true);
             });

        // Using the added service
        $data = session()->get('some_id');
        SoapWrapper::service('Testing', function ($service) use ($data) {
            print_r($service->call('Function1', [$data]));
            //print_r($service->getLastRequestHeaders());
        });

EDIT:
For adding custom header, you should use
public function customHeader($header)
{
    $this->headers[] = $header;
    return $this;
}

from SoapWrapper/Service.
So in your case you should do something like
SoapWrapper::add(function ($service) {
               $service
               ->name('Testing')
               ->wsdl('http://example.asmx?WSDL')
               ->customHeader($customHeader)
               ->trace(true);
             });

Hope it helps


text:
Q: CSS : align pair of divs horizontally across two vertical divs I've come across a specific design which I can't find any perfect solution for. My issue is the following:

My page is split in half vertically (Left Pannel / Right Pannel, taking the full page height), and in these pannels there will be pairs of divs that shall always be aligned horizontally. For instance, A and A' must be aligned. Even if the divs sizes change (see B and B', or C and C') they shall remain aligned.
I've tweaked a lot and found some decent solutions, the best one being 'faking' the Left and Right pannel, having a single div instead with a gradient background split in half. But the issue is that I need the divs architecture to be clean, otherwise I won't be able, later on, to do things like 'When you click on the Left Pannel, xxxx happens', or 'Disable the Right pannel by blocking all inputs in it' etc.
I've played with tables as well, but my horizontal divs appear dynamically (at first the Left / Right pannels are empty) and I couldn't force the table to use the full page height without the first few cells being abnormally big to fill the full height of their parent.
Is there any clean solution to my problem? It it helps, I'm using material-ui along with React.
Thanks a lot!

A: this is an example of how you can do it

* {
  box-sizing: border-box;
}
.container {
  display: flex;
  flex-wrap: wrap;
  width: 500px;
}

.column {
  flex: 0 0 50%;
  padding: 10px;
}

.column-1 {
  background-color: rgba(255, 0,  0, 0.6);
}

.column-2 {
  background-color: rgba(0, 0, 255, 0.6);
}

.column-content {
  background-color: red;
  padding: 10px;
}

      content with

      multiple lines

      content with one line

      content with one line

      content with

      multiple lines


text:
Q: Accessing google cloud storage from cloud function(without download) I am running a Google cloud function, which accesses the google cloud storage bucket for an excel file. My goal is to read the file and do some calculations with it, but is it possible without downloading the file to the /tmp folder?
Things I have tried:
  storage_client = storage.Client()
  file_obj = storage_client.get_bucket('bucketname').get_blob('filename.xlsx')

  excel_file = None
  file_obj.download_to_file(excel_file)
  wb = openpyxl.load_workbook(excel_file)

at first I thought I could attain a file object, but then after I read the error message I realised I was being asked for a file path so I would have to download to the /tmp folder, which is something I would like to avoid.
I also tried download_as_bytes(), but unfortunately openpyxl cannot read bytes.
Any help/hint would be appreciated :)

A: As you can see in this Community Answer:
In the docs for openpyxl.load_workbook it says:
#:param filename: the path to open or a file-like object

So if you have bytes as the input you can assemble a "proto-object" to satisfy the parameter requirements  of openpyxl.load_workbook and it will work, so like the example below:
from io import BytesIO
...
excel_file = None
file_obj.download_as_bytes(excel_file)
wb = load_workbook(filename=BytesIO(excel_file.read()))


text:
Q: How can I test push/C2DM notifications to Android Application? I need to implement push/C2DM notifications on my website, I installed the Android 3.0 platform sdk, simulator, and I installed the application from an .apk file.
Now, I'm using a ZF powered sites and I want to test my notification, is it possible through the simulator?
I didn't write the actual Android Application, and I'm not able to do anything on it, but what should I know to use it with PHP?
Thank you

A: You cannot push C2DM messages to third-party applications - not without their active participation. Google's technical implementation explicitly forbids that.
An app specifies a Google account it wishes to receive notifications from; in order to send notifications, you need to log on with a Google account. For everything to work, the account has to be the same. So unless you know what account does the app wants messages from, and you know the password to that account, no C2DM for you.


text:
Q: Making HTTP get request to an api in dart only? Hey I wanted to know how to make a HTTP request to an api or webpage in dart language only not combined with flutter,like requests.get() in python .

A: Have a look at the http package: https://pub.dev/packages/http
A simple example (not dealing with errors...):
import 'package:http/http.dart' as http;

main() async {
  var response = await http.get('http://www.google.com');
  print(response.body);
}

The example in the README:
import 'package:http/http.dart' as http;

var url = 'https://example.com/whatsit/create';
var response = await http.post(url, body: {'name': 'doodle', 'color': 'blue'});
print('Response status: ${response.statusCode}');
print('Response body: ${response.body}');

print(await http.read('https://example.com/foobar.txt'));


text:
Q: KIvy Camera no capture I got some help trying to understand how to use a camera in an app with multiple screens. I have the capture method but I my camera shows on the screen but I get to captured picture when I press the capture button. Also, if you have any literature that simplifies the uses screen manager with inputs from different screen widgets, I would appreciate it.
main.py
import math
import time
import kivy
import kivy.core.text
from kivy.app import App
from kivy.core.window import Window
from kivy.graphics.texture import Texture
from kivy.lang import Builder
from kivy.metrics import dp, sp
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.camera import Camera
from kivy.uix.gridlayout import GridLayout
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.uix.relativelayout import RelativeLayout
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.uix.textinput import TextInput

Builder.load_file('camera.kv')
Builder.load_file('inputscreen.kv')
Builder.load_file('displayscreen.kv')

class ScreenSwitch(ScreenManager):
    pass
class CameraScreen(Screen):

    def capture(self, *args):
        camera = self.ids['camera']
        timestamp = time.strftime("%Y%m%d_%H%M%S")
        camera.export_to_png("IMG_{}.png".format(timestamp))

class InputScreen(Screen):
    pass
class DisplayScreen(Screen):
    pass
class SettingScreen(Screen):
    pass

class tipbotApp(App):
    def build(self):
        self.title = "tipBot   " \
                     "                           version: 1"

tipbotApp().run()

tipbot.kv
ScreenSwitch:
    CameraScreen:
        name: "camera_screen"
        id: camera_screen
    InputScreen:
        name: "input_screen"
        id: input_screen
    DisplayScreen:
        name: "display_screen"
        id: display_screen
    SettingScreen:
        name: "setting_screen"
        id: setting_screen

camera.kv
<CameraScreen>:
    GridLayout:
        cols: 1
        Camera:
            id: camera
            text: "[b]CAPTURE[/b]"
            markup: True
            size_hint_y: dp(50)
            size_hint_x: dp(50)
            pos_hint: {'center_x': dp(1), 'center_y': dp(1)}

    RelativeLayout:
        Button:
            id: imgcapture
            text: "[b]CAPTURE[/b]"
            font_size: '30sp'
            markup : True
            width: self.texture_size[0] + dp(10)
            height: self.texture_size[1] + dp(10)
            size_hint: None, None
            on_press: root.capture
        Button:
            id: imagemanual
            text: "[b]MANUAL ENTRY[/b]"
            font_size: '25sp'
            markup: True
            size: dp(200), dp(50)
            pos: dp(400), dp(0)
            size_hint: None, None
            on_release: app.root.current = "input_screen"

A: In kv, when you specify a method call for something like on_press, you must include the ending (). Just the opposite of almost everywhere else. Try changing:
on_press: root.capture

to:
on_press: root.capture()


text:
Q: OpenGL shadow map incorrect shadows over the object I implement the shadow map with directional light in an android Native OpenGL C++ application, the shadow is rendered correctly but there some bugs in my code that makes the result as in the attached image:

as shown there are strange triangulated shadows over the model, the implementation as follow:
first create the depth buffer and the depth map as follow:
if (sun->castShadow) {
    glCullFace(GL_FRONT);
    glGenFramebuffers(1, &depthMapFBO);
    glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);
    glGenTextures(1, &depthMap);
    glBindTexture(GL_TEXTURE_2D, depthMap);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, SHADOW_WIDTH, SHADOW_HEIGHT, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, NULL);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthMap, 0);
    glDrawBuffers(1, GL_NONE);
    glReadBuffer(GL_NONE);
    glBindFramebuffer(GL_FRAMEBUFFER, 0);
    glBindTexture(GL_TEXTURE_2D, 0);
    glCullFace(GL_BACK);
    if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
        LOGI("framebuffer incomplete");
    }
}

the internal format for glTexImage2D is not work with GL_Float so I used GL_UNSIGNED_SHORT.
then I render the scene from light view, first the light vector is (50,100,50) and I have a confliction about direct light direction is it the direction towards the light or from the light but that value create the shadow and the scene is rendered well with different light components.
the code is:
    if (sun->castShadow) {
        double delta = GetCurrentTime() - firstFrame;
        glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO);
        glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT);
        glClear(GL_DEPTH_BUFFER_BIT);
        glm::vec3 pos = player->getPosition();
        glm::vec3 tar = pos + (-sun->direction);
        glm::mat4 lightSpaceProjection = glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, -20.0f, 500.0f);
        glm::mat4 lightSpaceView = glm::lookAt(pos, tar, glm::vec3(0, 1, 0));
        lightSpaceMatrix = lightSpaceProjection * lightSpaceView;
        shaders.setDepthLightSpaceUniform(lightSpaceMatrix);
        terrain->renderDepth(delta);
        for (item_it it = engineItems.begin(); it != engineItems.end(); ++it) {
            if (it->get()->castShadow)
                it->get()->renderDepth(delta);
        }
        glBindFramebuffer(GL_FRAMEBUFFER, 0);
    }

finally render the scene normally:
shaders.setLightsUniforms(directlights, pointlights, spotlights);
shaders.setViewUniforms(camera);
double first = GetCurrentTime() - firstFrame;
terrain->render(first);
for (item_it it = engineItems.begin(); it != engineItems.end(); ++it) {
    it->get()->render(first);
}

the fragment shader part of the direct light calculations is:
    vec3 calcDirectLight(DirectLight light,vec3 norm,vec3 tLightPos,vec3 diffColor,vec3 specColor){
    vec3 lightDir ;
    if(Has_normal_map==1)
        lightDir= normalize(tLightPos-tFragPos);
    else
        lightDir = normalize(light.direction - tFragPos);

    float diff = max(dot(lightDir,norm), 0.0);
    vec3 diffuse = light.color * diff * diffColor;

    vec3 viewDir = normalize(tViewPos - tFragPos);
    vec3 halfwayDir = normalize(lightDir + viewDir);
    float spec = pow(max(dot(norm, halfwayDir), 0.0), 32.0);
    vec3 specular = shininess * spec *specColor* light.color;
    vec3 result;
    if(light.castShadow==1){
        vec3 projCoords = FragPosLightSpace.xyz / FragPosLightSpace.w;
        projCoords = projCoords * 0.5 + 0.5;
        float shadow = 1.0;
        for (int i=0;i<4;i++){
            shadow -= 0.2*(1.0-texture( shadowMap, projCoords.xy + poissonDisk[i]/700.0).r);
        }
        if(projCoords.z > 1.0)
            shadow = 0.0;
        result =light.intensity* shadow * (diffuse + specular);
    }
    else
        result =light.intensity* (diffuse + specular);
    return result;
}

there are some other bugs but this is the major one

A: I belive that the problem is here:
if(Has_normal_map==1)
    lightDir= normalize(tLightPos-tFragPos);
else
    lightDir = normalize(light.direction - tFragPos);

I see that you are using a directional light.
To compute the direction of a directional light is simply:
lightDir = light.direction

Also, I don't understant why you use a diferent formula for computing the light direction depending on whether Has_normal_map or not. I belive that the direction of the light doesn't depend on the normal map. I hope that solves your bug.


text:
Q: npm Error code ENOENT error no-4058 npm not being able to find a file This problem is almost with every npm module installation.
I think it's something to do with SQLite 3 module because whenever I create a new project using npm init and install some module other than SQLite 3 like crypto-js or yargs etc it works.
But soon after I install SQLite 3, no other module can be installed and the following error occurs.
I have tried to search it everywhere but unable to find solution for this . I hope I'll find a solution here.
My Node version is v8.2.1 and npm version is 5.3.0.  My operating system is Windows 8.1 Professional.

F:\name>npm install crypto-js --save
  npm WARN todo-api@1.0.0 No description
  npm WARN todo-api@1.0.0 No repository field.
npm ERR! path F:\name\node_modules\sqlite3\node_modules\node-pre-gyp\node_module
  s\npmlog\node_modules\are-we-there-yet\node_modules\delegates
  npm ERR! code ENOENT
  npm ERR! errno -4058
  npm ERR! syscall rename
  npm ERR! enoent ENOENT: no such file or directory, rename 'F:\name\node_modules\
  sqlite3\node_modules\node-pre-gyp\node_modules\npmlog\node_modules\are-we-there-
  yet\node_modules\delegates' -> 'F:\name\node_modules\sqlite3\node_modules\node-p
  re-gyp\node_modules\npmlog\node_modules\are-we-there-yet\node_modules.delegates
  .DELETE'
  npm ERR! enoent This is related to npm not being able to find a file.
  npm ERR! enoent
npm ERR! A complete log of this run can be found in:
  npm ERR!     C:\Users\Usman Ahmad\AppData\Roaming\npm-cache_logs\2017-08-25T09_
  49_02_538Z-debug.log


text:
Q: Evaluate the limit of $(\sqrt{5-x}-2)/(\sqrt{2-x}-1)$ as $x\to 1$ Can you help me with it and explain the steps
$$\lim_{x \to 1} \frac{\sqrt{5-x}-2}{\sqrt{2-x}-1}$$
I tried to multiply at conjugate expression but I failed.

A: Hint: $$\frac{\sqrt{5-x}-2}{\sqrt{2-x}-1}=\frac{(\sqrt{5-x}-2)(\sqrt{5-x}+2)(\sqrt{2-x}+1)}{(\sqrt{2-x}-1)(\sqrt{2-x}+1)(\sqrt{5-x}+2)}.$$

A: You could multiply by $(\sqrt{5-x}+2)(\sqrt{2-x}+1)$ both the numerator and denominator of this fraction.


text:
Q: DataGridView doesn't redraw I have simply placed a new DataGridView object onto the form. When data is added to the gridview or scrolling, it doesn't clear the rows or columns before redrawing. I have never used this control in C# before, but it should work "out of the box" with the default settings but it doesn't. I'm sure there's some place where I just need to refresh or invalidate the control.
To be more clear:
My problem has to do with rendering to the screen. It doesn't clear the screen before redrawing, so I get trails.
Here is a screenshot:

Don't ask me for code. There is none. I just placed the control on the form and added columns. That's it.

A: After figuring out that it worked without the themes enabled, I finally found the following code:
dataGridView1.EnableHeadersVisualStyles = false;

A: By setting the datasource property on your datagrid null, you should be able to rewrite data to your datagrid. This will "update" the grid.


text:
Q: This is often vs This often is Is it correct to write

This often is done for something.

rather than

This is often done for something.

A: My thought that the variant "This is often done for something" sounds more grammatically correct.
Because the adverbs of frequency have to precede the main verb. Actually the adverb is put before the word it's modifying.
But your alternative variant "This often is done for something" definitely make sense, though it sounds a bit as a colloquial expression.


text:
Q: how to convert a json array into java object? i create an error handling system with microsoft asp.net identity it return back error by using an enum as json model
public enum ErrorType
{
    InvalidPassword,
    TooShortPassword,
    NullUserName,
    InvalidUserName,
    NullEmail,
    InvalidEmail,
    DuplicateUserName,
    DuplicateEmail,
    OtherIdentityErrors,
    LoginIncorrectUserNameOrPass
}

and i have a class that create a list of error from that
public class ErrorModelJson
{
    public ErrorModelJson()
    {
        ErrorTypes = new List<ErrorType>();
    }
    public List<ErrorType> ErrorTypes { get; set; }
}

when a user send a request login if user name or password is incorrect  login action method return a json have a list of error
private ApplicationUserManager UserManager => Request.GetOwinContext().GetUserManager<ApplicationUserManager>();
        [AllowAnonymous]
    public async Task<IHttpActionResult> Login(UserLoginJson userLoginJson)
    {
        var user = await UserManager.FindByNameAsync(userLoginJson.UserNameOrEmail) ??
                   await UserManager.FindByEmailAsync(userLoginJson.UserNameOrEmail);
        if (user == null || !await UserManager.CheckPasswordAsync(user, userLoginJson.Password))
        {
            var errorJson = new ErrorModelJson();
            errorJson.ErrorTypes.Add(ErrorType.LoginIncorrectUserNameOrPass);
            errorJson.ErrorTypes.Add(ErrorType.InvalidPassword);
            return ResponseMessage(Request.CreateResponse(HttpStatusCode.BadRequest, errorJson));

        }
        IUserManagement userManagement = new UserManagement();

        return Ok(userManagement.GetUserLoginReturnJson(user));
    }

so in my android application i have an enum ErrorType and a class ErrorModelJson to parse received json to ErrorModelJson to create a list of error my android app recieve a json as below
{"ErrorTypes":[9]}

and i'll convert this json to ErrorModelJson by gson and volley with these code but i get my model null can you help me?
 @Override
protected VolleyError parseNetworkError(VolleyError volleyError){
    NetworkResponse response = volleyError.networkResponse;
    switch (response.statusCode)
    {
        case 400:
            String data=new String(volleyError.networkResponse.data);
            Gson gson = new Gson();

            ErrorModelJson errorModelJson1 =    gson.fromJson(data,ErrorModelJson.class);
            errorModelListener.onError(errorModelJson1);
            break;
    }
}

A: I did not dig deeply in the code, but i would suggest to convert the json array to string then re parse it to array object.


text:
Q: Can't submit Mac app via xcode4 - Invalid Signature I keep getting this error:
Invalid Signature - This error occurs when you have signed your app's installer incorrectly. There are two certs required for this process: the "3rd Party Mac Developer Application" cert and the "3rd Party Mac Developer Installer" cert. When signing your package, you need to ensure that you are using the Installer cert to sign your package. Ensure that you are specifying this cert when submitting your app via the Xcode Organizer or when running productbuild from the command line.
I've googled, and have followed instructions but to no avail.
I have:
Projects > targets > build > code signing > 3rd Party Mac Developer Application:
Then when I go to archive and it opens up Organizer I go to submit I select the '3rd Party Mac Installer' key. But it still fails :(
Do I need to do anything else? Like clean and then build first? (Build for what? Or just select build? - Although I've tried pretty much all of them first, and then archive).
If it's of relevance I am using MacRuby, and had to do this first to set it up for xcode deployment: http://redwoodapp.posterous.com/macruby-and-xcode-4-build-a-self-contained-ma
Any help appreciated - I'm tearing my hair out here :(

A: I had the same problem lately. And this is a perfect chance to write down and share my own notes. :)
I am assuming you are using Xcode and Organizer (not application uploader)
Step 1: Check Keychain Access.app.
You have to have two certificates (That you download from mac dev center). Each of these has to be linked with a private key.
In the picture, I have only one certificate "nacho4..." linked with a private key "nac...".  So I should go to the mac dev center and download my certificates in order to continue. Download them and drag them into the "login".

Step 2: Make sure you can build your app with the right configuration.
In my case, I setup three configurations.
Debug: can debug + no signing (for development)
Release: cannot debug  + no signing (mainly for internal betas, etc)
Distribution: cannot debug  + signing (for app store distribution)
Go to project "build info">"build signing">
Make sure that you are signing you code with the correct sign identity. Something like: "3rd Party Mac Developer Application. My Company Inc."
*If you can't see this then it means something wrong is with your certificates in Keychain Access.app. Check your certificate is linked with a private key

Step 3 Make sure you are building the right configuration.
(Yeah, kind of obvious but it happened to me the last time. This is the reason you could be getting "Invalid signature") In the "Edit Scheme" panel , make sure you have the right configuration in the "Archive" section. In my case is "Distribution" (The default is "Release ")

Note that if you don't do this correctly you will get be able to submit your binary to Apple but minutes later you will get an "Invalid Signature". Because the certificates are fine but the app is not signed.
Step 4: Build you app and submit it
Xcode>Product>Archive

The organizer will appear. Now just submit it.
I have found that validating the archive is useless because sometimes even the validation fails I am able to submit my app without errors. I read this from other threads too so not only me. So if you are sure this is the version you want to submit to Apple. just press the submit button.
You are asked your username and password.
Then, you get another menu to select the application (With has only one option, at least in my case) and then select the signing identity I think.
This is important! Make sure "3rd Party Mac Developer Installer" is selected and everything should work.

If you can't see "3rd Party Mac Developer Installer" option in the last menu then it means something is missing in your keychain. (The Installer certificate from the mac dev center)
Note that if you don't do this correctly you will be able to submit your binary but minutes later you will get an "Invalid signature" mail from iTunes Connect because the app probably could be well signed but the certificates Apple will se are incorrect.
I hope it helps.

A: The other two answers are good checklists, but it didn't work for me.
My problem was that I had installed Xcode 3.2.6 on Lion (it doesn't work anyway, but that's another story). This corrupted the productutil app.
To fix it: install the BSD.pkg in the Packages folder of your Lion Installer.
Thanks to Jacob Gorban to share his solution on Apple Devs Forums.

A: Think this is finally sorted - thanks to Daniel from the MacRuby mailing list. I actually ended up creating a ticket with Apple, but hopefully they won't charge me for it now it's been fixed without them.
You can view the solution here: http://astonj.com/uncategorized/invalid-signature-error-on-submitting-app-to-the-mac-app-store/


text:
Q: Changing the default TableViewCell to custom subclass on button click In a specific row I apply the default UITableViewCell class with a text label and an accessory button. When the accessory button is clicked, the cell is expanded and I want to change the UITableViewCell to a custom subclass I have created. However even if the cell is expanded, it won't switch to the custom subclass. Any ideas what to fix?
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    CGFloat result;

    switch ([indexPath row])
    {

        case 2:
        {

            if ([indexPath isEqual:expandedRow]) {
                return 100;

            } else {

            return 42;
        }

    }
    return result;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

NSString *CellIdentifier;
NSString *CellIdentifierexp;

UITableViewCell *cell;
    if (cell == nil) {
      if (indexPath.row == 2) {

            if ([indexPath isEqual:expandedRow]) {

                cell = [[ExpandedCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifierexp];

}else{

            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault  reuseIdentifier:CellIdentifier];
            }

switch ([indexPath row])
    {
      case 2:
        {

            if ([indexPath isEqual:expandedRow]) {

                NSLog(@"bike");

           ExpandedCell *expandedcell = (ExpandedCell *)cell;

                [expandedcell.text setText:self.descr];

                NSArray *indexPathArray=[NSArray arrayWithObject:indexPath];
                [self.tableview reloadRowsAtIndexPaths:indexPathArray withRowAnimation:UITableViewRowAnimationNone];

                   } else {

                       cell.textLabel.text = @"Description";
                       cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
                       cell.selectionStyle = UITableViewCellSelectionStyleNone;
                       cell.textLabel.textColor = UIColorFromRGB(0x2d5b3b);

                       // accessory type image

                       UIImage *image = [UIImage imageNamed:@"greenarrow.jpg"]; //or wherever you take your image from

                       UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(0,0, image.size.width, image.size.height)];

                       [button setBackgroundImage:image forState:UIControlStateNormal];

                       [button addTarget:self action:@selector(accessoryButtonTapped:withEvent:) forControlEvents:UIControlEventTouchDown];

                       button.userInteractionEnabled = YES;
                       cell.accessoryView = button;

                   }

            break;

        }

return cell;

}

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {

    switch ([indexPath row])
    {
        case 2:
            {
                 NSLog(@"Detail Disclosure Tapped");

                expandedRow = indexPath;
                [tableview beginUpdates];
                [tableview endUpdates];

            }

    }
}

- (void) accessoryButtonTapped: (UIControl *) button withEvent: (UIEvent *) event
{

    NSIndexPath * indexPath = [self.tableview indexPathForRowAtPoint: [[[event touchesForView: button] anyObject] locationInView: tableview]];

    if ( indexPath == nil )
        return;

    [self.tableview.delegate tableView: self.tableview accessoryButtonTappedForRowWithIndexPath: indexPath];
}

A: Wow, you're doing something terribly wrong in here:
ExpandedCell *expandedcell = (ExpandedCell *)cell;

[expandedcell.text setText:self.descr];

NSArray *indexPathArray=[NSArray arrayWithObject:indexPath];
[self.tableview reloadRowsAtIndexPaths:indexPathArray withRowAnimation:UITableViewRowAnimationNone];

What you should do is slightly different. On a button tap you just call the [self.tableview reloadRowsAtIndexPaths:indexPathArray withRowAnimation:UITableViewRowAnimationNone]; then in the cellForRowAtIndexPath you should return the custom cell of your subclass in the method if the indexPath matches. No need to update the tableView there.
And need I say that this looks like a very very strange switch statement to me:
switch ([indexPath row])
{
    case 2:
        {
             NSLog(@"Detail Disclosure Tapped");

            expandedRow = indexPath;
            [tableview beginUpdates];
            [tableview endUpdates];
        }
}

I would simply put it like this:
if (indexPath.row == 2){
      NSLog(@"Detail Disclosure Tapped");

      expandedRow = indexPath;
      [tableview beginUpdates];
      [self.tableview reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
      [tableview endUpdates];
}

A: Running the code
expandedRow = indexPath;
[tableview beginUpdates];
[tableview endUpdates];

when the accessory button is tapped will only ask the table view to update the row heights, it won't actually request a new cell for any row, so no cell type change will happen (until you scroll the row off screen and then back on again).
So, you need to actually reload the selected row, not just begin and end updates.

A: this here...
UITableViewCell *cell;
    if (cell == nil) {

Local vars dont init to nil , they start as garbage, maybe nil , maybe not.
Either way you probably are not making it into the branch.
You are going to want to dequeue a cell from the table depending on whether its an expanded row or not
UITableViewCell *cell = nil;
if(thisIsAnExpandedRow) {
    cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierexp];
    if(!cell) {
       cell = [[ExpandedCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifierexp];
    }

}
else {
     cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if(!cell) {
       cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault  reuseIdentifier:CellIdentifier];

    }
}


text:
Q: How do i do an SELECT in an INSERT? I want to do something like this
INSERT INTO link_list(link, status, hash_type, hash_id)
VALUES(@link, @status, @hash_type, @hash_id);
INSERT INTO active_dl(fileId, orderNo)
VALUES(last_insert_rowid(), SELECT COUNT(*) FROM active_dl);

But obviously it is wrong and theres a syntax error on select. How do i write this? Using sqlite.

A: Put the SELECT query in brackets parenthesis.
Like so:
INSERT INTO active_dl(fileId, orderNo)
VALUES(last_insert_rowid(), (SELECT COUNT(*) FROM active_dl));

A: Why don't you try:
DECLARE @var INT
SET @var = (Select Count(*) from active_dl)

INSERT INTO active_dl(fileId, orderNo)
VALUES(last_insert_rowid(), @var);

A: have you tried maybe:
...
VALUES(last_insert_rowid(), (SELECT COUNT(*) FROM active_dl)); <--- with parens

I don't claim to know sqlite, but maybe this could help

A: I believe standard SQL lets you use either values or select for an insert, so I'd be looking at:
insert into active_dl(fileId, orderNo)
    select last_insert_rowid(), COUNT(*) FROM active_dl;

Whether SQLite allows this I don't know for sure, hence the community wiki.


text:
Q: Force app update through market, as if user clicks "Update" I would like to know, if there is some kind of "Intent" or something, to force the market to update a user-installed app programmatically. Personally, I assume this is a security risk, so I would guess there is no way, but maybe someone knows a workaround.

A: I've had an app, post its version to a server and if didn't match the current version listed on the server, fires an intent that takes the user right to the market - can either allow them to cancel and continue, or stop them from using the app until they upgrade.  I think it stopped them by bringing up a webview fullscreen to the market url and they can't hide it to access the app.


text:
Q: jquery validation plugin not working in modalbox i am trying to validate fields in modalbox however its not working below is my validation code
$("#formapplication").validate({
rules: {
        tb_name:{ required: true },
        tb_url: {required: true},
        tb_tag: {required: true},
        tb_desc: {required: true},
        tb_catg: {required: true}
        },
messages:{
        tb_name:{ required: "Please Enter Full name" },
        tb_url: {required: "Please Enter URL"},
        tb_tag: {required: "Please Enter Tag."},
        tb_desc: {required: "Please Enter Description."},
        tb_catg: {required: "Please Select Category."}
        }
    });

jquery validation plugin support modalbox but its simple html i write on same page not calling using ajax any idea pelase help.
below is xhtml

<form action="" id="formapplication" name="formapplication" method="post">

Name<input type="text" name="tb_name" id="tb_name" />
Url<input type="text" name="tb_url" id="tb_url" />
Tags<input type="text" name="tb_tag" id="tb_tag" />
Category<select name="select" id="tb_catg">
  <option value=""></option>
  </select>
Description
<textarea cols="" rows="" name="tb_desc" id="tb_desc" ></textarea>

Name<input type="text" name="tb_twaccount" id="tb_twaccount" />

<input type="button" id="submitapp" value="Submit Application" />

A: i was missting class required on all my inputs that i am using for validation
<input type="text" id="tb_name" class="required" />

A: Ah, first off, add a # to your form action so it's form action="#". The # doesn't fix it, but I have run into IE issues before without a hash in forms.
Also, try adding a line underneath your validation:
$("#formapplication").valid();

A: *

*First, as Seb said, you need quotes around your field names.

*Second, as I understand the rules and messages hashes from the documentation, you need to refer to elements by the the name attribute, not the id attribute. So instead of
"tb_catg": {required: true} I think you want "select": {required: true} since your HTML says <select name="select" id="tb_catg">


text:
Q: VB.NET - is there a way to programmatically create a scheduler just to call a certain url/api? I have looked everywhere but I cant really find what I wanted. Here is the scenario. I have a web application, when a user clicks a button, it will send api request to the vendor to activate a device. The problem is, the vendor does not have the api method to set start and end time for the device. So, my idea now is, once i get the "green light" from the vendor to activate the machine, i will also programmatically schedule a task in the server to call my web application after 15 minutes to turn off the device (by url with query string, www.xxxx.aspx?deviceid=123).
really appreciate the help or any pointers on how to achieve this. thanks in advance!

A: Sorry about the way answer is typed i am on phone right now. it was fun researching for it and i would like to hear from you if it works
So assuming you have access to your api.
The way i think you can make it work is by using a backgroundworker in your api / web application it is a nuget you download to your web application
If you open and  scroll in that link it has example talking about having background task similar to windows task schedular however for any type of webapplication it is open source project called backgroundworker and many task schedulers you can add on web application  give it a try
https://www.hanselman.com/blog/HowToRunBackgroundTasksInASPNET.aspx


text:
Q: How to divide JFrame area into many areas without JPanel? I am working on a little Java Swing application by using JFrame. As per requirement I have to divide JFrame area into many sub areas.
I found in Using two JPanels in one JFrame that I can do it by using a JPanel inside my JFrame, but I don't have to use JPanel.
Have you any idea how I can divide the JFrame area into many sub area without using JPanel?

A: When you add something to a frame (JFrame), you actually add to his content pane, which is actually a container (JPanel is also a generic lightweight container).
The preferred way to "divide a JFrame" is to actually "divide" a JPanel and then set that panel as content pane of the frame. Something like this:
JPanel panel = new JPanel();

// ...
// layout panel, add components, etc...
// ...

frame.setContentPane(panel);

But if you really want to divide/split/layout a JFrame without creating a new container (a JPanel for example) this is the way:
frame.getContentPane().setLayout(new BorderLayout());
frame.getContentPane().add(new JLabel("Left"), BorderLayout.WEST);
frame.getContentPane().add(new JLabel("Center"), BorderLayout.CENTER);

This is a fully working test class:
import javax.swing.JButton;
import javax.swing.JFrame;

public class Test {

    public static void main(String[] args) {

        JFrame frame = new JFrame();

        frame.getContentPane().setLayout(new BorderLayout());
        frame.getContentPane().add(new JButton("Left"), BorderLayout.WEST);
        frame.getContentPane().add(new JButton("Center"), BorderLayout.CENTER);

        frame.setSize(400, 300);
        frame.setVisible(true);
    }
}


text:
Q: Setting up port redirection on Windows Server 2012 in Amazon ec2 I have a couple of servers in amazon EC2

*

*One server is a Windows Server 2012, is used to host a web application, there is an elastic ip address attached to this server.

*The second server is a linux server, to host the database, this server do not have a public ip address, this database server only listen using private network interface.

I need to expose the database server through web server, I mean, I like to connect to a particular port in windows server and create a port forwarding to reach linux server.
I tried to use this command:
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=4638
connectaddress=172.30.10.70 connectport=3306

Locally, in windows server, I cant connect to mysql server using the windows server private address and port 4638, I can run queries without problems.
The problem is when I try to connect using the attached elastic ip address, I cannot reach mysql server, the port 4638 is opened in the Windows server security group.
Thanks for your help.

A: Have you disabled IPv6?
http://support.microsoft.com/kb/555744
If yes, re installing it might work.
Try running wireshark on Win server to see what happens with those packets.


text:
Q: git: no mergetool available I intend to set winmerge as my merge tool together with GitHubDesktop. Before I implement https://gist.github.com/shawndumas/6158524, out of curiosity, I tried to run git mergetool -- tool-help. I get "The following tools are valid, but not currently available." Referring to the git documentation (https://www.git-scm.com/docs/git-mergetool), I understand that, at this point, no conflict resolution will happen if any after the merge. Am I correct?
Thanks

A: about your question that received in my opinion no (correct) answer:

Referring to the git documentation (https://www.git-scm.com/docs/git-mergetool), I understand that, at this point, no conflict resolution will happen if any after the merge. Am I correct?

git does not try to resolve automatically conflict using mergetools, these tools are just to solve manually (but with a GUI) the ones that git was not able to solve.
So even if you didn't configure winmerge, when you execute   git merge , git tries to resolve conflicts with its internal conflict resolution algorithms.
If the differences between the versions to merge are in different files or in different hunks of a same file, git solve them, otherwise git marks the conflict zones with <<< === >>>.
A mergetool just presents you a way to tell how to solve these remaining conflicts.

A: You need to configure git to look for the proper tool:
git config --global merge.tool winmerge

If the application can not be automagically located, you might need to specify the exact path to the binary
git config --global mergetool.winmerge.path C:/Program\ Files/Winmerge/path/to/binary.exe

Then try again.


text:
Q: Displaying Mathematica expressions in plain text I'm trying to export expressions in plain text format, so they can be displayed in a reasonably orderly way (.txt file). Trying:
 ToString[a^c/b]

yields something like:
 c
a
--
b

and it does the job. However, when I try to display  $\underset{b}{\stackrel{c}{\sum}}{a}$:
ToString[Defer[Sum[a, {b, c}]], TraditionalForm] // ToString

I get an Output that seems ok, until I paste it to a text editor, when I get:
c
\[Sum] a
b

Is there a way to overcome this?


text:
Q: Route53 w/ S3 - DNS issues for www. (bucket is on naked domain) I'm currently using a naked domain to A alias to Amazon's S3 web hosting service (new feature connection between Route53 and S3), but I'm having some trouble getting the www. to redirect/display the bucket. I've tried:
Using CNAME for www. -> naked and *. -> naked (the normal way)
Using CNAME Alias to the bucket
Using CNAME Alias to the naked domain (in the same zone)
Using A to alias to the bucket
Using A to alias to the naked domain (in the same zone)
Every result is either a 404 or trying to find the bucket for www.mydomain.com, which obviously doesn't exist. I quite possibly could have been overanxious and stumbled across the right one but didn't wait long enough for it, but I've been doing this over the past few hours so I think it should have went through considering I keep clearing my DNS. The normal way of using the CNAME approach gave me the www.mydomain.com bucket error. Also I'm not quite sure exactly what this "Alias" thing is all about. What is the correct method?

A: Did you use the instructions found on the Amazon Web Services Blog - Root Domain Website Hosting for Amazon S3?
BTW, you don't specifically need to be using Route53 to use naked domain redirects, some DNS registrars like GoDaddy even provide domain redirection to root domains.
And you can always use a service like wwwizer's free naked domain redirect, which will accomplish this very easily.
But if you still want to use the new capability for this built into AWS, read on.

I'll assume you already have a CNAME record in your site's Route53 hosted zone site similar to the following:
NAME                   TYPE    VALUE
www.mydomainname.com   CNAME   www.mydomainname.com.s3-website-us-east-1.amazonaws.com

And I'm also assuming that the record points to an endpoint for a bucket named www.mydomainname.com and is configured to serve a static site.
You also need to create another bucket that is mydomainname.com without the www, and configure the option "Redirect all requests to another hostname" to forward requests to your other bucket which contains your resources.
Now go back to your Route53 hosted zone, create an A Record, mark it as ALIAS, and a dropdown will appear that lets you choose the S3 endpoint for your naked domain's bucket.
I have this setup working on my own servers, so hopefully you shouldn't need any special steps.


text:
Q: create file object using file path instead of input file form most if not all Forge samples used input file form to get input file like below:
$("#inputFile").change(function () {
_fileInputForm = this;
if (_fileInputForm.files.length === 0) return;
var file = _fileInputForm.files[0];

}
what if i want to achieve the same result without UI at all? something like below:
const data = {
    ModelId: "dXJuOmFkc2sud2lwcHJvZDpmcy5maWxlOnZmLjNSTzhMWmtUVGVHM3p1M1FoNjRGM3c_dmVyc2lvbj0x",
    ElementId: [{ UniqueId: "ca5762b5-0f46-4a2f-8599-1d1a5dd19a81-00024b8c" }],
};
var file = new File([data], "whatever.json", { type: "application/json" });

data is manually copied from whatever.json, how to do it via code? thanks


text:
Q: how do i create a html table with scrolling I have a large html table(over 3000 elements), but obviously i dont want to display all of it at once. Some of the table will be displayed but most of it will all be contained in a small box that has scrolling. I wanted a table similar to the one that this site uses:stackoverflow search table.I tried doing something similar my code doesnt work: here is a sample table:

.table {
  height: 150px;
  overflow-y: scroll;
  overflow-x: hidden;
}

    Name
    Country

    Alfreds Futterkiste
    Germany

    Berglunds snabbkop
    Sweden

    Island Trading
    UK

    Koniglich Essen
    Germany

    Alfreds Futterkiste
    Germany

A scroller never appears at the side of the table. I'm relatively new to HTML

A:
 elements do not respect the overflow property. Force the overflow property by setting the table to block:

.table {
  display: block;
  height: 150px;
  overflow-y: scroll;
  overflow-x: hidden;
}

    Name
    Country

    Alfreds Futterkiste
    Germany

    Berglunds snabbkop
    Sweden

    Island Trading
    UK

    Koniglich Essen
    Germany

    Alfreds Futterkiste
    Germany

With a table that big you would benefit from the extras that https://datatables.net/ could bring :)

A: Put it inside a div container.
.container {
  border: 1px solid #C0C0C0;
  overflow-y: scroll;
  overflow-x: hidden;
  height: 100px;
}

    ...

https://codepen.io/anon/pen/NpmPOy

A: Try wrapping your table in a div tag, applying the class to that div. In order to make the scroll bar actually appear, you'll also need to decrease the height of your table a bit, given the number of entries you have in the table:

.table {
  height: 100px;
  overflow-y: scroll;
  overflow-x: hidden;
}

        Name
        Country

        Alfreds Futterkiste
        Germany

        Berglunds snabbkop
        Sweden

        Island Trading
        UK

        Koniglich Essen
        Germany

        Alfreds Futterkiste
        Germany


text:
Q: Initial velocity of particles in a 2D gravity simulation In $N$-body simulations of protostellar clouds (or similar objects), each particle is has a set of characteristics: mass, size, position, velocity, and (if the object is large enough or if we want to be really precise) a temperature profile (assume the composition of the particle doesn't matter). Mass, size (for collisions) and position are assigned at random since the distributions of the first two characteristics are unknown in real systems.
However, there are a few ways that the velocity vector could possibly be set initially; I am wondering which is would be the most accurate. Since velocity is the key to what shape the orbit will be, I figure this is the most important initial condition.
1. Random Method
Like mass, size and position, we randomly assign a velocity vector to each particle.
2. Energy Theorem Method
Given that the protostellar cloud has a temperature profile $T(\vec{r})$:
$$\dfrac{1}{2}m|\vec{v}|^2 = \dfrac{3}{2}kT(\vec{r}) \rightarrow |\vec{v}|(\vec{r}) = \sqrt{\dfrac{3kT(\vec{r})}{m}}$$
to which it can be expressed in vector form going radially as:
$$\vec{v}(\vec{r}) = \sqrt{\dfrac{3kT(\vec{r})}{m}}\langle\hat{r}, \hat{\theta}\rangle$$.
So my question is: In the long run, will either of these methods be advantageous over the other? Or will the system eventually settle down into a relatively stable configuration either way?

A: If you randomly assign velocities independently of distance from centre of mass, the simulation will take much longer to settle down to a near-stable configuration.  The outer particles which are moving outward will have relatively high kinetic energy, so the configuration will expand further from the CoM, leading to weaker interactions and fewer collisions, requiring a much longer simulation time for anything interesting to 'evolve'.
If you assign a radial distribution of velocities which decreases with distance from the CoM, the outer particles which are moving outward have less kinetic energy, so the configuration will not expand so much.  This is far more likely to give you a compact configuration in which particle interactions are stronger and collisions more frequent, so the simulation evolves more rapidly.


text:
Q: Javascript Click button works in Chrome, but not in IE Please check the Javascript code to see why it works fine in Chrome, but not in IE11.
When I click the button to create a textbox, the textbox is created in Chrome, but not in IE11.
When I click on the button, it creates textboxes vertically. Please also let me know how to create space between each textbox.
<script type="text/javascript">
    var counter = 0;
    function addNew() {
        // Get the main Div in which all the other divs will be added
        var mainContainer = document.getElementById('mainContainer');
        //mainContainer.style.left = '500px';
        // Create a new div for holding text and button input elements
        var newDiv = document.createElement('div');
        // Create a new text input
        var newText = document.createElement('input');
        newText.type = "input";
        //newText.value = counter;
        newText.name = "choiceEntry";
        newText.style.height = '40px';

        newText.size = "100";
        // Create a new button input
        var newDelButton = document.createElement('input');
        newDelButton.type = "button";
        newDelButton.value = "Delete";

        // Append new text input to the newDiv
        newDiv.appendChild(newText);
        // Append new button input to the newDiv
        newDiv.appendChild(newDelButton);
        // Append newDiv input to the mainContainer div
        mainContainer.appendChild(newDiv);
        counter++;

        // Add a handler to button for deleting the newDiv from the mainContainer
        newDelButton.onclick = function() {
            mainContainer.removeChild(newDiv);
        }
    }
</script>

In JSP button:
<div>
    <input type="text" class="bigText" value="<%=choice.getChoiceEntry()%>" size="100" name="choiceEntry" />
    <input type="button" value="Add" onClick="addNew()">
</div>

Thanks in advance


text:
Q: Batch downloading available pages in Google books? I am using Google Book Downloader addon to Firefox. It generates links to individual image per available page, but if I would like to download multiple pages' images using selecting the links and right-clicking "DownloadThemAll! Selection..." in Firefox, I will be notified that that the image files all have the same name "books".
The links generated by Google Book Downloader addon are shown under different text names based on their page numbers. So I wonder if there is a way to batch download the image files with their names automatically changed to their page numbers, and therefore resolving the same name conflict.
PS:

*

*My operating system is Ubuntu.

*The source code of the Google Book Downloader addon is
here.


text:
Q: Paypal Express Checkout Shipping Callback We have sent the following question to PayPal's technical support and still no news after 2 weeks. I hope someone here can help us :)
We are currently trying to make PayPal Express Checkout work with Magento.
Our shipping callback script is being called.
If the script sends backs the following response (UPS options only), everything works as expected in PayPal:
L_SHIPPINGOPTIONISDEFAULT0=true&L_SHIPPINGOPTIONAMOUNT0=19.03&L_SHIPPINGOPTIONLABEL0=ups_11&L_SHIPPINGOPTIONNAME0=United+Parcel+Service+-+UPS+Standard&L_TAXAMT0=5.98&L_SHIPPINGOPTIONISDEFAULT1=false&L_SHIPPINGOPTIONAMOUNT1=23.42&L_SHIPPINGOPTIONLABEL1=ups_13&L_SHIPPINGOPTIONNAME1=United+Parcel+Service+-+UPS+Next+Day+Air+Saver&L_TAXAMT1=5.98&L_SHIPPINGOPTIONISDEFAULT2=false&L_SHIPPINGOPTIONAMOUNT2=28.07&L_SHIPPINGOPTIONLABEL2=ups_01&L_SHIPPINGOPTIONNAME2=United+Parcel+Service+-+UPS+Express&L_TAXAMT2=5.98&METHOD=CallbackResponse

But if we send this response (UPS and rpc for Canada Post) options, PayPal simply ignores our response and displays no shipping options:
L_SHIPPINGOPTIONISDEFAULT0=true&L_SHIPPINGOPTIONAMOUNT0=6.08&L_SHIPPINGOPTIONLABEL0=rcp_1020&L_SHIPPINGOPTIONNAME0=Canada+Post+-+Expedited&L_TAXAMT0=5.19&L_SHIPPINGOPTIONISDEFAULT1=false&L_SHIPPINGOPTIONAMOUNT1=14.74&L_SHIPPINGOPTIONLABEL1=rcp_1040&L_SHIPPINGOPTIONNAME1=Canada+Post+-+Priority&L_TAXAMT1=5.19&L_SHIPPINGOPTIONISDEFAULT2=false&L_SHIPPINGOPTIONAMOUNT2=19.33&L_SHIPPINGOPTIONLABEL2=ups_11&L_SHIPPINGOPTIONNAME2=United+Parcel+Service+-+UPS+Standard&L_TAXAMT2=5.19&L_SHIPPINGOPTIONISDEFAULT3=false&L_SHIPPINGOPTIONAMOUNT3=25.10&L_SHIPPINGOPTIONLABEL3=ups_13&L_SHIPPINGOPTIONNAME3=United+Parcel+Service+-+UPS+Next+Day+Air+Saver&L_TAXAMT3=5.19&L_SHIPPINGOPTIONISDEFAULT4=false&L_SHIPPINGOPTIONAMOUNT4=28.21&L_SHIPPINGOPTIONLABEL4=ups_01&L_SHIPPINGOPTIONNAME4=United+Parcel+Service+-+UPS+Express&L_TAXAMT4=5.19&METHOD=CallbackResponse

Here is the SetExpressCheckout options that is being sent:
[PAYMENTACTION] => Sale
            [AMT] => 39.95
            [CURRENCYCODE] => USD
            [RETURNURL] => {domain url}/paypal/express/return/
            [CANCELURL] => {domain url}/paypal/express/cancel/
            [INVNUM] => 100000009
            [SOLUTIONTYPE] => Sole
            [GIROPAYCANCELURL] => {domain url}/paypal/express/cancel/
            [GIROPAYSUCCESSURL] => {domain url}/checkout/onepage/success/
            [BANKTXNPENDINGURL] => {domain url}/checkout/onepage/success/
            [LOCALECODE] => en_US
            [ITEMAMT] => 39.95
            [TAXAMT] => 0.00
            [SHIPPINGAMT] => 0.00
            [L_NUMBER0] => ABCDEF
            [L_NAME0] => ABCDEF Name
            [L_QTY0] => 1
            [L_AMT0] => 39.95
            [CALLBACK] => {domain url}/paypal/express/shippingOptionsCallback/quote_id/309/
            [CALLBACKTIMEOUT] => 6
            [MAXAMT] => 1038.95
            [L_SHIPPINGOPTIONISDEFAULT0] => true
            [L_SHIPPINGOPTIONAMOUNT0] => 0.00
            [L_SHIPPINGOPTIONLABEL0] => no_rate
            [L_SHIPPINGOPTIONNAME0] => N/A
            [L_TAXAMT0] =>
            [METHOD] => SetExpressCheckout
            [VERSION] => 72.0
            [USER] => ****
            [PWD] => ****
            [SIGNATURE] => ****
            [BUTTONSOURCE] => Varien_Cart_EC_CA

We cannot figure out why PayPal is rejecting our shipping options?
Thanks in advance,


text:
Q: Is there a difference between 'FETCH' and 'FETCH FIRST'? I currently am preparing for an Oracle SQL exam. I have some test exams to try. One question was as follows:
Which query will generate the required result?
There were two of the possible answers, I picked the top one. But the answer should have been the bottom one according to the exam.
SELECT employee_id, last_name, salary
FROM employees
ORDER BY salary DESC
FETCH FIRST 5 PERCENT ROWS ONLY;

SELECT employee_id, last_name, salary
FROM employees
ORDER BY salary DESC
FETCH 5 PERCENT ROWS ONLY;

Now I wanted to find out what the difference between 'FETCH' and 'FETCH FIRST' is, but so far I had no luck googling it, I only find pages that talk about 'FETCH FIRST' in combination with 'FETCH NEXT' and so on. But no luck so far in what I'm looking for.
Can anyone explain to me what the difference between 'FETCH' and 'FETCH FIRST' is? And if both are correct, why would the exam prefer 'FETCH' over 'FETCH FIRST'?
Thanks in advance!

A: Sometimes it's better to try things out before you ask.
SQL>     with basis as (select level l,100 - level lm from dual connect by level <=100)
  2      select l, lm from basis order by lm fetch first 5 percent rows only;

         L         LM
---------- ----------
   100          0
    99          1
    98          2
    97          3
    96          4

So the first statement works.
Second one:
SQL>     with basis as (select level l,  100 - level lm from dual connect by level <=100)
  2      select l, lm from basis order by lm fetch  5 percent rows only;

Error starting at line : 6 in command -
    with basis as (select level l,  100 - level lm from dual connect by level <=100)
    select l, lm from basis order by lm fetch  5 percent rows only
Error at Command Line : 7 Column : 48
Error report -
SQL Error: ORA-00905: missing keyword
00905. 00000 -  "missing keyword"
*Cause:
*Action:

So error message points out that after fetch something is missing.
Or as pointed out by a_horse. Read the manual.

A: Your exam is wrong, the correct query is the top one.
The FETCH statement is a PL/SQL statement that is used to retrieve rows of data from the result set of a multi-row query, and as such, cannot be used in a SQL query :
https://docs.oracle.com/cd/B12037_01/appdev.101/b10807/13_elems020.htm
The FETCH (NEXT | FIRST) statement is used in queries to retrieve only a certain number or rows from a result : https://docs.oracle.com/javadb/10.8.3.0/ref/rrefsqljoffsetfetch.html

A: The SELECT Oracle documentation contains the syntax for the row limiting clause:

From this, the OFFSET and FETCH clauses are each optional; however if the FETCH clause is included then it must be immediately followed by the FIRST or NEXT keyword.
Thus the second query:
SELECT employee_id, last_name, salary
FROM employees
ORDER BY salary DESC
FETCH 5 PERCENT ROWS ONLY;

Is not syntactically correct as it is missing the FIRST (or NEXT) keyword.