text:
Q: Validating multiple text boxes in single JavaScript Function
i have 7 textbox and i want to validate as Required field OnClientClick
  click of a button named as Update
  so is there any way i could do it using Javascript
  i have tried this code but it's not working as one of them
  ps: i am new to JS

   function fnCheck(val) {
            var v = val.id.split('_')[1];
            var merter = document.getElementById('GridSubMeter_' + v + '_txtMeterIdn').value.trim();
            var Billper = document.getElementById('GridSubMeter_' + v + '_txBillPer').value.trim()
            var Endkwh = document.getElementById('GridSubMeter_' + v + '_txEndKwh').value.trim();
            var startkwh = document.getElementById('GridSubMeter_' + v + '_txStartKwh').value.trim();
            var ReadEndDate = document.getElementById('GridSubMeter_' + v + '_txReadEndDate').value.trim();
            var ReadStartDate = document.getElementById('GridSubMeter_' + v + '_txReadStartDate').value.trim();
            var CTFACT = document.getElementById('GridSubMeter_' + v + '_txCTFact').value.trim();
            if (merter != '') {
                return true;
            }
            else {
                alert("Meter Identifier is Required Field");
            return false;
        }

        if (Billper != '') {
            return true;
        }
        else {
            alert("Bill Period is Required Field");
            return false;
        }

        if (Endkwh != '') {
            return true;
        }
        else {
            alert("EndKwh is Required Field");
            return false;
        }
        if (startkwh != '') {
            return true;
        }
        else {
            alert("StartKwh is Required Field");
            return false;
        }
        if (ReadEndDate != '') {
            return true;
        }
        else {
            alert("Read EndDate is Required Field");
            return false;
        }

        if (ReadStartDate != '') {
            return true;
        }
        else {
            alert("Read StartDate is Required Field");
            return false;
        }
        if (CTFACT != '') {
            return true;
        }
        else
        { alert("CT Factor is Required Field");
        return false;
        }
        }
 <asp:Button ID="btn_Update" Style="background-color: #B2DE94; width: 40px"  CausesValidation="false" runat="server"  OnClientClick="fnCheck(this);" Text="Update" CommandName="Update" />

A: Try below
<asp:TemplateField HeaderText="">
      <ItemTemplate>
          <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
           <asp:RequiredFieldValidator ID="rfv" runat="server" ControlToValidate="TextBox3" ValidationGroup="gridview" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
      </ItemTemplate>
        </asp:TemplateField>
      <asp:TemplateField HeaderText="">
            <ItemTemplate>
                <asp:Button ID="Button2" runat="server" Text="Button" ValidationGroup="gridview" CausesValidation="true" />
            </ItemTemplate>
        </asp:TemplateField>

Code has been taken from here
I have verified with sample project and works for your scenario

A: Deepak,
Below is my Gridview code
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="DataKeyId" DataSourceID="SqlDataSource1" EnableModelValidation="True">
            <Columns>
                <asp:TemplateField HeaderText="">
                    <ItemTemplate>
                        <asp:Button ID="Button2" runat="server" Text="Button" ValidationGroup="gridview" CausesValidation="true" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="">
                    <ItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfv11" runat="server" ControlToValidate="TextBox1" ValidationGroup="gridview" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="">
                    <ItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfv2" runat="server" ControlToValidate="TextBox2" ValidationGroup="gridview" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfv3" runat="server" ControlToValidate="TextBox3" ValidationGroup="gridview" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="">
                    <ItemTemplate>
                        <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfv4" runat="server" ControlToValidate="TextBox4" ValidationGroup="gridview" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>

By clicking on button avail inside the GridView, below attachment error appears

A: Below is the another set of version to throw error message at row level
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="YourDataKey" DataSourceID="SqlDataSource1" EnableModelValidation="True">
            <Columns>
                <asp:TemplateField HeaderText="">
                    <ItemTemplate>
                        <asp:Button ID="Button2" runat="server" Text="Button" ValidationGroup = '<%# "Group_" + Container.DataItemIndex %>' CausesValidation="true" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="">
                    <ItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfv1" runat="server" ControlToValidate="TextBox1" ValidationGroup = '<%# "Group_" + Container.DataItemIndex %>'  ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="">
                    <ItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfv2" runat="server" ControlToValidate="TextBox2" ValidationGroup = '<%# "Group_" + Container.DataItemIndex %>'  ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfv3" runat="server" ControlToValidate="TextBox3" ValidationGroup = '<%# "Group_" + Container.DataItemIndex %>' ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="">
                    <ItemTemplate>
                        <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfv4" runat="server" ControlToValidate="TextBox4" ValidationGroup = '<%# "Group_" + Container.DataItemIndex %>' ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>

Third row button is clicked in the below attachment and second column has value. So, error appears for the rest of the controls of the row

A:

ok i have worked on my JS function and it worked for me.hope it will
    work for everyone else.in my code i have taken a variable

success which is working as a flag and i am checking it twice and
  returning true at the end so that if one of the textbox is not empty
  and other not it will not return true.
  sorry for poor editing

 function fnCheck(val) {
        var success = true;
        var v = val.id.split('_')[1];
        var merter = document.getElementById('GridSubMeter_' + v + '_txtMeterIdn').value.trim();
        var Billper = document.getElementById('GridSubMeter_' + v + '_txBillPer').value.trim()
        var Endkwh = document.getElementById('GridSubMeter_' + v + '_txEndKwh').value.trim();
        var startkwh = document.getElementById('GridSubMeter_' + v + '_txStartKwh').value.trim();
        var ReadEndDate = document.getElementById('GridSubMeter_' + v + '_txReadEndDate').value.trim();
        var ReadStartDate = document.getElementById('GridSubMeter_' + v + '_txReadStartDate').value.trim();
        var CTFACT = document.getElementById('GridSubMeter_' + v + '_txCTFact').value.trim();
        debugger;
        if (merter != '') {

        }
        else {
            alert("Meter Identifier is Required Field");
            success = false;
    }

    if (Billper != '') {

    }
    else {
        alert("Bill Period is Required Field");
        success = false;
    }

    if (Endkwh != '') {

    }
    else {
        alert("EndKwh is Required Field");
        success = false;
    }
    if (startkwh != '') {

    }
    else {
        alert("StartKwh is Required Field");
        success = false;
    }
    if (ReadEndDate != '') {

    }
    else {
        alert("Read EndDate is Required Field");
        success = false;
    }

    if (ReadStartDate != '') {

    }
    else {
        alert("Read StartDate is Required Field");
        success = false;
    }
    if (CTFACT != '') {

    }
    else
    { alert("CT Factor is Required Field");
    success = false;
}

return success;

    }

onclientclick
<asp:Button ID="btn_Update" Style="background-color: #B2DE94; width: 40px"  CausesValidation="false" runat="server"  OnClientClick="return fnCheck(this);" Text="Update" CommandName="Update" />


text:
Q: .smbdelete files accumulating on server share I manage a very modest macOS server (Late 2014 Mac Mini, Mac OS 10.12.4, Server 5.3) that supports several sharepoints for about 20 clients - a mix of macOS and Windows.  I typically have my work machine set to 'AppleShowAllFiles TRUE' so I notice that the shares are accumulating '.smbdelete...' files. These are hidden for most users, but they are getting a little annoying for me because the file listing of one share in particular is getting long.  From web searches, it looks like this has to do with macOS' handling of SMB connections to shares.
So two questions:

*

*Can these be safely deleted?

*Can the accumulation of these be halted.

A: Find:
sudo find . -name '.smbdeleteAAA*' \( -type d -exec find {} \; -prune -o -print \)

Delete:
sudo find . -type f -name '.smbdeleteAAA*' -print0 | xargs -0 rm -f

A: Spotted an answer on the Apple support forums: https://discussions.apple.com/message/30046649#message30046649

Apple introduced this behavior in OS X 10.10 you can find it in the
  source code here:
http://www.opensource.apple.com/source/smb/smb-759.40.1/kernel/smbfs/smbfs_smb.c
The comment above the code that does it is:
* We have an open file that they want to delete. Use the NFS silly rename
* trick, but try to do better than NFS. The picking of the name came from the
* NFS code. So we first open the file for deletion. Now come up with a new
* name and rename the file. Make the file hidden if we can. Now lets mark
* it for deletion and close the file. If the rename fails then the whole call
* should fail. If the mark for deletion call fails just set a flag on the
* vnode and delete it when we close.

Other googling implies that these are held while 'someone' has an open file handler and are cleaned up automatically later.

redpajama_set_name: RedPajamaStackExchange


text:
Q: JSON not returned from yarn REST API I'm calling the yarn REST API in order to discover information about jobs.I can hit http://server:8088/ws/v1/cluster/apps in Postman and get a list of applications in JSON:

Great. I now want to get information about each individual application. According to  Hadoop YARN - Introduction to the web services REST API's the call is:

but when I try pasting that URL (well, the equivalent for my server & application) into my browser I'm sent to this:

I wanted a JSON document as per the docs above but I'm not getting it.
As per the docs I try using curl but get nothing:

Tried using PowerShell instead:

As you can see it returned HTML, not JSON. To confirm, here's the same in Postman:

Here's information about the cluster via a call to http://server:8088/ws/v1/cluster

I need it to return JSON. Any suggestions? TIA.

A: If the application is in a FINISHED state, you will need to send your request to the history server in order to get a JSON response, otherwise you will get an HTML response. If the application is in a RUNNING state, you need to send your request directly to the MapReduce application master that is running.

Getting list of jobs for an application in FINISHED state:

curl --compressed -X GET "http://host.domain.com:19888/ws/v1/history/mapreduce/jobs"

Getting list of jobs for an application in RUNNING state:

curl --compressed -X GET "http://host.domain.com:8088/proxy/{app_id}/ws/v1/mapreduce/jobs"

The default port for the history server is 19888 and the endpoint is /ws/v1/history

References:
Intro to YARN REST APIs
YARN History Server Rest API


text:
Q: Count HQL result where GROUP BY is used I have an hql query where I need to group them in some way. So this query looks almost like this:
SELECT a1,a2,a3
FROM tablename
GROUP BY a1,a2,a3;

I want to count result of this query but without using subquery (as far as I know HQL can't select from subquery):
/* I don't want to do it in this way because of HQL */
SELECT count(*) FROM (
    SELECT a1,a2,a3
    FROM tablename
    GROUP BY a1,a2,a3
);

So is there some way to count grouped result without subquery?


text:
Q: Using PHP to alter XML File I have the following XML file:
<graph caption="Share Data Wave" subcaption="For Person's Name" xAxisName="Time"  yAxisMinValue="-0.025" yAxisName="Voltage" decimalPrecision="5" formatNumberScale="0" numberPrefix="" showNames="1" showValues="0" showAlternateHGridColor="1" AlternateHGridColor="ff5904" divLineColor="ff5904" divLineAlpha="20" alternateHGridAlpha="5">
     <set name="2010-08-27 12:00:20.636" value="25.020000" hoverText = "The difference from last value: 0" ></set>
     <set name="2010-08-27 12:01:19.473" value="15.000000" hoverText = "The difference from last value: -10.02" ></set>
     <set name="2010-08-27 12:01:24.494" value="15.020000" hoverText = "The difference from last value: 0.0199999999999996" ></set>
     <set name="2010-08-27 12:01:44.188" value="18.250000" hoverText = "The difference from last value: 3.23" ></set>
     <set name="2010-08-27 12:02:11.851" value="18.540000" hoverText = "The difference from last value: 0.289999999999999" ></set>
     <set name="2010-08-27 12:02:47.109" value="16.520000" hoverText = "The difference from last value: -2.02" ></set>
     <set name="2010-08-27 12:03:01.199" value="17.500000" hoverText = "The difference from last value: 0.98" ></set>
     <set name="2010-08-27 12:03:03.030" value="25.020000" hoverText = "The difference from last value: 7.52" ></set>
     <set name="2010-08-27 12:03:40.570" value="30.000000" hoverText = "The difference from last value: 4.98" ></set>
     <set name="2010-08-27 12:04:27.490" value="32.250000" hoverText = "The difference from last value: 2.25" ></set>
     <set name="2010-08-27 12:05:03.738" value="26.050000" hoverText = "The difference from last value: -6.2" ></set>
     <set name="2010-08-27 12:05:14.511" value="18.540000" hoverText = "The difference from last value: -7.51" ></set>
     <set name="2010-08-27 12:06:09.728" value="16.520000" hoverText = "The difference from last value: -2.02" ></set>
     <set name="2010-08-27 12:06:58.329" value="17.500000" hoverText = "The difference from last value: 0.98" ></set>
</graph>

Is there a way in PHP to alter this file to display just some of the data points say between 2010-08-27 12:02:11.851 (start time) to 2010-08-27 12:05:03.738 (end time) and to give the user a drop down menu of the start time and a drop down menu of the finish time while maintaining the top  tag and the bottom  tag?
Any suggestions?
Regards,
Anthony

A: It's possible. E.g. via XSL(T). Many browsers can do this even on the client side.
see http://www.w3.org/TR/xslt and http://docs.php.net/book.xsl

A: First you should ask yourself if you actually want to alter the file. It sounds like you actually want to use this file as input and use PHP to generate an HTML file with your drop down menu.
I think Volker's right that you probably want to use XSLT. Basically it is a kind of stylesheet that will transform an XML document into something else. But you can also use it to perform tests, which is how you would select the date range you want.
Here's a basic tutorial on XSLT: http://www.w3schools.com/xsl/xsl_transformation.asp (but it won't tell you what you need to know to select your date range).
Your XSL file would look something like this (I think -- this is not tested):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:php="http://php.net/xsl">
<xsl:output method="html" encoding="utf-8" indent="yes"/>
 <xsl:template match="/graph">
  <html><body>
    <select>
    <xsl:for-each select="set">
          <xsl:if test="php:function('testDate',string(@name))"/>
      <option value="">
        <xsl:value-of select="php:function('formatDate',string(@name))"/>
      </option>
      </xsl:if>
    </xsl:for-each>
    </select>
  </body></html>
 </xsl:template>
</xsl:stylesheet>

In this case, you'd be writing functions to test whether the date matches the range you set (testDate), and to format the date the way you want (formateDate; see strtotime() and date() functions). Also you'd need to figure out what value you want to pass back when the form is submitted. And then follow this example to get PHP to use this XSL file to parse the XML file:
http://docs.php.net/manual/en/xsltprocessor.registerphpfunctions.php


text:
Q: When two CSS rules have selectors with a common prefix, can the CSS rules be simplified? /*
Style top-level
s' (i.e. each
 not nested within another
)
background color to emulate Colombian  flags (yellow, yellow, blue, red, repeat).
Also, the
s with blue and red bg should have white text to provide contrast,
but still keep their markers black.
 */

:is(li:nth-child(4n+1), li:nth-child(4n+2)):not(li li) {
    background-color: yellow;
}

li:nth-child(4n+3):not(li li) {
    background-color: blue;
    /* color: white; */
}

li:nth-child(4n+4):not(li li) {
    background-color: red;
    /* color: white; */
}

:is(li:nth-child(4n+3), li:nth-child(4n+4)):not(li li) {
    color: white;
}

:is(li:nth-child(4n+3), li:nth-child(4n+4)):not(li li) a {
    color: white;
}

:is(li:nth-child(4n+3), li:nth-child(4n+4)):not(li li)::marker {
    color: black;
}

Note the last 3 CSS rules have selectors which share a common prefix. If we let var be :is(li:nth-child(4n+3), li:nth-child(4n+4)):not(li li), then the selectors of the last three rules are:

*

*var

*var a

*var::marker
Given this, can the CSS be simplified in any way?

*

*HTML and CSS code

*live page


text:
Q: Edit and save simple XML by php I found this script and it works, but I would like to edit all the children, not just the first one.
It's possible?

<?php
$xml = new DOMDocument('1.0', 'utf-8');
$xml->formatOutput = true;
$xml->preserveWhiteSpace = false;
$xml->load('file.xml');

//Get item Element
$element = $xml->getElementsByTagName('global')->item(0);

//Load child elements
$name = $element->getElementsByTagName('data')->item(0);

//Replace old elements with new
$element->replaceChild($name, $name);

?>

<?php
if (isset($_POST['submit']))
{
$name->nodeValue = $_POST['namanya'];
htmlentities($xml->save('index_messages_en.xml'));

}

?>

<form method="POST" action=''>

<?php echo $name->nodeValue  ?>
<input type="text-name" value="<?php echo $name->nodeValue  ?>" name="namanya" />
<input name="submit" type="submit" />
</form>

The format of my xml documents is :
<global>

  <data name="title"><![CDATA[data1]]></data>
  <data name="author_name"><![CDATA[data2]]></data>

<global>

I would like the file to become like that

  <data name="title"><![CDATA[NEWdata1]]></data>
  <data name="author_name"><![CDATA[NEWdata2]]></data>

<global>

Thanks
Mau


text:
Q: Restore entire previous version of xcode project Source control in xcode allows comparison of versions of an existing file.
Can I restore a file I deleted eg. file existed in version 10, I'm now on version 15 and want to restore that file

A: You cannot revert the entire project at once in Xcode, but you could do it from the terminal; just cd into the folder of your project and type git log to find the hash you're looking for, then do git checkout [hash].
To restore a single file look to View > Version Editor within XCODE


text:
Q: How to add condition (measure is greater than 0) in an MDX query I have the following query in MDX
With

  member [Week Count] as
     (
       ([WORK ].[Complying Flag].&[COMPLYING], [Measures].[No of Work ])
/([WORK ].[Complying Flag].[(All)].[All], [Measures].[No of Work ])) *100
select
  {[Week Count]} on columns,
  {[CLOSED DATE].[Week End Date].members} on rows
FROM [test ]

I need to add a condition where clause where  [Measures].[ACT LAB HRS]>0
but it returns always error , how to correct it ?

A: You could use Filter but we would need a set to filter so something like this:
WITH
  MEMBER [Week Count] as
     (
       ([WORK ].[Complying Flag].&[COMPLYING], [Measures].[No of Work ])
/([WORK ].[Complying Flag].[(All)].[All], [Measures].[No of Work ])
     ) *100
SELECT
  {[Week Count]} on columns,
  {[CLOSED DATE].[Week End Date].members} on rows
FROM [test]
WHERE
   (
    FILTER
      (
        [SomeDimension].[SomeHierarchy].members,
        [Measures].[ACT LAB HRS]>0
      )
   );

Another approach would be to include a HAVING clause:
WITH
  MEMBER [Measures].[Week Count] as
     (
       ([WORK ].[Complying Flag].&[COMPLYING], [Measures].[No of Work ])
/([WORK ].[Complying Flag].[(All)].[All], [Measures].[No of Work ])
     ) *100
SELECT
  {
   [Measures].[Week Count],
   [Measures].[ACT LAB HRS]
  } ON 0,
  {[CLOSED DATE].[Week End Date].members}
  HAVING [Measures].[ACT LAB HRS]>0
  ON 1
FROM [test];


text:
Q: Amazon Web Services REST Api Issues I want to hook into the Amazon Web Services REST Api to check the status of my EC2 Instances.
I'm using the following link for reference (which doesn't seem to be particularly straightforward) - AWS EC2 API
I'm executing the following in browser -
https://ec2.amazonaws.com/?AWSAccessKeyId=[INSERTACCESSKEYIDHERE]&Action=DescribeInstanceStatus&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2015-04-03T20%3A55%3A06Z&Version=2014-10-01

The result I get back is -
<Response>


text:
Q: C# "System" version update I'm in C# in Visual Studio running 2015 Update 3.
I'm using a dll that I made myself for the backend of a system, and in the references of the project, one shows the "System" as Version 2.0.5 and the project being used as a dll shows it as 4.0.0. I believe this is the cause of a conflict that is preventing me from running this app. How do I update just the system version or even specify it so I can make them the same?

A: I think you should go to the references of your project containing the old reference, remove System and add it with version 4.0.0.0. However, you should also check that target .NET framework versions match (maybe the older dll is obtained compiling against .NET framework 2.0 and the newest one against .NET framework 4.0).
In order to find out the cause that is preventing you from running the application (you should provide what is happening), an useful tool is Assembly Binding Log Viewer which will show the exact assemblies that the application is trying to load (fully qualified assembly names).


text:
Q: Including HTML code side by side in Latex I want to write HTML codes of two pages side by side in LaTeX like as follows:
<html>   <html>
<head>   <head>
</head>  </head>
<body>   <body>
 ...      ...
</body>  </body>
</html>  </html>

I know how to include HTML code in LaTeX but I have no clue how will I achieve it. So if anyone please help me regarding this
I will be grateful. Thank you.
EDIT: I have tried it with the help of table as shown below, but it is giving errors.
\begin{table}[htb]
\parbox{.45\linewidth}{
 \centering
 \begin{tabular}{c}

 \begin{lstlisting}[language=html]
 <html>
 <head>
 </head>
 <body>
  ...
 </body>
</html>
 \end{lstlisting}
\end{tabular}
}
\hfill
\parbox{.45\linewidth}{
\centering
\begin{tabular}{c}

\begin{lstlisting}[language=html]
<html>
<head>
</head>
<body>
...
</body>
</html>
\end{lstlisting}
\end{tabular}
}
\end{table}

A: How about using minipage environments for the two columns?

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{listings}
\lstset{
breaklines=true,
breakatwhitespace=true,
}
\begin{document}

\begin{minipage}[t]{0.45\textwidth}
\begin{lstlisting}[language=html]
<html>
<head>
</head>
<body>
...
</body>
</html>
 \end{lstlisting}
\end{minipage}
\hfill
\begin{minipage}[t]{0.45\textwidth}
\begin{lstlisting}[language=html]
<html>
<head>
</head>
<body>
...
</body>
</html>
\end{lstlisting}
\end{minipage}

\end{document}

A: Use package varwidth for a variable width of the parboxes:
\documentclass{article}
\usepackage{listings}
\usepackage{varwidth}
\begin{document}
\noindent
\begin{varwidth}{0.49\linewidth}
\begin{lstlisting}[language=html]
 <html>
 <head>
 </head>
 <body>
  ...
 </body>
</html>
\end{lstlisting}
\end{varwidth}
\qquad%\hfill
\begin{varwidth}{0.49\linewidth}
\begin{lstlisting}[language=html]
<html>
<head>
</head>
<body>
...
</body>
</html>
\end{lstlisting}
\end{varwidth}

\end{document}


text:
Q: How to correctly parse JSON in Python I use Databricks to get delta table info and I return the result as a JSON. The return goes by return json.dumps(value). However, when I receive the JSON it looks like 'key': 'value', with single quotes. Also, the booleans are displayed as True, False while null is displayed as None (which is normally since this is the way Python returns things). After receiving it into Python (precisely, Flask app), I forward this JSON to my .NET app but before that, I clean it with the following way:
json_value = json_value.replace("'", '"')
json_value = json_value.replace('True', 'true')
json_value = json_value.replace('False', 'false')
json_value = json_value.replace('None', 'null')

This thing worked for 2 months until one of my records got Cote d'Ivore as a value. This 'cleaning' replaced the single quote here with a double quote and that made my JSON crash on the .NET side. I parse the JSON on the .NET side by JsonConvert.DeserializeObject(response.Content).
Now, is there some automatic way to parse the JSON correctly at the Python side, without having to clean it by replacing and have a proper functionality when I'd send it to .NET?

A: You need to pass a dictionary object in json.dumps() instead of a string.
import json
a={'s':'asdas','fff':23,'ss':True, 'sssss':None}
res=json.dumps(a)
print (res)
##OUTPUT
## {"s": "asdas", "fff": 23, "ss": true, "sssss": null}

Assuming that you have string instead of a python dictionary; in that case you can convert that to dictionary using ast library
import ast
import json
value="{'s': 'asdas', 'fff': 23, 'ss': True, 'sssss': None}"
 #assuming it is in string format
value=ast.literal_eval(value) #convert string format dictionary to dictionary
result=json.dumps(value)


text:
Q: write.csv results of each foreach iteration in R I am using foreach to parallelize my job for an extremely large dataset. Below is the code:
d <-
  foreach(a=files, .packages = 'hdf5r', .combine = 'cbind') %:%
    foreach(b=files, .combine = 'c') %dopar% {

      values <- "perform calculations"

  }
d

The output I get is in the form of a matrix ... as a result of the 'cbind' combine function in the outer foreach. See attached photo.
However, what I would really like to do, is be able to save each iteration results in a standalone .csv or .txt file.
I have tried using a user-defined function that does that to replace 'cbind' but no luck. I have also put write.table(......) in the body of the code but it only captures the last iteration and I'm not sure if adding another for loop inside a nested foreach is good practice.
Is there a clever way of solving my dilemma?
Thank you.
Results:
What I am getting from the script above
Desired:
What I need to save in individual .csv

A: Try something like the following. Untested but I have used it before and it can work or, at least, give an idea on how to make it.
The inner most foreach must return a value, put values as its last instruction.
The file name is my choice, change at will.
d <- foreach(a=files, .packages = 'hdf5r', .combine = 'cbind') %dopar% {
  tmp <- foreach(b=files, .combine = 'c') %dopar% {

    values <- "perform calculations"
    values
  }
  fname <- paste("result", i, "csv", sep = ".")
  fname <- file.path("~/tmp", fname)
  write.csv(tmp, fname, row.names = FALSE)
  # return value to outer loop
  tmp
}
d

Note that without the last tmp, returned to the outer most loop, d will be NULL.


text:
Q: Using PHP to print out a downloadable text file My script puts together a set of htaccess rules based on information passed into it and gives the user a downloadable text file with the rules printed out inside.  The idea is that an administrator fills out some form information, clicks a downloadable link, gets a text file with the rules printed out inside, opens the file, copies the rules and pastes them into the htaccess file of their domain.
I've managed to put together the script that produces these rules.  However, the text file seems to ignore all newline characters that I print to it.  The tabs work, but the newlines do not.  It must have something to do with the encoding I'm using with the header() function calls, but I'm not sure what I'm doing wrong.  No amount of Googling as seemed to point me in the right direction.  Any input would be appreciated.
Here's the code:
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="htaccess.txt"');
header('Content-Transfer-Encoding: binary');

$id = addslashes( $_GET['id']);
$location = addslashes( $_GET['location'] );
$location = substr($location, strpos($location, '/', 9 ) + 1 ) . ( ( substr( $location, strlen($location) - 1 ) == '/' ) ? '' : '/' );
$regEx = '([0-9a-zA-Z-_]*)';
$lines = array();

for( $x = 0; $x < 10; $x++ ) {
    $line = 'RewriteRule ^' . $location;
    for( $y = 1; $y <= $x; $y++ )
        $line .= $regEx . '/';
    $line .=  '*$' . "\t\t\t\t\t";
    $line .= "http://localhost/redirect.php?ring=$id";
    $line .= ( $x >= 1 ) ? '&link=$1' : '';
    $line .= ( $x > 1 ) ? '&tag' . ( $x - 1 ) . '=$' . $x . ' [NC]' . "\n" : "\n";
    $lines[] = $line;
}

foreach( $lines as $line )
    echo $line;

A: Windows doesn't always understand "\n". Windows uses "\r\n" as default for line breaks.

A: Try putting "\r\n" instead of "\n"
Linux: \n
Mac: \r
Win: \n\r

A: They work for me. Are you developing on a windows machine? If so you might want to use \r\n or better yet, the PHP_EOL constant which is environment-agnostic.

A: Are you testing on a windows system or a unix system?  I seem to remember that unix systems use different line ending characters in text files than windows systems do.
Wikipedia suggests

"Another common problem is the use of
  '\n' when communicating using an
  Internet protocol that mandates the
  use of ASCII CR+LF for ending lines.
  Writing '\n' to a text mode stream
  works correctly on Windows systems,
  but produces only LF on Unix, and
  something completely different on more
  exotic systems. Using "\r\n" in binary
  mode is slightly better, as it works
  on many ASCII-compatible systems, but
  still fails in the general case. One
  approach is to use binary mode and
  specify the numeric values of the
  control sequence directly,
  "\x0D\x0A"."

http://en.wikipedia.org/wiki/Newline

A: Right now I am a bit puzzled about these two headers:
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary

In general, octet-stream is used for binary executables. As the contents is plain text, I also do not see any sense in setting the encoding to "binary".
It is safe to use \r\n for the line break as it works on both UNIX-derviates as well as Microsoft Windows machines.
As for the content type, I would recommend in your case "text/plain".


text:
Q: Perl Net::SFTP::Foreign to get latest file from remote server I am trying to transfer file from remote server to local server using Perl Net::SFTP::Foreign module.
Here is my code:
#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper;
use Net::SFTP::Foreign;

my $host = "host.ip.address.here";
my $user = "username";
my $pass = "password";

my $path      = "/path/to/the/remote/server/directory";
my $local_dir = "/local/dir/path/";

my $sftp = Net::SFTP::Foreign->new(host=>$host , user=>$user , password=>$pass);
$sftp->die_on_error("Unable to establish SFTP connection");
$sftp->setcwd($path) or die "unable to change cwd: " . $sftp->error;

my @file = $sftp->ls($path);
print Dumper(\@file);

$sftp->mget("$path/test*.csv", $local_dir);

I have list of files in my remote server -
test123.csv
test234.csv
test341.csv
test890.csv
test765.csv
test110.csv

The thing here is I want to get the latest file from $path directory, which is based on modification date.
(I am unable to find the solution)
Is there any command which can achieve this?
Other method I found is loop through @files array but how do I get the latest file? Moreover I don't want to loop through, because $path have lots of files which will take much time to execute.
So I wanted to get the remote file using a single command. Any idea?

A: Have a look at the $sftp->stat($path_or_fh) method of the docs
It returns a list of attributes about the file, including mtime.  You'll have to get the mtime for each file you pull and make a decision via code on the latest file.

A: I found following solution. Posting my answer here, so it could help people looking for similar kind of requirement.
Below is the code which is continuation of above (questioned) script.
my %filehash;

foreach (@$files){
    my $file = $_->{filename};
    next unless($file =~ m/test(.*)\.csv/);

    my $stat_attr = $sftp->stat($file) or die "remote stat command failed: ".$sftp->status;

    my $size  = $stat_attr->size;
    my $mtime = $stat_attr->mtime;

    $filehash{$file}{'MTIME'} = $mtime;
}

my $recent_file = List::Util::reduce { $filehash{$b} > $filehash{$a} ? $b : $a } keys %filehash;
print "Recent FILE:$recent_file, TIME:$filehash{$recent_file}{'MTIME'}\n";

$sftp->mget("$path$recent_file", $local_dir);
$sftp->disconnect;

System should support List::Util; perl module which should be used in the begining of the script.


text:
Q: Where does this proof that the abs. value of the determinant of a 2x2 matrix A is the area of the image of the unit square under A go wrong? If we have a matrix $A\in M_2(\mathbb{R})$, $A=\begin{bmatrix} a & b \\ c & d \end{bmatrix}$, then $det(A)=ad-bc$.   $A$ sends the unit square to the parallelogram whose sides are the vectors $(a, c)$ and $(c, d)$. Since the area of a parallelogram is the product of its two side lengths, the area of this parallelogram is $\|(a, c)\|\|(b,d)\|=\sqrt{a^2+c^2}\sqrt{b^2+d^2}=\sqrt{(ab)^2+(ad)^2+(cb)^2+(cd)^2}$. If this is the absolute value of $det(A)$, then it should equal $\mid ad-bc \mid$. But I just don't see how it does . . .

A: The area of a parallelogram isn't the product of the two side lengths, it's the product of its base and height. If $\theta$ is the angle between adjacient sides, then the area becomes $||(a,c)||\, ||(b,d)||\sin(\theta)$.


text:
Q: Javascript download multiple files with iframe I need to download multiple files with one button "download all",I don't want to zip them, i want to download them with javascript and hidden iframe,how I can do it? here is the example with iframe and javascript ,but I don't understand what url I need to send to ifrm.setAttribute( "src", url ) ;What is 'somefile.do'?
function makeFrame( url )
{
    ifrm = document.createElement( "IFRAME" );
    ifrm.setAttribute( "style", "display:none;" ) ;
    ifrm.setAttribute( "src", url ) ;
    ifrm.style.width = 0+"px";
    ifrm.style.height = 0+"px";
    document.body.appendChild( ifrm ) ;
}

function downloadChecked( )
{
    for( i = 0 ; i < document.downloadform.elements.length ; i++ )
    {
        foo = document.downloadform.elements[ i ] ;
        if( foo.type == "checkbox" && foo.checked == true )
        {
            makeFrame('somefile.do?command=download&fileid=' + foo.name );
        }
    }
}

A: You need to pass direct file URL (or URL which cause direct downloading) into iframe src. In your script case, somefile.do is probably some download handler and file ID and action is passed by it's parameters.
But back to your question, if you have files:

*

*example.com/file1.zip

*example.com/file2.zip

*example.com/file3.zip

You have to pass it just into makeFrame function as a parameter:
makeFrame('http://example.com/file1.zip');

It will create iframe for every URL and start downloading (or display save dialog - depends on browser). Make sure to have files URLs in array and pass them in for loop.

A: I would recommend the multiDownload jQuery plugin. It's also using iframes, and keeps your code tidy.
Example:
document 1
document 2
document 3

download all

$('#download_all').click(function (event) {
    event.preventDefault();
    $('.document').multiDownload();
});

And you're ready :)


text:
Q: How can I print whether the number in the specified index is positive or negative in python using exception handling? My aim:
Declare a list with 10 integers and ask the user to enter an index.Check whether the number in that index is positive or negative number.If any invalid index is entered, handle the exception and print an error message.(python)
My code:
try:
    lst=[1,2,3,4,5,-6,-7,-8,9,-10]
    index=input("Enter an index : ")
    def indexcheck(lst, index):
        index=input("Enter an index")
        if index in lst[index]:
            if lst[index]>0:
                print('Positive')
            elif lst[index]<0:
                print('Negative')
            else:
                print('Zero')

except IndexError:
    print("Error found")

Where am I going wrong and how can I correct it?
I am a beginner.Please do help.
Thanks in advance.

A: There are following issues with your code:

*

*You need to convert the str object returned by input to int.
index = int(input("Enter an index: "))

*You also need to call your function indexcheck. The python interpreter will only execute it's code when you will call it.

*if index in lst[index]: is not the right way to check for index value being valid for your list.

*Since you are already trying to check for index validity and your intentional was to use only valid indexes on your list, so you can't get IndexError exception. You should instead check for ValueError exception (thrown by int(input(...)) if str can't be converted to an int).
I have tired to modify your code as less as possible. My intention is to show the right way of doing things with your code. Try this:
try:
    lst = [1,2,3,4,5,-6,-7,-8,9,-10]
    def indexcheck(lst):
        index = int(input("Enter an index: "))
        if 0 > index >= len(lst):
            print("Index: %d not found" % (index))
            return
        if lst[index] > 0:
            print('Positive')
        elif lst[index] < 0:
            print('Negative')
        else:
            print('Zero')
    indexcheck(lst)

except ValueError:
    print("Value entered can't be converted to an int")

A: You don't have to put the try/except block around the entirety of your code. For instance, you could do the following:
lst=[1,2,3,4,5,-6,-7,-8,9,-10]
index=int(input("Enter an index : "))

try:
    if lst[index] > 0:
        print ("Positive")
    else:
        print ("Negative")
except:
    print ("Index our of range")

You could wrap this in a function:
def check_index(lst, index):
    try:
        if lst[index] > 0:
            print ("Positive")
        else:
            print ("Negative")
    except:
        print ("Index our of range")

P.S. I considered 0 as negative, you can change that part yourself :)

A: Here's the code:
def indexcheck(lst, index):
    if 0 <= index < len(lst):
        if lst[index] > 0:
            return 'Positive'
        elif lst[index]<0:
            return 'Negative'
        else:
            return 'Zero'
    else:
        raise Exception("Index out of range")

lst = [1, 2, 3, 4, 5, -6, -7, -8, 9, -10]
index = int(input("Enter an index : "))
indexcheck(lst, index)

A: *

*You are defining a function but not calling it.

*input("Enter an index : ") returns a string. You need to convert that into an int as all the lst indices are integers.

The working code is given below:
def fun():
    try:
        lst=[1,2,3,4,5,-6,-7,-8,9,-10]
        index=int(input("Enter an index : "))
        def indexcheck(lst, index):
            if lst[index]>0:
                print('Positive')
            elif lst[index]<0:
                print('Negative')
            else:
                print('Zero')

        indexcheck(lst, index)

    except IndexError:
        print("Error found")

fun()


text:
Q: ReactJS app with nodejs/express for backend - can't get api to backend working I am trying to implement a React application which needs access to a database.  From what I have seen, this can be done with a nodejs/express as a backend.  In addition, I am under the impression that by adding a proxy entry to my react package.json file that I can redirect the "/api" requests of the fetch calls to the backend server.  However, I don't think it is working.  In the browser console, is showing a 404 error on the localhost:3000 (which is the NPM react server).  My backend is running on port 5000.
I can access the "http://localhost:5000/api" of the backend server and it returns JSON as designed.
Here is my react package.json file:
{
  "name": "ubwo",
  "version": "0.1.0",
  "private": true,
  "proxy":"http://localhost:5000/api",
  "dependencies": {
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-redux": "^7.1.0",
    "react-router": "^5.0.1",
    "react-router-dom": "^5.0.1",
    "react-scripts": "3.0.1",
    "redux": "^4.0.1",
    "redux-thunk": "^2.3.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "resolutions": {
    "browserslist": "4.6.2",
    "caniuse-lite": "1.0.30000974"
  }
}

This is my "test" React code.  I am not too familiar with fetch, so perhaps the code needs some changes?:
componentDidMount() {
    this.callApi()
        .then(res => this.setState({ response: res.express}))
        .catch(err => console.log(err));
}

callApi = async() => {
    const response = await fetch('/api/cust/all',{
        headers:{
            "accepts":"application/json"
        }
    });
    const customers = await response.json();
    if (response.status !== 200) throw Error(customers.message);

    return customers;
}

A: When you use /api/foo in your fetch call, it will execute the request against the url you are currently on. So your API request is expanding to
http://localhost:3000/api/foo
As you stated your API server is running on http://localhost:5000. So what you need to do here is provide the entire path to your fetch request.
fetch(`http://localhost:5000/api/foo`)

As you might guess, this will cause problems when you go to production, so a typical pattern is to use an environment variable that can be configured:
fetch(`${process.env.API_URL}/api/foo`)

See create-react-app environment variable docs

A: You probably should remove the /api at the end of your proxy value in your package.json file
Hope this helps

A: Also you could check if you have a json parser in use on your back end in your main server file like:
express.urlencoded([options])

or
const bodyParser = require('body-parser);
bodyParser.json([options])


text:
Q: Static function returning a static instance of the class - shouldn't the instance be the same? I have the following code:
#include <iostream>
using namespace std;

class Test {
public:
  static Test& get() {
    static Test testSing;
    return testSing;
  }
};

int main() {
  Test a = Test::get();
  Test b = Test::get();

  cout << &a << endl;
  cout << &b << endl;
}

I thought that a and b should have the same address, since I thought they should be constructed only once. However, I get different memmory addresses in this test.
Is there something trivial that I am missing? Shouldn't they have the same address?

A: You use the copy constructor, so you have 2 different objects, references are missing.
You probably want
Test& a = Test::get();
Test& b = Test::get();

A: a and b are assigned from the return value of Test::get, that mean they are copied, so they are independent variables. You may declare them as reference type, so change the code to:
Test &a = Test::get();
Test &b = Test::get();

You'll get what you want.

A:
"I thought that a and b should have the same address"

As mentioned in the other answers, you're referring to copies of Test, and their addresses are different of course.
To make it a singleton class (as it seems to be intended) you explicitly prohibit using the default and copy constructors, and copy assignment operators:
class Test {
public:
  static Test& get() {
    static Test testSing;
    return testSing;
  }
private:
    // Forbid the following operations being used from public scope
    Test() {}
    Test(const Test&);
    Test& operator=(const Test&);
};

This way you'll get concise compilation errors in first place, besides unexpected behavior.


text:
Q: Creating a table of multiple rows and columns from attribute table I am trying to create a street index a City. I have a table that has all the street names and their grid references. I am looking to create a street index using that. I think turning off the undesired fields off leaving only the main three columns I need and then outputting that would work. That instead  creates a really long table. I would like to break that table into columns so I can add it to street maps. In the end I need an index that looks like this.

That is the end goal. If there is a way through python I am willing to attempt that as well. That right now is created by polylines and a white polygon in the background and an annotation layer for the text. All done by hand. I need to have it automated so once a new input is made the user does not have to create and enter in a new annotation and create the correct size of a table.
I am using ArcGIS 10.3 on a Windows 7 computer. Let me know if any additional information is needed.

A: I don't believe there is any way to achieve the layout you are seeking with a native table in ArcMap.
There is an alternative approach which may be easier to maintain and that is using Excel.

*

*Create your 12 column table as shown in your example above using Excel.

*Save this document.

*In Layout, insert an Object, make sure you are creating from a file and that Link is ticked on

Step 1 is achieved by you copying the original table into Excel and YOU manually chopping it up into 12 columns (or what ever you desire). You need to chop it up as to my knowledge there is no automatic way of arranging the table as you desire.
As you have chosen it to be a Link any additional edits to the Excel document will be reflected in the inserted table in your Layout.

A: I created a street index like your issue. Old school AML programs back in the day (2000). A map like road atlas with the street index to the right. This still can be done in GIS and Python. I would recommend working through this issue one piece at a time. You can use excel but since you are working in GIS it would be better if you create a file geodatabase FGDB with all the data. I would use only python for the whole process but a combination of ArcMap and Python will work.
First, create a table with unique street names.
Second, add columns as needed. This table will capture all the iterations.
Example: street prefix, street name, street type, street suffix, street name full ( N Main St, Main St N...), Grids - g1, g2, g3, etc. (I would add 10 grid numbers), counter to capture how many grids added to that unique street name.
Third, use the street against the grid FC, what you do is clip and then iterate through each of those clipped streets and add that grid number to the table with a select statement.
So, its clip streets from grid, iterate thorough each street in that subset, select unique street name in table, calculate values. You would use the counter (stcntr += 1) column to calc the correct grid column.
Example: N Main St, A, B, ,,,,,,,,2 and all the other columns you added.
N Main St, Grid A, Grid B, with 2 iterations
Fourth, after all the iterations you will go through the unique street name table to create another table.
This would be the final table and the hardest to configure because of the specific code.
Example, N Main St GA-GE, GW, GX
Example, GA-GE (GA,GB,GC,GD,GE Then GW and GX).
You would need to write code to sort or capture A,B,C…
Once you have it set up the final process is table (raw data) to final table.
The next step is to add the index to the map. I used word two column configuration and copy and paste. It is a manual process to keep it updated and I added new streets monthly or as needed.

A: Here is what I did. First, I use SQL (specifically SQL Server spatial data type' method) to find street line feature class intersecting grid polygon feature class and save the result (street name and grid index) in a table. Then, I use python to format the result and create a EMF image file. Finally, I insert that EMF file into the layout of a .aprx to create a PDF map with street index table. See attachment Wards.pdf.
https://community.esri.com/t5/arcgis-pro-questions/is-it-possible-to-create-a-street-grid-index-map/m-p/219222


text:
Q: Where can I obtain nightly-builds of LibreOffice? Is there a PPA with nightly builds of LibreOffice? Or some another source that I can add to my sources.list such that I can try nightly-builds of LibreOffice?
I know about the various ways to get the nightlies manually, but I want that the builds are updated with the sudo apt-get update && sudo apt-get upgrade commands.

A: You can try the PPA available here: https://launchpad.net/~libreoffice/+archive/ppa
The description of the PPA reads as thus:

LibreOffice test builds and backports
Most of the packages in this ppa have only experienced minor testing
  -- in fact it is the place to enable a wider audience to test packages before they are published into the distro proper. In general this ppa
  is not for the average user to install without a closer look (if it
  would be, its packages would be in the main repositories).

Refer to What are PPAs and how do I use them? for instructions on how to add the PPA to your computer.

A: Up to now there has not been a PPA providing this because of the complexities inherited from the old OOo build.
With the 3.5/precise release both the upstream build system and the packaging at Debian and Ubuntu have been cleared up enough to make this basically feasable -- if excluding l10n, binfilter and mozilla. Such a PPA would still likely burst default size limitations within one month and still hug a builder machine for >3 hours (on a fast builder) because there is no easy way to reuse a ccache in a ppa -- so I guess there is some clearance needed for this additional resource use.
Next question would be what to build as there are at least two/three active branches all the time. For example right now:

*

*the first being master which will be in the p+1/LibreOffice 3.6 release

*the second libreoffice-3-5 which will be in the precise/LibreOffice 3.5 release

*the third being libreoffice-3-4 which was in the oneiric/LibreOffice 3.4 release

Master is obviously the most interesting, but for QA the release branch (which will be in the next Ubuntu release) can also be interesting.
So even with this, there is a lot of details to work out (like versionnames to use etc.). If you are interested, I would be glad to help out though!

A: LibreOffice does not provide any nightly PPA, unfortunately.
It seems that for such a large project with multiple branches, doing this would be difficult: reference.
For now the only option for daily builds is to use the manual installation options. This answer could be updated in the future if the situation changes.

To clarify I wrote this answer because I was looking for the same
thing and confirmed that the situation is still the same as it was
when the other answers were written.

Perhaps someone could build a weekly/biweekly/monthly build solution, but a nightly build PPA is not going to happen, it seems.


text:
Q: Autowiring with Spring I'm trying to run my web application with some @Autowire on it so I have this context xml:
applicationContext.xml :
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context/
           http://www.springframework.org/schema/context/spring-context-3.0.xsd">

    <context:annotation-config />
    <context:component-scan base-package="com.abc" />
</beans>

However I'm getting this error:
WARNING: Nested in org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 10 in XML document from ServletContext resource [/WEB-INF/context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 31; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:annotation-config'.:
org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 31; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:annotation-config'.

A: Remove trailing slash from URL in schemaLocation:
xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd">

It has to be consistent with the namespace declaration:
xmlns:context="http://www.springframework.org/schema/context"


text:
Q: Problems with CSS layout I was wondering why my Right-nav div isn't responding to anything in the CSS.
HTML:

Header

Left Nav

            advertisment pictures

Picture

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.

right-nav

Footer

CSS:
/**
 * custom layout
 */

#header,
#footer {
    background-color: #f1f1f1;
    width: 60%;
    margin: 0 auto;
}

#main-wrap {
    background-color: #D9D9D9;
    width: 60%;
    margin: 0 auto;
}

#sidebar {
    background-color: #d2d2d2;
}

#content-wrap {
    background-color: #c5c5c5;
}

.info {
    background-color: #DDD;
}
.info + .info {
    background-color: #e6e6e6
}

/* sizes */
#main-wrap > div {
    min-height: 450px;
}

#header,
#footer {
    min-height: 40px;
}

.info {
    min-height: 80px;
}

/* layout */

#main-wrap {
/* overflow to handle inner floating block */
    overflow: hidden;
}

#sidebarwrap {
    float: left;
    width: 30%;
    overflow:hidden;
    background-color:blue;
}

#nav{
    min-height: 80px;
    background-color: red;
}

#content-wrap {
    float: right;
    width: 70%;
    overflow:hidden;
    background-color:blue;
}

#Content{
    float:left;
    width:40%;
    min-height:370px;
    background-color:red;
}

#Right-nav{
    background-color:red;
}

#picture-wrap {
/* overflow to handle inner floating block */
    overflow: hidden;
}

.info {
    width:100%;
    float: left;
}

A: It's because you've given the right div a class in the HTML but an id in the CSS, change both to one or the other and the problem should be resolved.

A: Change
 to


text:
Q: What are the differences between off-tank, bruiser and tanky DPS? I don't really know the differences between the three roles.
It is more damage in one than the others, more tanky, or is it the champ who makes the difference?
I read this question about what defines a bruiser,
But it makes me even more confused between the three.

A: There is no definite answer as far as I can see. Most of the namings are from different games or communities. I think you can use the following information as a guideline:
Bruiser
Targets damage towards enemy carries primarily and uses their skills to get to that carry and tie them up.
Off-Tank
Does some damage, but is primarily there to tie up anyone who is trying to mess with their team's carries. They are primarily used as an additional sink and to pick up enemy bruisers who make it past the tank.
Tanky DPS
Pretty much an in between of both bruiser and off-tank.Can take a hit and not have to burn flash to live. They can put out respectable damage as well but not enough to really be a threat to most tanks.
A lot of characters can fit into any of these roles depending on how they are itemized.
Examples:
Jarvan with Trinity Force is more bruiser. Jarvan with Frozen Mallet and Randuin's is more off-tank.
An other explanation I found on Reddit:

A bruiser is built to be in the enemy's face AND deal consistent
  threatening damage. To balance this, they typically have little CC,
  but often have damage soak abilities like shields or heals. Good
  examples for me include Udyr, Nocturne, Irelia, Renekton, Vi, Lee Sin.
A true tank will have a kit not built for damage, but exceptionally
  good in survivability and often built to scale off of defensive stats
  like health or armor. This allows them to build fully defensively and
  be a mild damage threat, but the primary reason they can't be ignored
  by the enemy is their CC. Malphite, Sejuani and Shen are a few good
  examples for me.
Offtanks are basically the in-betweens of these. They'll have some of
  the facets of each side. Often they can do okay on fewer items thanks
  to a big tank ability plus natural damage or threat level in their
  kit. Leona, Alistar, Nasus, and Jarvan are some of the commonly played
  champs I'd put in this category.


text:
Q: Exponential decay of a random matrix falling into a ball Let $A=U\Sigma V^T\in\mathbb{R}^{n\times n}$ be a random matrix defined in the following way: $U,V$ are uniformly distributed on the orthogonal group $O(n)$, $\Sigma$ is a diagonal matrix such that the diagonal elements follows a multivariate Laplace distribution $(\Sigma_{11},...,\Sigma_{nn})\propto\exp(-\sqrt{\sum_{i=1}^n\Sigma_{ii}^2})$ and $U,V,\Sigma$ are all independent. I conjecture that
$$\mathbb{P}(\|A-B\|_F\leq a)\geq C_1\exp(-C_2\|B\|_F)\mathbb{P}(\|A\|_F\leq a)$$
for any non-random matrix $B$, for some constant $C_1, C_2>0$ not depending on $B, n, a$. Here $\|\|_F$ means the Frobenius norm. This conjecture says that the probability the random matrix $A$ falles into a ball with some given radius decays at most exponentially fast as the center of the ball moves away from the origin.
This conjecture is indeed true if the distribution of $A$ follows $A\propto\exp(-\sqrt{\sum_{i=1}^n\sum_{j=1}^nA_{ij}^2})$, however this is not the case.
If the original conjecture is too hard, is the following relaxation true?
$$\mathbb{P}(\|A-B\|_F\leq a)\geq C_1\exp(-C_2\|B\|_F)\mathbb{P}(\|A\|_F\leq C_3a)$$
where $C_1, C_2, C_3>0$ are some constants.


text:
Q: use noUISlider with Rails I am trying to get noUiSlider (http://refreshless.com/nouislider/) to work with rails.
I have tried using the gem : http://www.rubydoc.info/gems/nouislider-rails/8.2.1#Usage
I tried doing it without the gem -->  got the latest version from http://refreshless.com/nouislider/download/. Added the css and the js to the asset pipeline, and updated the application.js and application.css.
Then to use :
in view :

in js (inside $(document).ready(function()):
var slider = $("#term-slider");
noUiSlider.create( slider, {
  start: [20, 80],
  connect: true,
  range: {
    'min': 0,
    'max': 100
  }
});

Tried using the old syntax as well as the new one : http://refreshless.com/nouislider/new-version/
But I am not able to see it. I get this error : noUiSlider.create requires a single element.

A: noUISlider accepts a DOM Element as its first argument, but your call sends it a jQuery element (which is a DOM Element wrapper with some additional properties).
You can obtain the raw DOM Element by either using native calls
var slider = document.getElementById('slider');

Or extracting the raw element from the jQuery object:
var slider = $("#term-slider")[0];

The rest of your call can remain unchanged.


text:
Q: ASP.NET Core 2.x Session IdleTimeout not working Application built with ASP.NET Core 2.x using cookie authentication and hosted in IIS.
I'm trying to set cookie expiry to 120 minutes and idle timeout to 30 minutes.
ie. while user is navigating pages and submitting forms, if the user leaves the page/form for 30 minutes and tries to interact with the page or form again, that requires validation(requires login) and should be taken back to the options.LoginPath value.
I've tried setting the idle-timeout to a low value of 10 seconds and reviewed several other stackoverflow, .Net and Microsoft articles looking for a suitable solution for this.
Would absolutely appreciate any suggestions or other things I could try to achieve the idletimeout.
ConfigureServices method:
services.AddAuthentication(options =>
            {
                options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;

            }).AddCookie(options =>
                {
                    options.Cookie.HttpOnly = false;
                    options.Cookie.Expiration = TimeSpan.FromMinutes(120);
                    options.ExpireTimeSpan = TimeSpan.FromMinutes(120);
                    options.AccessDeniedPath = new PathString("/Error");
                    options.LoginPath = "/Account/Login"; // -> This decides which page to send users to
                    //When cookie expires the user will be returned to the login page
                }
            );
            //services.AddMemoryCache();
            services.AddSession(options =>
            {
                options.IdleTimeout = TimeSpan.FromSeconds(10);
                options.Cookie.IsEssential = true;
            });

Configure method includes:
app.UseAuthentication();
app.UseSession();
app.UseCookiePolicy();

EDIT 27/04:

*

*Went into IIS and the Application Pool > Advanced Settings > Updated Idle Time-out (minutes) to 30 and set Ping Enabled to False

*Opened the site and navigated to a page only an authorised person can access and left it for 45 minutes, then tried to submit a HttpPost using Form submission on the page and I expected the session to have expired (I have a SessionExpired and Error[catch unhandled] page) though it successfully submitted the post.

*Have also checked that the 120 minute cookie expiry works, confirmed that it takes me to the SessionExpired page as expected
Any suggestions what else I could try in IIS?


text:
Q: Records not being formed upon clicking of button from VF Page for(CountrywiseAggregration__c cWA :[Select Country__c,Year__c , cWA.PDPAllocationafterFXQ1__c
                                       from CountrywiseAggregration__c
                                       where Country__c!=null and
                                             Year__c = : year
                                       ORDER BY Country__c]){
                cWA.PDPAllocationafterFXQ1__c = 0.0;
                mapCountryWiseAggr.put(cWA.Country__c,cWA);
            }
    }

Here we are  instantiating the object and querying 'n' number of fields and initializing the numerical fields to zero.
And later based on some some conditions values are being assigned to cWA.PDPAllocationafterFXQ1__c.
But the error is that no records are being formed .
Any generic reason for records not being formed ?


text:
Q: Does Sqlite support transaction try/catch like SQL Server? Assume I have the following query in SQL Server:
BEGIN TRANSACTION [trans1]
 BEGIN TRY
  INSERT ...
  COMMIT TRANSACTION [trans1]
 END TRY
 BEGIN CATCH
  ROLLBACK TRANSACTION [trans1]
 END CATCH

Does Sqlite support anything similar where I can embed the ROLLBACK directly into a transaction catch block?


text:
Q: Is there any difference in the use of the words deride and disparage? Although both these words have being treated with little regard for, does one convey something that the other one does not?

*

*Our efforts were derided but we carried on the pursuit of success.

*All that child needed was some encouragement in math, but her mother disparaged her before others so much that the child failed to shine in the test.

A: Deride is more emotionally charged -- it expresses contempt or ridicule. Here are two example sentences from its online OED definition

How can I recommend a film that is not only ridiculed by most fans, but also derided by most of the stars of the film?
The other parties have derided the proposal as a plan for a "fantasy island".

"Disparage" generally is less emotional. A couple of example sentences from the same source:

I would say persist and never minimize or disparage yourself or your abilities.
But when you're living with a person all your life, you, unknowingly, tend to disparage his worth.'


text:
Q:  action not working after upgrade to MyFaces 2.1.9 Our team is upgrading Webapplication from Myfaces-1.1.5 to Myfaces-2.1.9 and from Tomahawk-1.1.3 to Tomahawk-1.1.14.
Before this upgrade we were using ajax4jsf-1.0.6, after upgrade we are using richfaces-impl-jsf2-3.3.4.
The problem is we are not able to render the next page using the following h:commandLink(with action as outboundProfileForm) in an .xhtml file. When we click on this commandLink, instead of next page the current page gets rendered again. No exception in logs. Could you please guide us or give some directions how to move forward. Many thanks in advance.
    <h:column>
            <f:facet name="header">
                <h:panelGroup>
                    <h:commandLink action="#{outboundProfileList.sortTable}"
                        value="#{text['outboundProfileLabel.name']}">
                        <f:param name="sortColumn" value="name" />
                    </h:commandLink>
                    <h:graphicImage value="#{outboundProfileList.model.sortAscending ? '/images/arrowUp.GIF' : '/images/arrowDown.GIF'}"
                            rendered="#{outboundProfileList.model.sortColumn=='name'}" />
                </h:panelGroup>
            </f:facet>
            <h:commandLink action="#{outboundProfileForm.edit}"
                value="#{outboundProfile.name}">
                <f:param name="passedId" value="#{outboundProfile.id}" />
                <f:param name="from" value="list" />
            </h:commandLink>
        </h:column>

Web.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_3_0.xsd">

    <display-name>e-Messaging</display-name>
    <distributable/>

    <!-- precompiled jsp mappings -->

    <!-- Define the default CSS Theme -->
    <context-param>
        <param-name>csstheme</param-name>
        <param-value>group1</param-value>
    </context-param>
    <!-- Define the basename for a resource bundle for I18N -->
    <context-param>
        <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
        <param-value>ApplicationResources</param-value>
    </context-param>
    <!-- Fallback locale if no bundles found for browser's preferred locale -->
    <!-- Force a single locale using param-name 'javax.servlet.jsp.jstl.fmt.locale' -->
    <context-param>
        <param-name>javax.servlet.jsp.jstl.fmt.fallbackLocale</param-name>
        <param-value>en</param-value>
    </context-param>
    <!-- Context Configuration locations for Spring XML files -->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            classpath*:/applicationContext-resources.xml
            classpath*:/applicationContext-dao.xml
            classpath*:/applicationContext-service.xml
            classpath*:/applicationContext-monitoring.xml
            classpath*:/applicationContext-inbound.xml
            classpath*:/applicationContext-config.xml
            classpath*:/applicationContext-outbound.xml
            classpath*:/applicationContext.xml
            /WEB-INF/security.xml
            /WEB-INF/applicationContext.xml
            /WEB-INF/cxf.xml
            classpath*:/applicationContext-agent.xml
            classpath*:/applicationContext-ext.xml
        </param-value>
    </context-param>
    <context-param>
     <param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
     <param-value>true</param-value>
</context-param>
    <context-param>
        <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
        <!--<param-value>org.ajax4jsf.application.</param-value> -->
        <!--<param-value>org.apache.myfaces.view.facelets.FaceletViewHandler</param-value> -->
        <param-value>com.g1.emessaging.ui.EmsgFaceletViewHandler</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Production</param-value>
    </context-param>
    <context-param>
        <param-name>faces.PROJECT_STAGE</param-name>
        <param-value>Production</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.VIEW_MAPPINGS</param-name>
        <param-value>*.xhtml</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.DEVELOPMENT</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.REFRESH_PERIOD</param-name>
        <param-value>-1</param-value>
    </context-param>
    <context-param>
        <param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
        <param-value>a4j_resource</param-value>
    </context-param>
    <context-param>
       <param-name>org.richfaces.SKIN</param-name>
       <param-value>blueSky</param-value>
    </context-param>

    <context-param>
      <param-name>org.richfaces.CONTROL_SKINNING</param-name>
      <param-value>disable</param-value>
    </context-param>
        <context-param>
      <param-name>org.richfaces.CONTROL_SKINNING_CLASSES</param-name>
      <param-value>disable</param-value>
    </context-param>

    <context-param>
        <param-name>facelets.LIBRARIES</param-name>
        <param-value>
<!--            /WEB-INF/taglibs/corejsf-validator.taglib.xml; -->
            /WEB-INF/taglibs/tomahawk.taglib.xml;
            /WEB-INF/taglibs/emessaging.taglib.xml;
    /WEB-INF/taglibs/jsf-core.taglib.xml;
    /WEB-INF/taglibs/jsf-html.taglib.xml;
    /WEB-INF/taglibs/jsf-ui.taglib.xml;
    /WEB-INF/taglibs/jstl-core.taglib.xml;
    /WEB-INF/taglibs/jstl-fn.taglib.xml
        </param-value>
    </context-param>
    <context-param>
        <param-name>configPath</param-name>
        <param-value>/WEB-INF/classes</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
        <param-value>false</param-value>
     </context-param>

     <filter>
        <filter-name>ajax4jsf</filter-name>
        <filter-class>org.ajax4jsf.Filter</filter-class>
    </filter>
 <!--   <filter>
        <filter-name>cacheFilter</filter-name>
        <filter-class>com.opensymphony.oscache.web.filter.CacheFilter</filter-class>
    </filter> -->
    <filter>
        <filter-name>clickstreamFilter</filter-name>
        <filter-class>com.opensymphony.clickstream.ClickstreamFilter</filter-class>
    </filter>
    <filter>
        <filter-name>encodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>

    <filter>
        <filter-name>extensionsFilter</filter-name>
        <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
    </filter>
    <filter>
        <filter-name>gzipFilter</filter-name>
        <filter-class>net.sf.ehcache.constructs.web.filter.GzipFilter</filter-class>
    </filter>
    <!-- Remove this filter if you're using iBATIS, use OpenEntityManagerInViewFilter if using JPA -->
    <filter>
        <filter-name>lazyLoadingFilter</filter-name>
        <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
        <!--<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>-->
    </filter>
    <!--
    <filter>
        <filter-name>localeFilter</filter-name>
        <filter-class>org.appfuse.webapp.filter.LocaleFilter</filter-class>
    </filter>
    -->
    <filter>
        <filter-name>messageFilter</filter-name>
        <filter-class>org.appfuse.webapp.filter.MessageFilter</filter-class>
    </filter>
    <filter>
        <filter-name>rewriteFilter</filter-name>
        <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
        <init-param>
            <param-name>logLevel</param-name>
            <param-value>log4j</param-value>
        </init-param>
    </filter>
   <!-- <filter>
        <filter-name>securityFilter</filter-name>
        <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
        <init-param>
            <param-name>targetClass</param-name>
            <param-value>org.acegisecurity.util.FilterChainProxy</param-value>
        </init-param>
    </filter> -->
    <filter>
        <filter-name>securityFilterChain</filter-name>
        <filter-class>
            org.springframework.web.filter.DelegatingFilterProxy
        </filter-class>
    </filter>
    <filter>
        <filter-name>sitemesh</filter-name>
    <!--    <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class> -->
    <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>

    </filter>
    <!-- JavaScriptDetector Filter -->
    <filter>
        <filter-name>javascriptDetector</filter-name>
        <filter-class>
            com.g1.emessaging.webapp.filter.JavaScriptDetectorFilter
        </filter-class>
    </filter>

    <filter-mapping>
        <filter-name>encodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>javascriptDetector</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>securityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>extensionsFilter</filter-name>
        <servlet-name>faces</servlet-name>
    </filter-mapping>
    <filter-mapping>
        <filter-name>extensionsFilter</filter-name>
        <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>ajax4jsf</filter-name>
        <servlet-name>faces</servlet-name>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <!-- Commented out for 2 reasons: 1) it's a pain when developing JSPs, and
                                      2) it causes the Signup webtest to fail -->
    <!--filter-mapping>
        <filter-name>cacheFilter</filter-name>
        <url-pattern>*.jsp</url-pattern>
    </filter-mapping-->
    <filter-mapping>
        <filter-name>lazyLoadingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>clickstreamFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <!--
    <filter-mapping>
        <filter-name>localeFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    -->
    <filter-mapping>
        <filter-name>gzipFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>rewriteFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>messageFilter</filter-name>
        <url-pattern>*.html</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>

    <listener>
        <listener-class>com.opensymphony.clickstream.ClickstreamListener</listener-class>
    </listener>
<!--    <listener>
        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
    </listener> -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <listener>
        <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
    </listener>
    <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>
    <listener>
        <listener-class>com.g1.emessaging.webapp.listener.StartupListener</listener-class>
    </listener>

    <listener>
        <listener-class>com.g1.emessaging.webapp.listener.LicenseValidationListener</listener-class>
    </listener>

    <listener>
        <listener-class>org.appfuse.webapp.listener.UserCounterListener</listener-class>
    </listener>

    <listener>
        <listener-class>net.sf.navigator.menu.MenuContextListener</listener-class>
    </listener>
    <listener>
        <listener-class>com.g1.emessaging.webapp.action.SessionListener</listener-class>
    </listener>
    <servlet>
         <servlet-name>viewPart</servlet-name>
        <servlet-class>com.g1.emessaging.webapp.action.workflow.servlet.ViewPart</servlet-class>
    </servlet>
        <!--  <init-param>
       <param-name>javax.faces.LIFECYCLE_ID</param-name>
       <param-value>InterceptingLifecycle</param-value>
      </init-param> -->
    <servlet>
      <servlet-name>faces</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
    </servlet>
   <!--
    <servlet>
        <servlet-name>faces</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet> -->

    <servlet>
        <servlet-name>dwr-invoker</servlet-name>
        <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>true</param-value>
        </init-param>
    </servlet>

    <servlet>
        <servlet-name>ReadReceiptServlet</servlet-name>
        <servlet-class>com.g1.emessaging.outbound.servlet.ReadReceiptServlet</servlet-class>
    </servlet>
    <servlet>
        <servlet-name>SmsServlet</servlet-name>
        <servlet-class>com.g1.emessaging.inbound.sms.SmsServlet</servlet-class>
    </servlet>
    <servlet>
        <servlet-name>WorkflowItemProvider</servlet-name>
        <servlet-class>com.g1.emessaging.webapp.action.workflow.servlet.WorkflowItemProvider</servlet-class>
    </servlet>
    <servlet>
        <servlet-name>OutMessageProvider</servlet-name>
        <servlet-class>com.g1.emessaging.webapp.action.workflow.servlet.OutMessageProvider</servlet-class>
    </servlet>
    <servlet>
        <servlet-name>FailoverServlet</servlet-name>
        <servlet-class>com.g1.emessaging.failover.servlet.FailoverServlet</servlet-class>
    </servlet>

    <servlet>
        <servlet-name>CXFServlet</servlet-name>
        <servlet-class>
            org.apache.cxf.transport.servlet.CXFServlet
        </servlet-class>
        <load-on-startup>3</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>viewPart</servlet-name>
        <url-pattern>/pages/workflow/viewPart.html</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>faces</servlet-name>
        <url-pattern>*.html</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>dwr-invoker</servlet-name>
        <url-pattern>/dwr/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>ReadReceiptServlet</servlet-name>
        <url-pattern>/receipt/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>SmsServlet</servlet-name>
        <url-pattern>/sms/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>WorkflowItemProvider</servlet-name>
        <url-pattern>/workflow/WorkflowItemProvider</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>OutMessageProvider</servlet-name>
        <url-pattern>/workflow/OutMessageProvider</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>FailoverServlet</servlet-name>
        <url-pattern>/failover/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>CXFServlet</servlet-name>
        <url-pattern>/resource/*</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Protect XHTML Templates</web-resource-name>
            <url-pattern>*.xhtml</url-pattern>
        </web-resource-collection>
        <auth-constraint/>
   </security-constraint>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <error-page>
        <error-code>500</error-code>
        <location>/pages/error/genericException.jsp</location>
    </error-page>

    <error-page>
        <error-code>400</error-code>
        <location>/index.jsp</location>
    </error-page>

    <error-page>
        <error-code>403</error-code>
        <location>/PBBI403.jsp</location> <!-- SCR 69315 - get rid of appfuse picture-->
    </error-page>
    <error-page>
        <error-code>404</error-code>
        <location>/PBBI404.jsp</location> <!-- SCR 69315 - get rid of appfuse picture-->
    </error-page>

    <error-page>
        <exception-type>javax.servlet.ServletException</exception-type>
        <location>/pages/error/genericInvalidator.jsp</location>
    </error-page>

</web-app>


text:
Q: jQuery event ended handling works with bind but not on I'm trying to catch the "end" event of a video with jQuery 1.10
$('#hvid').on('ended', function() {
    window.console && console.log('ended');
});

where #hvid is the "id" of the <video> element.  This doesn't work and gives me an 'undefined is not a function' error. Same error if I use the 'delegated' version of "on", too.
But, if I use "bind" instead of "on", it works:
$('#hvid').bind('ended', function() {
    window.console && console.log('ended');
});

I understand that "bind" is deprecated so it's always preferred to use "on". Any obvious reason why "on" should not work?


text:
Q: Google Sheets API v4 values.get and values.batchGet returning undefined or return value is missing for empty cells Google Sheets API v4, Values.get is returning 'undefined' if the cell is empty. And Values.get returns {majorDimension=ROWS, range=Sheet1!J7:L7} without 'values' part if the cells are empty. Is there a way to get the following output if the cells are empty? Values.get to return [[]] instead of undefinedValues.batchGet to return {majorDimension=ROWS, values=[[]], range=Sheet1!J7:L7} instead of {majorDimension=ROWS, range=Sheet1!J7:L7} Here is the code:
function getOneCellValue() {
  var response = Sheets.Spreadsheets.Values.get("SpreadsheetId", "Sheet1!L20");
  Logger.log(response.values);
}

function getValueRanges() {
  var response = Sheets.Spreadsheets.Values.batchGet("SpreadsheetId", {ranges: ["Sheet1!D7:F7", "Sheet1!J7:L7"]});
  Logger.log(response.valueRanges);
}

Thank you.

A: The Sheets API Values.get() & Values.batchGet() ValueRange: values[] discards extra rows/columns if they are empty:

The data that was read or to be written. This is an array of arrays, the outer array representing all the data and each inner array representing a major dimension. Each item in the inner array corresponds with one cell.
For output, empty trailing rows and columns will not be included.

If you want the value(s) to come back as empty cells, use the built-in method range.getValues(). Or replace undefined with the [[]] value.
function getOneCellValue() {
  var response = Sheets.Spreadsheets.Values.get("SpreadsheetId", "Sheet1!L20");

  // Assign the empty array if undefined
  var api_value = response.values || [[]];

  Logger.log(api_value);

  // Or use getValues()
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var get_values = ss.getRange("Sheet1!L20").getValues();

  Logger.log(get_values);
}

A: Set majorDimension='COLUMNS' instead of majorDimension='ROWS'. Setting majorDimension='COLUMNS' returns placeholders where there are no values. Further information about the function arguments can be gotten here
result = sheet.values().get(
                            spreadsheetId=spreadsheet_id,
                            range=data_range,
                            majorDimension='COLUMNS'
                          ).execute()


text:
Q: Why I can not extract data from this dictionary though a loop? I'm extracting from data which is of type dictionary.
import urllib3
import json

http = urllib3.PoolManager()
url = 'https://raw.githubusercontent.com/leanhdung1994/BigData/main/fr-esr-principaux-etablissements-enseignement-superieur.json'
f = http.request('GET', url)
data = json.loads(f.data.decode('utf-8'))

data[0]["geometry"]["coordinates"]

geo = []
n = len(data)
for i in range(n):
    geo.append(data[i]["geometry"]["coordinates"])

It returns an error
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-26-52e67ffdcaa6> in <module>
     12 n = len(data)
     13 for i in range(n):
---> 14     geo.append(data[i]["geometry"]["coordinates"])

KeyError: 'geometry'

This is weird, because, when I only run data[0]["geometry"]["coordinates"], it returns [7.000275, 43.58554] without error.
Could you please elaborate on this issue?

A: Error is occuring because in few of the response dictionaries you don't habe "geometry" key.
Check before appending to geo list, that "geometry" key exists in response dict.
Try following code.
import urllib3
import json

http = urllib3.PoolManager()
url = 'https://raw.githubusercontent.com/leanhdung1994/BigData/main/fr-esr-principaux-etablissements-enseignement-superieur.json'
f = http.request('GET', url)
data = json.loads(f.data.decode('utf-8'))

geo = []
n = len(data)
for i in range(n):
    if "geometry" in data[i]:
        geo.append(data[i]["geometry"]["coordinates"])
print(geo)

A: I believe the problem is that there are places in your data which do not have a "geography" key. As a preliminary matter, your data structure is not technically a dictionary.  It is a 'list' of 'dictionaries'.  You can tell that by using the print(type(data)) and print(type(data[0]) commands.
I took your code but added the following lines:
dataStructure = data[0]
print(type(dataStructure))

geo = []
n = len(data)
for i in range(321):
    try:
        geo.append(data[i]["geometry"]["coordinates"])
    except:
        print(i)

If you run this, you will see that at index positions 64 and 130, there is no geometry key.  You may want to explore those entries specifically and see whether they should be removed from your data or whether you just need to alter the keyword to something else for those lines.


text:
Q: using XOR method 1 xor 1 will be equal to 1 can somebody share me the code for 1 xor 1 will be equal to one  thank you so much for the response.
  Dim a As Integer = TextBox1.Text
        Dim b As Integer = TextBox2.Text
    Dim firstPattern As Integer
    firstPattern = (a Xor b)

    Console.WriteLine(firstPattern)

out put is :
textbox1 = 1
textbox2 = 10101101
result is : 10101100
what i want is : 10101101

A: Based on what you said, you want Or, not Xor.
Dim firstPattern As Integer
firstPattern = (a Or b)
Console.WriteLine(firstPattern)

Bitwise/Logical operators in VB.net


text:
Q: Invalid digit, Value '\\', Pos 0, Type: Long error in Amazon redshift copy command I'm trying to unload the data from Amazon redshift table and then copying the data from s3 file to redshift by using following command.
unload ('select * from abx.xuz where src =\'vpc\'') to 's3://load/2017/' credentials 'aws_access_key_id=******;aws_secret_access_key=*****' allowoverwrite;

copy abc.abxy from 's3://sumo-processed/2017/'
credentials 'aws_access_key_id=XXXX;aws_secret_access_key=YY' NULL AS '\\0' TRUNCATECOLUMNS FILLRECORD  maxerror as 255;

But it is not able load all the records. After checking the stl_load_errors table it is showing "Invalid digit, Value '\', Pos 0, Type: Long" error.

How to resolve this error?. SO I can load all recording without skipping?

A: I was having similar error "Invalid digit, Value '.', Pos 2, Type: Integer", and the reason was pandas.io.sql.read_sql converting all "INT NULL" columns into "FLOAT"; so I had 10.0s instead of 10s in the dataframe. Then I dump the dataframe to S3, and then I import it from S3 to REDSHIFT using COPY , getting that error because COPY cannot import 10.0 to REDSHIFT's INT4.
Fix: replaced all "INT NULL" fields in the destination REDSHIFT table with "DECIMAL(10,0)"; after that COPY works like a charm.


text:
Q: NDK build with different mk file for release/debug We have a setup where our Android game contains a few native libraries that get built using ndk-build.
Our project contains the following structure:
Root
 |
 |-- jni
      |
      |-- Android.mk   // $include ( lib.mk ) and ( photon/photon.mk)
      |-- lib.mk
      |-- photon
            |
            |----- photon.mk
            |----- debug_android_armeabi.mk
            |----- release_android_armeabi.mk

One of the libs that get built (Photon) comes with 2 additional makefiles besides its main one - one for debug and one for release.
My question is - how can i pass this info to ndk-build such that the correct additional mk file will be picked up when building?

A: Probably, your photon.mk looks like
...
ifdef DEBUG
  include debug_android_armeabi.mk
else
  include release_android_armeabi.mk
endif
...

This way you can simply use
ndk-build DEBUG=1

If you want to lean on the ndk official features for release/debug build, you may prefer
...
ifeq ($(APP_OPTIM),debug)
  include debug_android_armeabi.mk
else
  include release_android_armeabi.mk
endif
...


text:
Q: Configuring network on a fresh installed 18.04: RTNETLINK answers: File exists I tried to install a new Ubuntu Server, but after the installation when I want to configure the network it didn't work using the Interface file.
so i tried as per duplicate to set up the network with netplanbut thqt fqils too.
netplan file:
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      addresses:
        - 193.171.201.236/27
      gateway4: 193.171.201.225
      nameservers:
          search: [pro2future.at, pro2future.eu]
          addresses: [140.78.2.62, 140.78.3.62]

How should I proceed?

A: I'm assuming you have already checkout out: https://help.ubuntu.com/community/NetworkManager
I have found it more friendly if you use 'renderer: NetworkManager'.  Place the following into /etc/netplan/01-netcfg.yaml
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp3s0:
      addresses: [ 193.171.201.236/27 ]
      gateway4: 193.171.201.225

Build /etc/NetworkManager/NetworkManager.conf something like this:
[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[device]
wifi.scan-rand-mac-address=no

[device-enp3s0]
match-device=interface-name:enp3s0
ignore-carrier=true
managed=true

[device-other]
match-device=type:ethernet
managed=false

Try a simple configuration first, then use 'ifconfig -a' to verify the configuration worked.
After you change the above netplan configuration file, restart the network:
netplan apply
systemctl restart network-manager

You may need to install the network-manager package, too.
apt-get install network-manager

You can also check the status with:
systemctl status network-manager


text:
Q: git@vger.kernel.org email issues / bug reports ignored I'm trying to raise 3 issues to the git mailing list at: git@vger.kernel.org.
One of them deomonstrates git trying to execute output.
My mail hasn't gone through when I search for my name.
I even tried subscribing to the list, and resending, but no joy.
The same problem occurred in 2018, but I choose to ignore it then.
How do I get my email to be accepted on git@vger.kernel.org?


text:
Q: Question on uniqueness in the proof used for the partial fraction algorithm Partial fraction algorithm
Let $\mathbb{F}$ be a field, and let $f(x)$, $a(x)$, $b(x)$ be
polynomials in $\mathbb{F}[x]$ such that $a(x)$ and $b(x)$ are coprime
and $\deg f < \deg a + \deg b$. Then there exist unique polyniomials
$r(x)$ and $s(x)$ with $\deg r < \deg a$, $\deg s < \deg b$ such that
$$\frac{f(x)}{a(x) b(x)} = \frac{r(x)}{a(x)} + \frac{s(x)}{b(x)}.$$
I think existence of the polynomials can be shown as follows:
As $a(x)$ and $b(x)$ are coprime they will have no factors in
common. Thus $\gcd (a(x),b(x)) = 1$. Now from Bezout's identity
there exist polynomials $g(x)$ and $h(x)$ such that
$$1 = a(x) \cdot g(x) + b(x) \cdot h(x).$$
Now
\begin{align*}
\frac{f(x)}{a(x) b(x)} &= \frac{f(x) \cdot 1}{a(x) b(x)}\\
&= \frac{f(x) \left (a(x) \cdot g(x) + f(x) \cdot b(x) \right )}{a(x)
  b(x)}\\
&= \frac{f(x) \cdot a(x) \cdot g(x)}{a(x) b(x)} + \frac{f(x) \cdot b(x)
    \cdot h(x)}{a(x) b(x)}\\
&= \frac{f(x) \cdot h(x)}{a(x)} + \frac{f(x) \cdot g(x)}{b(x)}
\end{align*}
And if we let $r(x) = f(x) \cdot h (x)$ and $s(x) = f(x) \cdot g(x)$
this gives
$$\frac{f(x)}{a(x)b(x)} = \frac{r(x)}{a(x)} + \frac{s(x)}{b(x)},$$
and shows existence.
Questions

*

*How do I know $\deg r < \deg a$ and $\deg s < \deg b$?

*How does one go about showing the uniqueness of $r(x)$ and $s(x)$?

A: Your original $r(x)$ might not have small enough degree; but the division algorithm allows you to write $r(x) = t(x) a(x) + u(x)$ where $\deg u < \deg a$. Writing $v(x) = s(x) - t(x) b(x)$ gives $$\frac{f(x)}{a(x)b(x)} = \frac{u(x)}{a(x)} + \frac{v(x)}{b(x)};$$ can you verify that $\deg v < \deg b$?
As for uniqueness, try subtracting two such representations from each other; you'll get
$$
\frac{r(x)-r'(x)}{a(x)} = \frac{s'(x)-s(x)}{b(x)}.
$$
By coprimality of $a(x)$ and $b(x)$, you should be able to prove that $a(x)$ divides $r(x)-r'(x)$ (and similarly for the other fraction); and this will imply the required uniqueness.