text:
Q: Where's the error in this $2=1$ fake proof? I'm reading Spivak's Calculus:

2 What's wrong with the following "proof"? Let $x=y$. Then
$$x^2=xy\tag{1}$$
$$x^2-y^2=xy-y^2\tag{2}$$
$$(x+y)(x-y)=y(x-y)\tag{3}$$
$$x+y=y\tag{4}$$
$$2y=y\tag{5}$$
$$2=1\tag{6}$$

I guess the problem  is in $(3)$, it seems he tried to divide both sides by $(x-y)$. The operation would be acceptable in an example such as:

$$12x=12\tag{1}$$
$$\frac{12x}{12}=\frac{12}{12}\tag{2}$$
$$x=1\tag{3}$$

I'm lost at what should be causing this, my naive exploration in the nature of both examples came to the following: In the case of $12x=12$, we have an imbalance: We have $x$ in only one side then operations and dividing both sides by $12$ make sense.
Also, In  $\color{red}{12}\color{green}{x}=12$ we have a $\color{red}{coefficient}$ and a $\color{green}{variable}$, the nature of those seems to differ from the nature of
$$\color{green}{(x+y)}\color{red}{(x-y)}=y(x-y)$$
It's like: It's okay to do the thing in $12x=12$, but for doing it on $(x+y)(x-y)=y(x-y)$ we need first to simplify $(x+y)(x-y)$ to $x^2-y^2$.

A: We have $x = y$, so $x - y = 0$.
EDIT: I think I should say more. I'll go through each step:

$x = y \tag{0}$

This is our premise that $x$ and $y$ are equal.

$$x^2=xy\tag{1}$$

Note that $x^2 = xx = xy$ by $(0)$. So completely valid.

$$x^2-y^2=xy-y^2\tag{2}$$

Now we're adding $-y^2$ to both sides of $(1$) so completely valid and we can see that it's another way of expressing $0 = 0$ as $x=y$, but nothing wrong here yet.

$$(x+y)(x-y)=y(x-y)\tag{3}$$
$$x+y=y\tag{4}$$

Step $(3)$ is just basic factoring, and it is around here where things begin to go wrong. For $(4)$ to be a valid consequence of $(3)$, I would need $x - y \neq 0$ as otherwise, we would be dividing by $0$. However, this is in fact what we've done as $x=y$ implies that $x - y =0$. So $(3)-(4)$ is where things go wrong.

$$2y=y\tag{5}$$
$$2=1\tag{6}$$

As a consequence of not being careful, we end up with gibberish.
Hope this clarifies more!

A: We have $x=y$ firstly and from $3$ to $4$ we assume $x\ne y$ simultaneously.


text:
Q: How to get the names and ids of test cases that are under the Tested By section of a user story in tfs Tested BY(19)
Under tested by there are 19 test cases.
If the id of the user story is given how to get these test cases.
If (Link link is Related) returns all the links.
How to get just the test cases.
Any help would be appreciated. I just started working with tfs using c#

A: You could use TFS REST API to get the information you need, the Microsoft.VSTS.Common.TestedBy-Forward relation is the TestedBy link type. The API is as below:
GET https://{account}.visualstudio.com/{project}/_apis/wit/workitems/{id}?$expand=Relations&api-version=5.0-preview.3

The following screenshot is the response of the REST API:

Here is a sample with client library to get test case ids from the User Story for your reference:
using System;
using Microsoft.VisualStudio.Services.Client;
using Microsoft.VisualStudio.Services.WebApi;
using Microsoft.TeamFoundation.WorkItemTracking.WebApi;
using Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models;

namespace GetWorkItemFullyExpanded
{
    class Program
    {
        static void Main(string[] args)
        {
            GetWorkItemFullyExpanded();
        }

        public static WorkItem GetWorkItemFullyExpanded()
        {
            int id = xx;

            var myCredentials = new VssClientCredentials();
            var connection = new VssConnection(new Uri(@"https://xxxx.visualstudio.com"), myCredentials);
            WorkItemTrackingHttpClient workItemTrackingClient = connection.GetClient<WorkItemTrackingHttpClient>();

            WorkItem workitem = workItemTrackingClient.GetWorkItemAsync(id, expand: WorkItemExpand.Relations).Result;

            Console.WriteLine(workitem.Id);

            Console.WriteLine("Relations: ");
            foreach (var relation in workitem.Relations)
            {

                if (relation.Rel == "Microsoft.VSTS.Common.TestedBy-Forward")
                    Console.WriteLine(relation.Url);

            }

            return workitem;
        }

    }
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Exim Filter to change recipient Lets say I have this filter for user1 who doesn't exist on our network, but has an external email we want to send the emails to:
if
 $header_to: matches "user1@domain.com"
then
 deliver "user1@externaldomain.com"
endif

If someone then sends a mail to user1@domain.com it correctly gets delivered to user1@externaldomain.com
However, if they send to user1@domain.com, user2@domain.com then the email only gets delivered to user1@externaldomain.com
user2@domain.com doesn't get sent the email.
I think this is because the deliver command is significant, so nothing further happens.
Normally, you would use unseen deliver to ensure the email is processed further - but then this would (I assume) result in the email being delivered to user1@domain.com locally (in addition to user2@domain.com), which isn't wanted.
What is the right way to set up this filter so that the emails will go to the external party and the internal user if they are both in the To: field?


text:
Q: Docker on Windows Server 2016 (1803) can't build same dockerfile on Windows 10 I am trying to create a Windows Docker image built off the microsoft/wcf image. The WCF service relies on a COM component that is installed and registered from an MSI from a 3rd party.
Dockerfile:
FROM microsoft/wcf

WORKDIR C:/local

COPY SomeInstaller.exe ./

RUN ./SomeInstaller.exe /SP /VERYSILENT /SUPPRESSMSGBOXES /NOICONS

WORKDIR "C:/Program Files/SomeProgram/Interface"

RUN regsvr32 SomeProgramCOM.dll /s

WORKDIR C:/certs
COPY ./ops-certs .

RUN powershell "./Install-OpsCertificates.ps1"

When I build this on my local Windows 10 environment, it works correctly. The installer finishes successfully, the files are located in the right location, and the COM registration passes. However, when I run this on our build server (Windows Server 2016 1803 update) the installer does not work (fails silently) and the COM dll is not being registered.
Shouldn't the output be the exact same when building this Dockerfile?
Build output
Status: Downloaded newer image for microsoft/wcf:latest
 ---> e4b543a82489
Step 2/9 : WORKDIR C:/local
Removing intermediate container cf6b7d21b207
 ---> 5e943a9bd1be
Step 3/9 : COPY SomeProgram.exe ./
 ---> c1e0781fb180
Step 4/9 : RUN ./SomeProgram.exe /SP /VERYSILENT /SUPPRESSMSGBOXES /NOICONS
 ---> Running in 2cc2bb26cea4
Removing intermediate container 2cc2bb26cea4
 ---> 1ed4cbf280ad
Step 5/9 : WORKDIR "C:/Program Files/SomeProgram/Interface"
Removing intermediate container 9c5df9cc4cfd
 ---> 5387093d3311
Step 6/9 : RUN regsvr32 SomeProgramCOM.dll /s
 ---> Running in 66ddc85117fc
Removing intermediate container 66ddc85117fc
 ---> 453a43979c71
Step 7/9 : WORKDIR C:/certs
Removing intermediate container 03fefdeb069b
 ---> a42989c178fb
Step 8/9 : COPY ./ops-certs .
 ---> 4d60c35a7bab
Step 9/9 : RUN powershell "./Install-OpsCertificates.ps1"
 ---> Running in 8cecda9be47c
Scrip execution directory is C:\certs
Installing Certificates . . .

   PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\Root

Thumbprint                                Subject
----------                                -------
8C048578CA1E43CB577C2A64C3AD3101C64FAFC3  CN=MyCompany Root Certificate...
8C048578CA1E43CB577C2A64C3AD3101C64FAFC3  CN=MyCompany Root Certificate...
Import of Root certificate to Root Store Succeeded!!!!!!

   PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\CA

Thumbprint                                Subject
----------                                -------
8C048578CA1E43CB577C2A64C3AD3101C64FAFC3  CN=MyCompany Root Certificate...

   PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\Root

Thumbprint                                Subject
----------                                -------
8C048578CA1E43CB577C2A64C3AD3101C64FAFC3  CN=MyCompany Root Certificate...
Import of Root certificate to CA Store Succeeded!!!!!!

   PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\CA

Thumbprint                                Subject
----------                                -------
22A3E8B4AEC702987A2CBAEDD42573ED97E5BB53  CN=MyCompany Secure Certifica...
22A3E8B4AEC702987A2CBAEDD42573ED97E5BB53  CN=MyCompany Secure Certifica...
Import of Intermediate certificate to CA Store Succeeded!!!!!!

Removing intermediate container 8cecda9be47c
 ---> 73b2682580ce
Successfully built 73b2682580ce
Successfully tagged local/someprogram:latest

Also, note that I did run the installer for SomeProgram on the windows server and it worked properly, so there should be no compatibility issues.


text:
Q: An acting condition for a superposition operator from $H^1(\Omega)$ to $H^1(\Omega)$ If i take $v\in H^1(\Omega)$ where
$$
H^1(\Omega)=\{u\in L^2(\Omega), \frac{\partial u}{\partial x_i}\in L^2(\Omega), i=1,\ldots,N\}
$$
$\Omega$ is bounded open set from $\mathbb{R}^N$
What is the sufficient condition for a real function $f:\mathbb{R}\rightarrow \mathbb{R}$ to have that $f\circ v\in H^1(\Omega)$
Thank you

A: The obvious sufficient condition for $v\mapsto f(v)$ to map $H^1(\Omega)$ to itself ($\Omega$ bounded) is $f$ globally Lipschitz, i.e. $f'\in L^\infty(\mathbb R)$. Add $f(0)=0$ for general $\Omega$.
This condition is also necessary for $N\ge2$, I think (but don't ask me for a reference, that's folk wisdom, although it must be proven somewhere).

A: The following is stated in the paper
Moshe Marcus and Victor J. Mizel, MR 531975 Complete characterization of functions which act, via superposition, on Sobolev spaces, Trans. Amer. Math. Soc. 251 (1979), 187--218.
as Theorem 1 (note that $T_f$ is the superposition operator corresponding to $f$ and that the paper assumes $\Omega$ to satisfy the cone condition):

Suppose that $\Omega$ is bounded. Let $f \colon \mathbb R^m \to \mathbb R$ be a Borel function and let $p$, $r$ be two such that $1 \le r \le p < N$. Then $T_f$ maps $W^{1,p}(\Omega)^m$ into $W^{1,r}(\Omega)$ if and only if the following conditions hold:

*

*$f$ is locally Lipschitz in $\mathbb R^m$

*The first order partial derivatives of $f$ satisfy the inequality
  $$ \left| \frac {\partial f}{\partial \xi_i}(\xi) \right| \le a_0(1+|\xi|^\nu)\ \text{a.e. in $\mathbb R^m$, $i = 1,\dotsc,m$}$$
  where $a_0$ is a constant and $\nu = N(p-r)/(r(N-p))$.

  If $N < p$ (or $N = 1$ and $1 \le p$) and $1 \le r \le p$ then $T_f$ maps $W^{1,p}(\Omega)^m$ into $W^{1,r}(\Omega)$ if and only if condition 1 holds.

The theorem goes on to state that under these circumstances $T_f$ is a continuous operator; bounds are established for its image, too. The case of unbounded $\Omega$ is considered in the same paper, see Theorem 3.

A: Maybe just a long comment: if you want this property for any $f$ polynomial (or any smooth $f$), you will need $H^1$ to be an algebra, which is true only in  1D ($N=1$). More generally, $H^s$ is an algebra iff $s>N/2$.
Now the previous comment is also pointing out that, excluding the trivial case where $f$ is an affine function, you will essentially need your Sobolev space to be an algebra, which requires $s>N/2$. Note that there is a nice proof, using Bernstein polynomials, that these Sobolev spaces ($H^s$ with $s>N/2$) are stable by composition by a general smooth function $f$.


text:
Q: Google Form: manipulate DOM element I have a Google Form that, on load, I want to find a specific input box and manipulate - this example, changing the background to red.
This is what I have so far, but it doesn't appear to work. I tried using console.log instead to see if it was working but it didn't seem to do anything.
Current project's triggers
Run: myFunction
Events: From form | On Open

Code
function myFunction() {
  document.querySelectorAll('[aria-label="Job ID"]').setAttribute("style", "background-color: red;");
 }

A: Right now it is not possible to style Google Forms unless you copy the code and self host it.
See related questions:
Change background color of a Google Form using the App Script API
Change form palette via google scripts
And issue on google.com:
Issue: Access to the color palette option in Google Forms


text:
Q: Using class extending asynctask to check internet connection in android activity By checking some questions on here I have managed to create the below class in order to check whether the user has an active internet connection. I want to use this in my android activities to check the connection before I load any data from the internet. I would like to ask if this is a suitable way of checking the user's internet connection and I would like someone to provide an example of how this would be called from within an activity (how to pass the context to it and how to obtain the true/false response back in my android activity.
public class ConnectionStatus  {
private Context context;

public ConnectionStatus(Context context){
    this.context=context;
}
public static boolean isNetworkAvailable(Context c) {
    NetworkInfo netInfo = null;
    try {
        ConnectivityManager cm = (ConnectivityManager) c
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        netInfo = cm.getActiveNetworkInfo();
    } catch (SecurityException e) {
        e.printStackTrace();
    }
    return netInfo != null && netInfo.isConnectedOrConnecting();
}
public boolean CheckConnection() {
    if (isNetworkAvailable(context)) {
        try {
            HttpURLConnection urlc = (HttpURLConnection)
                    (new URL("http://clients3.google.com/generate_204")
                            .openConnection());
            urlc.setRequestProperty("User-Agent", "Android");
            urlc.setRequestProperty("Connection", "close");
            urlc.setConnectTimeout(1500);
            urlc.connect();
            return (urlc.getResponseCode() == 204 &&
                    urlc.getContentLength() == 0);
        } catch (IOException e) {
            Log.e("TAG", "Error checking internet connection", e);
        }
    } else {
        Log.d("TAG", "No network available!");
    }
    return false;
}
}

A: I would get the network info outside the Async Task since it would be easier for you to handle how to react on the given network status.
For the Async Task, you could make it an inner class of your Activity, and check for the network status before calling the execute method of the Async Task.
public class MyActivity extends Activity{

...
...
  private static boolean isNetworkAvailable(Context c) {
    NetworkInfo netInfo = null;
    try {
      ConnectivityManager cm = (ConnectivityManager) c
            .getSystemService(Context.CONNECTIVITY_SERVICE);
      netInfo = cm.getActiveNetworkInfo();
    } catch (SecurityException e) {
      e.printStackTrace();
    // Something bad happen, better return false.
      return false;
    }
    return netInfo != null && netInfo.isConnectedOrConnecting();
  }

//Let's assume you will call your data from the internet like this
  private void getDataFromTheInternet(){
  if (isNetworkAvailable){
     ConnectionStatus cStatus = new ConnectionStatus(getApplicationContext());
    cStatus.execute();
  }else{
  //Prevent the user that there is not a network connection
  }
}

Now, remove the isNetworkAvailable methof from the Asynk Task and there you go.
Additionally you could use a BroadCast receiver to check everytime the connection status changes so your application can react when it's offline or online following this tutorial

A: Here is an example of an Activity class that includes an AsyncTask, and shows how you could use your ConnectionStatus class in the updated version of your question.
public class MainActivity extends AppCompatActivity {

    TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        textView = (TextView) findViewById(R.id.text);

        //Create Strings to pass to varargs of AsyncTask
        String s1 = "test1";
        String s2 = "test2";
        new MyAsync().execute(s1, s2);

    }

    class MyAsync extends AsyncTask<String, String, String> {

        ConnectionStatus status;

        @Override
        protected void onPreExecute() {

        }

        @Override
        protected String doInBackground(String... params) {

            String retVal = null;

            //Instantiate your object, use MainActivity.this for Context
            status = new ConnectionStatus(MainActivity.this);

            //capture varargs
            String sOne = params[0];
            String sTwo = params[1];

            boolean something = false;

            //Check network connectivity:
            if (status.CheckConnection()){

                //You have internet, do your network operations here
                //...............

                //Just here for an example:
                if (something == true){
                    retVal = sOne;
                }
                else{
                    retVal = sTwo;
                }

            }

            return retVal;
        }

        @Override
        protected void onPostExecute(String arg) {
            //Update UI here, this runs on the Main UI thread of the Activity
            if (arg != null){
                textView.setText(arg);
            }
        }
    }

}


text:
Q: Reference Azure Table Storage into a Portable Class Library (PCL) I've just created a portable class library that used the Azure Table storage v7.0.1-preview.
And I have some problem making this works properly. The code below throw an exception (TypeLoadException):
 var cloudStorageAccount = CloudStorageAccount.Parse(connectionString);
 var cloudTable = cloudStorageAccount.CreateCloudTableClient().GetTableReference(settingsTableName);
 var seg = await cloudTable.ExecuteQuerySegmentedAsync(new TableQuery(), null);
 return seg.Results;

Could not load type 'Microsoft.WindowsAzure.Storage.Table.TableQuerySegment' from assembly 'Microsoft.WindowsAzure.Storage, Version=7.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

I've created a portable class library :

I've added a reference to the WindowsAzure.Storage v7.0.1-preview:
Install-Package WindowsAzure.Storage -Version 7.0.1-preview

So to reproduce the problem, I've got a single class in this library:
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;

public class AzureTableUtilitiy
{
    public static async Task<IList<DynamicTableEntity>> RetrieveAsync(string connectionString, string settingsTableName)
    {
        var cloudStorageAccount = CloudStorageAccount.Parse(connectionString);
        var cloudTable = cloudStorageAccount.CreateCloudTableClient().GetTableReference(settingsTableName);
        var seg = await cloudTable.ExecuteQuerySegmentedAsync(new TableQuery(), null);
        return seg.Results;
    }
}

And I just wanted to test it ... using a console app (named AzureTableStorageTest) => I've added a reference to WindowsAzure.Storage v7.0.1-preview also in this project.
The Console App has a reference to the Portable CLass Library.
class Program
{
    static void Main(string[] args)
    {
        var result = AzureTableUtilitiy.RetrieveAsync(
         ConfigurationManager.ConnectionStrings["StorageAccountConnectionstring"].ConnectionString,
         "ExternalSettingsStore").Result;
    }
}

So the code above throw the exception. But If I execute the code directly from the console app, every thing work fine:
class Program
{
    static void Main(string[] args)
    {
        var cloudStorageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["StorageAccountConnectionstring"].ConnectionString);
        var cloudTable = cloudStorageAccount.CreateCloudTableClient().GetTableReference("ExternalSettingsStore");
        var seg = cloudTable.ExecuteQuerySegmentedAsync(new TableQuery(), null).Result;
        var result = seg.Results;
    }
}

Can someone explain me what I am missing ^^ ?
EDIT : Details of the exception:
A System.TypeLoadException is thrown.

*

*Message: Could not load type 'Microsoft.WindowsAzure.Storage.Table.TableQuerySegment' from assembly 'Microsoft.WindowsAzure.Storage, Version=7.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

*StackTrace:
at AzureTableStorageUtility.AzureTableUtilitiy.RetrieveAsync(String connectionString, String settingsTableName)
at AzureTableStorageTest.Program.Main(String[] args) in C:\Projects\AzureTableStorageTest\AzureTableStorageTest2\Program.cs:line 24
EDIT
this is a sample app that reproduce the issue :

*

*https://github.com/CrazyTuna/azure-table-storage-pcl

A: this is a shot in the dark here, but could you try changing the value of "Copy Local" in your PCL's Microsoft.WindowsAzure.Storage reference to true.
Here's an article that talks about this: https://blogs.msdn.microsoft.com/asiatech/2013/01/09/how-to-resolve-the-could-not-load-file-or-assembly-issues-on-windows-azure-web-sites/


text:
Q: Sorting algorithm proof and running-time Hydrosort is a sorting algorithm. Below is the pseudocode.
*/A is arrary to sort, i = start index, j = end index */

    Hydrosort(A, i, j):                 // Let T(n) be the time to find where n = j-1+1

      n = j – i + 1                              O(1)
      if (n < 10) {                              O(1)
        sort A[i…j] by insertion-sort            O(n^2) //insertion sort = O(n^2) worst-case
        return                                   O(1)
      }
      m1 = i + 3 * n / 4                         O(1)
      m2 = i + n / 4                             O(1)
      Hydrosort(A, i, m1)                        T(n/2)
      Hydrosort(A, m2, j)                        T(n/2)
      Hydrosort(A, i, m1)                        T(n/2)

T(n) = O(n^2) + 3T(n/2), so T(n) is O(n^2).  I used the 3rd case of the Master Theorem to solve this recurrence.
I have 2 questions:

*

*Have I calculated the worst-case running time here correctly?

*how would I prove that Hydrosort(A, 1, n) correctly sorts an array A of n elements?

A:
Have I calculated the worst-case running time here correctly?

I am afraid not.
The complexity function is:
T(n) = 3T(3n/4) + CONST

This is because:

*

*You have three recursive calls for a problem of size 3n/4

*The constant modifier here is O(1), since all non recursive calls operations are bounded to a constant size (Specifically, insertion sort for n<=10 is O(1)).

If you go on and calculate it, you'll get worse than O(n^2) complexity

how would I prove that Hydrosort(A, 1, n) correctly sorts an array A
  of n elements?

By induction. Assume your algorithm works for problems of size n, and let's examine a problem of size n+1. For n+1<10 it is trivial, so we ignore this case.

*

*After first recursive call, you are guaranteed that first 3/4 of the
array is sorted, and in particular you are guaranteed that the first n/4 of the elements are the smallest ones in this part. This means, they cannot be in the last n/4 of the array, because there are at least n/2 elements bigger than them. This means, the n/4 biggest elements are somewhere between m2 and j.

*After second recursive call, since it is guaranteed to be invoked on the n/4 biggest elements, it will place these elements at the end of the array. This means the part between m1 and j is now sorted properly. This also means, 3n/4 smallest elements are somewhere in between i and m1.

*Third recursive call sorts the 3n/4 elements properly, and the n/4 biggest elements are already in place, so the array is now sorted.


text:
Q: Google Maps V3 Show Map on Google Maps Link I am using a javascript Google Maps V3 to show the location of places I have on my site, I can only offer a small view on my site so anyone who wants to see the larger map on google should either click on the Google icone on the bottom left, or in some cases I saw a link/button on the map stating "click to show on Google Maps".
So my question is how to show the link/button on my map that can open the same location on google maps site.

A: Google map provides an option to customize the link by adding some parameters for viewing map.
You can get the list of parameters here:
http://alvarestech.com/temp/routeconverter/RouteConverter/navigation-formats/src/main/doc/googlemaps/Google_Map_Parameters.htm
You'll need to pass the parameters to the link.
Example: https://www.google.com.au/maps/preview/@,,
You can also refer this post for more details: How do I link to Google Maps with a particular longitude and latitude?


text:
Q: Hide comma between anchor tags in a div with CSS I have this kind of HTML:

    link,
    link,
    link

How could I hide the commas with css?
I've tried:
.meta{
    display: none;
}
meta a{
    display: inline;
}

but this has no effect as it affects the parent. Also I tried:
.meta *:not(a){
    display: none;
}

...but this removes everything, so no luck!

A: I finally resorted to jquery with this:
jQuery('.meta').each(function() {
    var text = jQuery(this).text();
    jQuery(this).text(text.replace(',', ' '));
});

...but if anyone finds a CSS solution I will give them the answer.


text:
Q: Wrong table placement I have following MWE:
\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[color=red,opacity=0.1,contents={}]{background}
\usepackage{hyperref}
\usepackage{indentfirst}
\usepackage{caption}
\usepackage{listings}
\usepackage[listingsutf8]{tcolorbox}
\usepackage{tcolorbox}
\usepackage[slovene]{babel}
\usepackage{titlesec}
\usepackage{float}
\usepackage{pifont}

\setcounter{secnumdepth}{4}

\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\author{Marko Frelih \\ Company \\ \texttt{email}}
\title{Installation manual}
\date{Ljubljana, Marec 2015}

\begin{document}
\maketitle
\thispagestyle{empty}
\pagebreak
\clearpage
\pagenumbering{arabic}

\AddEverypageHook{
  \ifnum\value{page}<1\relax
  \else
  \backgroundsetup{contents={ZAUPNO}}
  \fi
\BgMaterial
}

\section{Zgodovina dokumenta}
\begin{table}[htbp]
    \begin{center}
        \begin{tabular}{|c|c|c|c|}
            \hline Verzija & Avtor & Datum & Opis \\
            \hline 0.1 & texttexttexttexttexttexttext & 04/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.2 & texttexttexttexttexttexttext & 05/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.3 & texttexttexttexttexttexttext & 05/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.4 & texttexttexttexttexttexttext & 05/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.5 & texttexttexttexttexttexttext & 06/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.6 & texttexttexttexttexttexttext & 08/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.7 & texttexttexttexttexttexttext & 11/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.8 & texttexttexttexttexttexttext & 20/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.9 & texttexttexttexttexttexttext & 21/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline
        \end{tabular}
    \end{center}
    \caption{Zgodovina dokumenta}\label{tblZgodovinaDokumenta}
\end{table}
\pagebreak

\end{document}

It produces output, shown as screenshot:

As you can see, the table is not position as I would like, to be horizontaly centered. How do I horizontally center the table?

A: Your tabular is too wide and doesn't fit in the page.
To overcome this, insert your tabular inside \resizebox{\linewidth}{!}{....}.
MWE:
\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[color=red,opacity=0.1,contents={}]{background}
\usepackage{hyperref}
\usepackage{indentfirst}
\usepackage{caption}
\usepackage{listings}
\usepackage[listingsutf8]{tcolorbox}
\usepackage{tcolorbox}
\usepackage[slovene]{babel}
\usepackage{titlesec}
\usepackage{float}
\usepackage{pifont}

\setcounter{secnumdepth}{4}

\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\author{Marko Frelih \\ Company \\ \texttt{email}}
\title{Installation manual}
\date{Ljubljana, Marec 2015}

\begin{document}
\maketitle
\thispagestyle{empty}
\pagebreak
\clearpage
\pagenumbering{arabic}

\AddEverypageHook{
  \ifnum\value{page}<1\relax
  \else
  \backgroundsetup{contents={ZAUPNO}}
  \fi
\BgMaterial
}

\section{Zgodovina dokumenta}
\begin{table}[htbp]
\centering
\resizebox{\linewidth}{!}{%
        \begin{tabular}{|c|c|c|c|}
            \hline Verzija & Avtor & Datum & Opis \\
            \hline 0.1 & texttexttexttexttexttexttext & 04/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.2 & texttexttexttexttexttexttext & 05/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.3 & texttexttexttexttexttexttext & 05/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.4 & texttexttexttexttexttexttext & 05/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.5 & texttexttexttexttexttexttext & 06/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.6 & texttexttexttexttexttexttext & 08/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.7 & texttexttexttexttexttexttext & 11/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.8 & texttexttexttexttexttexttext & 20/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.9 & texttexttexttexttexttexttext & 21/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline
        \end{tabular}%
}
    \caption{Zgodovina dokumenta}\label{tblZgodovinaDokumenta}
\end{table}
\pagebreak

\end{document}

Output:

As a side note, use \centering instead of the center environment inside the table to center its contents.

As Paul Gessler suggests, another method is to use a suitable font size inside your table. In your case, \scriptsize will make your table fit in the page:
MWE:
\documentclass[12pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[color=red,opacity=0.1,contents={}]{background}
\usepackage{hyperref}
\usepackage{indentfirst}
\usepackage{caption}
\usepackage{listings}
\usepackage[listingsutf8]{tcolorbox}
\usepackage{tcolorbox}
\usepackage[slovene]{babel}
\usepackage{titlesec}
\usepackage{float}
\usepackage{pifont}

\setcounter{secnumdepth}{4}

\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}

\author{Marko Frelih \\ Company \\ \texttt{email}}
\title{Installation manual}
\date{Ljubljana, Marec 2015}

\begin{document}
\maketitle
\thispagestyle{empty}
\pagebreak
\clearpage
\pagenumbering{arabic}

\AddEverypageHook{
  \ifnum\value{page}<1\relax
  \else
  \backgroundsetup{contents={ZAUPNO}}
  \fi
\BgMaterial
}

\section{Zgodovina dokumenta}
\begin{table}[htbp]
\centering
\scriptsize
        \begin{tabular}{|c|c|c|c|}
            \hline Verzija & Avtor & Datum & Opis \\
            \hline 0.1 & texttexttexttexttexttexttext & 04/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.2 & texttexttexttexttexttexttext & 05/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.3 & texttexttexttexttexttexttext & 05/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.4 & texttexttexttexttexttexttext & 05/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.5 & texttexttexttexttexttexttext & 06/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.6 & texttexttexttexttexttexttext & 08/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.7 & texttexttexttexttexttexttext & 11/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.8 & texttexttexttexttexttexttext & 20/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline 0.9 & texttexttexttexttexttexttext & 21/03/2015 & texttexttexttexttexttexttexttexttexttext\\
            \hline
        \end{tabular}
    \caption{Zgodovina dokumenta}\label{tblZgodovinaDokumenta}
\end{table}
\pagebreak

\end{document}

The output is (almost) the same as above.


text:
Q: Catch trigger's exceptions from db in Django How to catch triggers exceptions in Django admin site when you add or edit records?
For example I have model
class Flight(models.Model):
    flight_num = models.CharField(max_length=10, primary_key=True)
    departure = models.CharField(max_length=30)
    arrival = models.CharField(max_length=30)
    departure_time = models.TimeField()
    arrival_time = models.TimeField()

    def __str__(self):
        return self.flight_num

and trigger in PostgreSQL 9.1
BEGIN
    if (NEW.departure_time > NEW.arrival_time)
    then raise EXCEPTION 'It's unreal';
    end if;
    RETURN NEW;
END;

The model is registered in admin.site. Thank you.


text:
Q: How to combine two filepaths (as strings) removing extra "/" in C++ The user enters as a basepath "test/" or he enters "test". Now I want to store dataset A in "test/dataA/file1.dat" etc. and dataset B in "test/dataB/file1.dat" etc.
Since I do not know if the user enters "test" or "test/" I should check if there is a "/" at the end or not to combine the strings correctly.
How can I do this in a short and clean way?
#include <string>

using namespace std;

int main() {
    string user1 = "test";
    string user2 = "test/";

    string relativeFilePath = "/dataA/data.dat";

    /*
    cout << f(user1, relativeFilePath) << endl; //should return "test/dataA/data.dat"
    cout << f(user2, relativeFilePath) << endl; //should return the same

    */

    return 0;
}

A: Try the following
user2[user2.Size()-1] == L"/"

A: You are manipulating std::string so you can take advantage of function that it provides (back return a reference to the last character, pop_back() erase the last character):
if (!user2.empty() && user2.back()=='/') user2.pop_back();

A: Implement a function, trim_trailing_slash.
void trim_trailing_slash(std::string& s)
{
   // Remove all trailing slashes.
   while ( !s.empty() && s.back() == '/' )
   {
      s.pop_back();
   }
}

and then use it in f.
std::string f(std::string const& user, std::string const& relativeFilePath)
{
   std::string ret = user;
   trim_trailing_slash(ret);
   ret += relativeFilePath;
   return ret;
}

A: In addition to the answers above, you could also make use of [string::replace]  http://www.cplusplus.com/reference/string/string/replace/)
or
[string::erase] (http://www.cplusplus.com/reference/string/string/erase/) to accomplish this.


text:
Q: ts-loader with sass-loader & ExtractTextPlugin This topic could be considered as a continuation of my previous question related to webpack & ts-loader
Now I am trying to understand how to use sass-loader with ts-loader and  ExtractTextPlugin. After hours of digging it seems that ExtractTextPlugin is parsing node_modules and hence fails.
In the code example below you can see the commented part (the old style loader part) and new one which I'm trying to make work with guidance from sass-loader docs.
Currently I am stuck on this (and dozens of other similar parsing issues from node_modules):

webpack.config.js

const path = require('path');
const ExtractTextPlugin = require("extract-text-webpack-plugin"); // <-- as soon as this is imported, the build fails

const extractSass = new ExtractTextPlugin({
    filename: "[name].[contenthash].css",
    disable: process.env.NODE_ENV === "development"
});

module.exports = env => {
    return {
        devtool: "inline-source-map",
        entry: "./src/index.tsx",
        output: {
            path: path.resolve(__dirname, "/public"),
            filename: "build/app.js"
        },
        resolve: {
            extensions: [".ts", ".tsx", ".js", ".json", ".scss"],
        },
        module: {
            rules: [
                {
                    test: /\.tsx?$/,
                    exclude: path.resolve(__dirname, "/node_modules"),
                    loader: "ts-loader",
                },
                {
                    test: /\.scss$/,
                    exclude: path.resolve(__dirname, "/node_modules"),
                    use: extractSass.extract({
                        use: [
                            {
                                loader: "style-loader",
                                exclude: path.resolve(__dirname, "/node_modules")},
                            {
                                loader: "css-loader",
                                exclude: path.resolve(__dirname, "/node_modules")},
                            {
                                loader: "sass-loader",
                                exclude: path.resolve(__dirname, "/node_modules"),
                                options: {
                                    includePaths: [path.resolve(__dirname, "/src")],
                                }
                            },
                        ],
                    }),
                }
                // {
                //     test: /\.scss$/,
                //     loader: 'style-loader!css-loader!sass-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]'
                // }
            ],
        },
        plugins: [
            extractSass,
        ]
    }
}

N.B. Without ExtractTextPlugin I get an empty object when importing .scss into a .tsx file. So if you can help me solve also this issue, I would be glad (and able to continue coding) :)
import * as styles from "./Main.scss"; // <-- styles is {/* empty object */}


text:
Q: Не сохраняет html символы в произвольных полях Wordpress Всем привет!
Есть такой вопрос. В админки WP вывел произвольные поля кастомно (на фронте тоже вывел). Все ок, сохраняет, инфу выводит, но не сохраняет html символы. Т.е. я не могу в тесте сделать абзац и все такое.
Как сделать, чтобы произвольное поле сохраняло html символы?
Код в functions.php
add_action('admin_init', 'my_extra_fields', 1);

function my_extra_fields() {
    add_meta_box( 'extra_fields', 'Дополнительные поля', 'extra_fields_box_func', 'post', 'normal', 'high'  );
}

// код блока
function extra_fields_box_func( $post ){
?>

Заголовок укр
<input type="text" name="extra[title_uk]" value="<?php echo get_post_meta($post->ID, 'title_uk', 1); ?>" style="width:100%" />

Текст укр:
        <textarea type="text" name="extra[content_uk]" style="width:100%;height:250px;"><?php echo get_post_meta($post->ID, 'content_uk', 1); ?></textarea>

    <input type="hidden" name="extra_fields_nonce" value="<?php echo wp_create_nonce(__FILE__); ?>" />
<?php
}

// включаем обновление полей при сохранении
add_action('save_post', 'my_extra_fields_update', 0);

/* Сохраняем данные, при сохранении поста */
function my_extra_fields_update( $post_id ){
    // базовая проверка
    if (
           empty( $_POST['extra'] )
        || ! wp_verify_nonce( $_POST['extra_fields_nonce'], __FILE__ )
        || wp_is_post_autosave( $post_id )
        || wp_is_post_revision( $post_id )
    )
        return false;

    // Все ОК! Теперь, нужно сохранить/удалить данные
    $_POST['extra'] = array_map( 'sanitize_text_field', $_POST['extra'] );
    foreach( $_POST['extra'] as $key => $value ){
        if( empty($value) ){
            delete_post_meta( $post_id, $key ); // удаляем поле если значение пустое
            continue;
        }

        update_post_meta( $post_id, $key, $value ); // add_post_meta() работает автоматически
    }

    return $post_id;
}

A: В строке
$_POST['extra'] = array_map( 'sanitize_text_field', $_POST['extra'] );

вы чистите строку от любых html-символов. Это нормально для заголовка, но неприемлемо для текста. Там надо применять wp_kses_post().
Вот полностью рабочий код, приведённый к стандартам кодирования WordPress.
<?php
add_action( 'admin_init', 'my_extra_fields', 1 );

function my_extra_fields() {
    add_meta_box( 'extra_fields', 'Дополнительные поля', 'extra_fields_box_func', 'post', 'normal', 'high' );
}

// Код блока.
function extra_fields_box_func( $post ) {
    ?>

Заголовок укр
<input type="text" name="extra[title_uk]"
                                      value="<?php echo get_post_meta( $post->ID, 'title_uk', 1 ); ?>"
                                      style="width:100%"/>

Текст укр:
        <textarea type="text" name="extra[content_uk]"
                  style="width:100%;height:250px;"><?php echo get_post_meta( $post->ID, 'content_uk', 1 ); ?></textarea>

    <input type="hidden" name="extra_fields_nonce" value="<?php echo wp_create_nonce( __FILE__ ); ?>"/>
    <?php
}

// Включаем обновление полей при сохранении.
add_action( 'save_post', 'my_extra_fields_update', 0 );

/**
 * Сохраняем данные при сохранении поста
 *
 * @param int $post_id Post id.
 *
 * @return bool
 */
function my_extra_fields_update( $post_id ) {
    // Базовая проверка.
    $nonce = filter_input( INPUT_POST, 'extra_fields_nonce', FILTER_SANITIZE_STRING );
    $extra = filter_input( INPUT_POST, 'extra', FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY );
    if (
        empty( $extra )
        || ! wp_verify_nonce( $nonce, __FILE__ )
        || wp_is_post_autosave( $post_id )
        || wp_is_post_revision( $post_id )
    ) {
        return false;
    }

    // Все ОК! Теперь нужно сохранить/удалить данные.
    $extra['title_uk']   = isset( $extra['title_uk'] ) ? sanitize_text_field( $extra['title_uk'] ) : '';
    $extra['content_uk'] = isset( $extra['content_uk'] ) ? wp_kses_post( $extra['content_uk'] ) : '';
    foreach ( $extra as $key => $value ) {
        if ( empty( $value ) ) {
            delete_post_meta( $post_id, $key ); // удаляем поле если значение пустое.
            continue;
        }

        update_post_meta( $post_id, $key, $value ); // add_post_meta() работает автоматически.
    }

    return $post_id;
}


text:
Q: Primefaces e Eclipse ctrl + click não funciona Em botões jsf do tipo h:commandButton e h:commandLink a navegação por ctrl + click funciona perfeitamente.
<h:commandButton value="Edit" action="#{bean.edit}"  />

Porém quando utilizo as tags do primefaces p:commandButton e p:commandLink a navegação por ctrl + click não funciona.
<p:commandButton value="Edit" action="#{bean.edit}"  />

Obs.:
- A navegação por control + click que me refiro é quando presionar o ctrl do teclado e com o a seta do mouse você clica no método e assim é aberto o bean no método específico.

*

*A versão do Primefaces é a 5


text:
Q: (Self-Study) UMVUE of the mean of a normal distribution Let $X_1,...,X_n$ be a random sample from normal(θ,1). Is there an UMVUE of $θ^2$ here?
$X^2-1$ is an unbiased estimator of $θ^2$. First thing that came to my mind is to use Lehmann-Scheffe Theorem. But the problem is that, according to my calculations, n(θ,1) doesn't have a complete statistic since, even though $\overline{X}=\frac{\sum_{n=1}^{n}X_i}{n}$ is a minimal sufficient statistic for θ (easy to show), it is not complete (again easy to show). Thus there is simply no complete statistic for n(θ,1). Another way to prove it may use the condition that an UMVUE must be uncorrelated with all unbiased estimators of 0 (and vice-versa). But I don't have a candidate for UMVUE at all.
Can anybody give a clue about this question? Thanks!


text:
Q: $4$ or more type $2$ implies $3$ or less type $1$ I'm having difficulties with the logic with the last part of the reformulation part of the problem below.

Let $x_i$ be the the number of ships of type $i$ to purchase.

For $4a:$ (the formulation)
$$\text{Min} \ z = 20,000x_1 + 1,000x_2$$
s.t.

*

*7500 soldiers

$$2,000x_1 + 1,000x_2 \le 7,500$$

*55,000 gallons

$$12,000x_1 + 7,000x_2 \le 55,000$$

*900 crew people (crewmen?)

$$250x_1 + 100x_2 \le 900$$

*integer constraint for ships

$$x_1, x_2 \in \{0,1,2,...\}$$

For $4b:$ (the reformulation)
$$\text{Min} \ z = 20,000x_1 + 1,000x_2 \color{red}{+ 2,000y_1 + 1,000y_2}$$
s.t.

*

*same

*same

*same

*same

*$$x_2 \le My_1, y_1 \in \{0,1\}$$

*$$x_2 - 2 \le My_2, y_2 \in \{0,1\}$$
7.
I think we have to say, linearly, that:

*

*if $x_2 \ge 4$, then $y_3 = 0$.

*if $y_3 = 0$, then $x_1 \le 3$.
then say exactly one of the following (also linearly):

*converse of 'if $x_2 \ge 4$, then $y_3 = 0$'

*converse of 'if $y_3 = 0$, then $x_1 \le 3$'
and finally say

*$y_3$ is binary.

I believe these translate to:

*

*$$x_2 - 3 \le M(1-y_3)$$

*$$x_1 - 3 \le M(y_3)$$

*$$4 - x_2 \le My_3$$

*$$4 - x_1 \le M(1-y_3)$$

*$$y_3 \in \{0,1\}$$
Is that right? I think if I use $4$ instead of $3$, I'm going to get the contrapositive of $(iii)$.


text:
Q: type declaration and declaring struct in c I have the following in the header file named vector.h
typedef struct coordinates coordinates;

Coordinates struct should have two variables. x and y
How can I include these two variables x and y without changing anything in header file?
my idea was to write the following in main.c
coordinates{
int x;
int y;
};

I wrote above because I already wrote a typedef struct coordinates in vector.h. So, if I write again, it is repeated. But the above syntax itself is wrong as compiler is throwing error. please help me if I understood structures wrong or  help with how to declare variables inside the struct.

A: This declaration in the header
typedef struct coordinates coordinates;

is not very useful because usually a complete structure definition is required in most cases. So in general it is better to append the header with the complete structure definition.
For example
typedef struct coordinates coordinates;
struct coordinates
{
    int x;
    int y;
};

The single typedef declaration is enough only in cases when there are not required the compete type of the structure. For example when only pointers to objects of the structure are declared.
If you may not change the header then include this definition
struct coordinates
{
    int x;
    int y;
};

in a module where the structure is referenced.

A:
I have the following in the header file named vector.h
typedef struct coordinates coordinates;

That's a declaration of the identifier coordinates as an alias for a type struct coordinates, which itself is an "incomplete type" as far as that declaration is concerned.

How can I include these two variables x and y without changing
  anything in header file?

It is struct coordinates that needs to be "completed" with a definition before you can access members:
struct coordinates {
    int x;
    int y;
};

Such a definition needs to be in scope wherever you access the members of an instance of that type, whether by the type name struct coordinates or by its alias coordinates.  It is conventional to put such a definition in a header file, so that it is appropriately shared among translation units, but if you need access to the members (or the overall size of the structure) only in one file, then you can instead put the type definition above only in that file.  Alternatively, you can duplicate the definition identically in every translation unit that wants to access the members, but that's poor form and hard to maintain.

A: I'm assuming you mean
typedef struct coordinates
{
    int x;
    int y;
} coordinates;

then just create a struct with the following line
coordinates c;
c.x = 0;
c.y = 1;

A:
typedef struct coordinates coordinates;

is incomplete declaration and hence the compiler will throw an error, when you try to declare the members of struct in main.c file.
coordinates{
int x;
int y;
};

The error thrown will be expected identifier. The complier is looking for a declaration but it is not able to find it.
You can declare the coordinates struct like this in main.c
typedef struct coordinates{
    int x;
    int y;
}coordinates;

and then you can use it as type.
I would not recommend doing that because it is a repeated exercise and not a good programming practice.
The best way is to declare the struct in your vector.h file like this:
typedef struct coordinates{
    int x;
    int y;
}coordinates;

and then use it in your main.c file
Hope this helps !


text:
Q: SQL query to filter records based on a particular column value along with descending date of insertion I have this Table OPERATIONS-
AMOUNT  CLAIM_TYPE      INSERTED_DATE
100     SETT            09-SEP-18 10.37.50
1006    ATTAA           09-SEP-18 10.37.54
102320  FIXX            09-SEP-18 10.37.55
10077   SETT            09-SEP-18 10.37.56
10034   FIXX            09-SEP-18 10.37.57
900     ATTAA           09-SEP-18 10.37.58

I want to filter out the records based on the CLAIM_TYPE column value such that the CLAIM_TYPE value appears only one time and the record must be the latest record (inserted date).
SELECT TOTAL_RECEIVED_AMOUNT, CLAIM_TYPE, INSERTED_DATE
FROM OPERATION
WHERE CLAIM_TYPE IN
('FIXX', 'SETT', 'ATTAA', 'PLACC', 'THREE', 'SIXX','TWELL') ORDER BY INSERTED_DATE DESC ;

AMOUNT    CLAIM_TYPE  INSERTED_DATE
900       ATTAA       09-SEP-18 10.37.58
10034     FIXX        09-SEP-18 10.37.57
10077     SETT        09-SEP-18 10.37.56
102320    FIXX        09-SEP-18 10.37.55
1006      ATTAA       09-SEP-18 10.37.54
100       SETT        09-SEP-18 10.37.50

The expected result is-
    AMOUNT    CLAIM_TYPE  INSERTED_DATE
    900       ATTAA       09-SEP-18 10.37.58
    10034     FIXX        09-SEP-18 10.37.57
    10077     SETT        09-SEP-18 10.37.56

I am having difficulty in getting the same while trying count, having and group by clauses. Please suggest.

A: You can use ROW_NUMBER() :
SELECT op.*
FROM (SELECT TOTAL_RECEIVED_AMOUNT, CLAIM_TYPE, INSERTED_DATE,
             ROW_NUMBER() OVER (PARTITION BY CLAIM_TYPE ORDER BY INSERTED_DATE DESC) AS seq
      FROM OPERATION  op
      WHERE CLAIM_TYPE IN ('FIXX', 'SETT', 'ATTAA', 'PLACC', 'THREE', 'SIXX','TWELL')
     ) op
WHERE seq = 1;

A: use corelated sub-query
select * from OPERATION op
     where op.INSERTED_DATE
    in ( select max(INSERTED_DATE)
          from
          OPERATION op1
          where op1.CLAIM_TYPE=op.CLAIM_TYPE
          group by CLAIM_TYPE
        )
     and CLAIM_TYPE IN ('FIXX', 'SETT', 'ATTAA', 'PLACC', 'THREE', 'SIXX','TWELL')


text:
Q: How to sample height map which is stored in the alpha channel of the normal map?
error X3523: DX9-style intrinsics are disabled when not in dx9 compatibility mode

how to use the tex2Dgrad() function in dx10?

A: You could turn on the back-compat mode (i.e. use /Gec switch with the FXC.EXE command-line or the D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY flag with the D3DCompile APIs).
Alternatively, instead of using the DirectX 9 style tex2Dgrad() intrinsic, use the 'Texture object' syntax that was introduced with Direct3D 10 / Shader Model 4:
Texture2D <float4> MyTex : t0;
Sampler MySampler : s0;

float4 value = MyTex.SampleGrad(MySampler, TexCoord, dx, dy);

See MSDN

Note that there is no reason to use the Direct3D 10.x API at all. You should be using Direct3D 11 which supports a broader range of hardware, has clearer thread-safety syntax, supports additional features, and has a much better supported set of utility libraries. Direct3D 11 is available on all supported platforms that included Direct3D 10. See this ppt from Gamefest 2010 for a detailed walkthrough of the differences.


text:
Q: Perfect forwarding in operator[] template <typename Key, typename Resource>
class ResourceHolder {
    std::unordered_map<Key, std::unique_ptr<Resource>> resources;
public:
    Resource& get(const Key& key) const {
        if (auto resource = resources.find(key); resource != std::end(resources)) {
            return *(resource->second);
        }
    }

    inline const Resource& operator[](Key&& key) const {
        return get(std::forward<Key>(key));
    }
};

I am trying to learn move semantics and I am wondering about my usage of std::forward inside operator[] - is it correct?

A: No, this usage is not correct. What you want is to take your key value as a forwarding reference, like so:
template <typename T>
const Resource& operator[](T&& key) const;

Then, you can perfectly forward key. This may be confusing, but let's look at why this is necessary. Say Key = int. What does the operator[] look like when we instantiate the template?
const Resource& operator[](int&& key) const;

Notice that we are taking an r-value reference here, not a forwarding reference. What you want is a forwarding reference, which due to template deduction and reference collapsing evaluates to the proper type when instantiated.
In your example however, the value of perfect forwarding is lost as you only have one get function which takes a const reference. In this use case, I don't think anything but a const reference operator[] is useful.


text:
Q: Doing math on a piped property powershell Very new to doing math on properties...
I'm trying :
Get-WMIObject win32_diskdrive -computer $poste | Add-Member -MemberType ScriptProperty -Name  GB -Value {[int]($_.size/1GB)} -PassThru |  select model, size,GB

and I think i'm referecing the SIZE property wrong because I get :
model                                            size GB
-----                                            ---- --
Corsair Neutron XTI SSD SCSI Disk Device 480101368320  0
ST350041 3AS SCSI Disk Device            500105249280  0

What am I doing wrong? Thank you

A:
This expression is a bit simpler:
Get-WMIObject win32_diskdrive | select model, size,@{n="GB";e={[int]($_.size/1GB)}}

And it works as well.

A: You can use an Expression in your select statement to calculate size in GB.
Ex:
Get-WMIObject win32_diskdrive -computer $poste  | Select  @{Label = "Model";Expression = {$_.Model}},
        @{Label = "Size";Expression = {"{0:N1}" -f($_.Size) }},
        @{Label = "Total Capacity (GB)";Expression = {"{0:N1}" -f( $_.Size / 1gb)}} #This will devide size by 1gb

A: Do it as an explicit ForEach-Object:
Get-WMIObject win32_diskdrive  | %{Add-Member -Input $_ -MemberType ScriptProperty -Name  GB -Value {[int]($_.size/1GB)} -PassThru} |  select model, size,GB


text:
Q: Explanation of a VBA code (Macro) regarding returning multiple values in a single cell I have a Macro for excel I found online to create a 'myvlookup' function which allows to lookup all instances of a number in a range and return a specified corresponding column; multiple instances if necessary. I've gotten the macro and respective myvlookup to work for my needs but I'd like an explanation of the logic/meanings behind how this code works. Code is below and any information would be helpful. P.S I'm code illiterate, so don't assume I know anything lol. Thanks!
Function MYVLOOKUP(pValue As String, pWorkRng As Range, pIndex As Long)
Dim rng As Range
Dim xResult As String

xResult = ""

For Each rng In pWorkRng

    If rng = pValue Then
        xResult = xResult & " * " & rng.Offset(0, pIndex - 1)
    End If
Next

MYVLOOKUP = xResult

End Function

A: Explanation is given via comments inline:
' Declare a custom function called MyVLOOKUP and specify
' that 3 arguments must be passed to it when it is invoked.
' These arguments can be named any legal name, but the values
' that eventually get passed in must match the declarations for
' each argument (String, Range, Long Integer)
Function MYVLOOKUP(pValue As String, pWorkRng As Range, pIndex As Long)

  ' Declare a variable that will represent a cell/range
  Dim rng As Range

  ' Declare a variable that will hold the function's overal result
  Dim xResult As String

  ' Initialize the result variable to an empty string
  xResult = ""

  ' Loop through each cell/range in the range that was passed into the
  ' function and stored under the argument name "pWorkRng". The "rng"
  ' variable just acts as a temporary identifier that represents each
  ' cell/range that is being looped over - one at a time.
  For Each rng In pWorkRng

    ' Check the cell/range that the loop is currently looping over
    ' to see if it matches the supplied argument ("pValue") that was
    ' passed in when the function was called.
    If rng = pValue Then
        ' If the cell/range is a match for the input argument
        ' set the function's return value variable to itself,
        ' concatenated with an asterisk character and the value
        ' of the cell/range that is one column to the left of
        ' the cell/range being looped over. ("pIndex" is supplied
        ' to the function as a way to indicate what column the
        ' lookup is to be done in).
        xResult = xResult & " * " & rng.Offset(0, pIndex - 1)
    End If

  ' Loop to the next cell/range
  Next

  ' Now that the loop is finished, have the function return its
  ' final value, which will either be an empty string ("") if no
  ' cells/ranges match the input or the value of the cells that
  ' are one column to the left of the found ranges.
  MYVLOOKUP = xResult

End Function

Now, having explained the code, I should point out that this:
  If rng = pValue Then

Should be written more explicitly as this:
  If rng.Value = pValue Then

And this:
  xResult = xResult & " * " & rng.Offset(0, pIndex - 1)

Should be:
  xResult = xResult & " * " & rng.Offset(0, pIndex - 1).Value

Because without the explicit .Value property accessor, the code reads as if you want to compare a Range object to a value, which are not the same thing. You want to compare the VALUE of a Range object against a value. The code does do this as you have it, but it is getting the .Value only because no property is specified and .Value is the default property. Being explicit is better.

A: Here is my answer:
Function MYVLOOKUP(pValue As String, pWorkRng As Range, pIndex As Long)
    'the "Function" word define that is that, a Function not s SubRutine, then name is MYVLOOKUP
    'and need some parameters: pValue As String, pWorkRng As cell/Range, pIndex As Long
    'and String is a string of characters, A range is just that and a Lond stores values from -2,147,483,648 to 2,147,483,647

    'Dim declares variables and allocates storage space.
    Dim rng As Range
    Dim xResult As String
    'Here you have two variables rng and xResult

    xResult = "" 'here you set the xResulta var as empty var
                 'also you can do this: xResult = Empty is exactly the same
    'Loops!
    'You read this this way
    'For each rng (that is a range that is a cells inside a couple of cells/bigger range)inside pWorkRng you will do this
    'then if inside the pWorkRng the is 100 cells, the loop will run 100 time (if is no errors)
    For Each rng In pWorkRng
        If rng = pValue Then 'would be better |rng.value = pValue| for better reading
        'if the value of rng (one cell from pWorkRng) is equal to the value of pValue then do this:
            xResult = xResult & " * " & rng.Offset(0, pIndex - 1) 'here would be better |rng.Offset(0, pIndex - 1).value|
            'store inside xResult this = the value of xResult with this string " * " and the value of
            'rng with an columns offset of pIndex -1 (not in rows)
            'note that the & (ampersand) is the operator to concatenate strings, then if you have two strings
            'x = "abc"
            'y = "def"
            'and you do this:
            'x = x & y
            'inside x you will get "abcdef", because when you asign the value of a variable, you will erase any other
            'previous value and write the new values
            'rng.offset(0,pIndex-1) says:
            'rng.offset(row,columns)
            'rng.offset(same row as rng | 0, col)
            'Imagine rng address is G5, then rng.offset(2,1) address will be H7 because you say, send me the address of the cells
            'plus 2 rows and plus 1 column, then if you send a negative number this way rng.offset(-2,1) you will get H3,
            'then that is why in rng.Offset(0, pIndex - 1) you will get the same row and the column indicated (inside the var pIndex)
            'less one.
            'And because this happends inside a loo, that runs n times, do the validation (the if statement)
            'you will store values concatenated with the previous valus inside xResult
        End If
    Next 'this word say: go to the next cell, then when is finish just continue
    MYVLOOKUP = xResult
    'here you send the string of inside xResult to the function, that is, you will see that string in your cell
End Function


text:
Q: Array size in Frama-C I'm new in frama-c plugin development.
I would like to ask if there is a way to get array size value and array elements type from Frama-C, either a static or dynamic created array.
For example
float *A = (float*)malloc(ni * nk * sizeof(float));
int tab[100];

I want to perform some pointer aliasing analysis in order to know when and where it is possible to insert restrict keyword.
I don't know if it is possible to modify formals parameters of a function. Take for example this function:
void test(int a, int b, int *tmp) {//}

If at the end of alias analysis in the body of this function, I'm sure that pointer tmp has not any aliasing situation, then I can insert restrict keyword in tmp declaration by
void test(int a, int b, int *__restrict__ tmp) {//}

So for that I need to know: pointer base address, if the pointer pointed into an array (constant or dynamic) then get array size and number of array elements.  For now, that's how I formalized the part about getting the array size, the base address and the number of elements:
start
launch value analysis
launch pdg analysis
for kf do
Get all locals variables (eg: let locals = Kernel_function.get_locals kf;)
    for each local var do
        if Cil.isPointerType vi.vtype then
        begin
            find local var declaration (eg: with vi.vdecl);
            print vi.vdecl in output file;
            Know if local var is initialized during the declaration;
            if local var is not initialized during the declaration then
                locate local var initialization or first utilisation;
                print this localisation in output file;
                if this initialization is "an variable assignement" then
                    match initialization with
                        | ptr = a (where ptr (the local var concerned) and a are pointer type) -> get_base_addr a; get_array_size a; get_num_of_elm a;
                                                                                print previous get_* results in output file; add ptr to some list
                        | ptr = &val -> match val with
                                                        | Const ->
                                                        | Lval ->
                                                        | ArrayType -> get_base_addr val; get_array_size val; get_num_of_elm val;
                                                                                print previous get_* results in output file; add ptr to some list
                                                        | _ ->
                        | _ ->
                else if this initialization is a dynamic allocation (eg: with malloc, ...) then
                    get_base_addr ptr; get_array_size ptr; get_num_of_elm ptr;
                    print previous get_* results in output file; add ptr to some list
            else if local var is initialized during the declaration then
            (*----*)
        end
        else if Cil.isArrayType vi.vtype then
            get_base_addr ptr; get_array_size ptr; get_num_of_elm ptr;
            print previous get_* results in output file; add ptr to some list
        else
            (*local var is not a pointer and not an array*)
    end of for
    Get list of all called functions;
    Know if previous pointers or arrays analysed are passed as parameters to some functions in this list and print the name of these functions;
    (*-----------*)
end of for ; end

I looked at the file Cil_types.mli and db.mli (in order to use some Db.Value.* functions) and found some types like (TPtr and TArray ) and many useful functions (mk*) but for the moment but for now I have not really understood how to use them.
Thanks in advance.


text:
Q: Salesforce OAuth callback URL for Mobile SDK I know, when using OAuth you can catch the callback URL by having custom schema in ios.
Using the Salesforce template I can not find the custom schema - How du Salesforce know
when using Salesforce Mobile SDK on iOS for bouth Native Apps and Hybrid?
Thanks in advance

A: Once you have a custom URL for your app, you can specify an URL as oauth_callback in the request token step of the OAuth flow. That way Salesforce will know where to redirect to on the device. Say for example myappname://salesforce-callback which will intercept the oauth_verifier after the user has verified your request token.
To further clarify: once the user has authorized your request token by entering Salesforce username and password, a HTTP redirect response is formulated by them to the specified callback. If the callback redirect leads to a URL that maps to an app on the user's device; iOS intercepts it and passes it to the app.


text:
Q: TinyMCE Stylesheets in a layout I am using the fullpage plugin:
I am trying to create a way for my users to select multiple layouts(I have about 6 layouts), in the layouts I have different
CSS rules that I would like to for example the background color
so in my layout (and this is just an example for brevity) I have
<style>
body{background-color:red}
</style>
and then my layout.....

<style>
body{background-color:green}
</style>
and then my layout.....

You get the idea ;), (I would like to use stylesheets but this did not seem to work either).
If I go into the editor and select the layout it looks great, until I hit save.
It is removed from the editors returned value (I am saving to a DB).
I have tried multiple things:
If in the layout I do this:
<style><!--Start Style-->
body{background-color:red}
<!--End Style--></style>

and then my layout.....
when the user selects the layout the background color is not displayed but this is:
body{background-color:red} body{background-color:red}

but when I save it saves correctly???.
I have this as my setup
valid_elements : "*[*]",
extended_valid_elements: "style[type]",

I have tried multiple ways, looking for quite a while through tinyMCE's documentation and Googling and no luck.
Can anyone solve or suggest a better approach(The idea is to only have them select one layout which will do everything background color and layout)?
Thanks in Advance!

A: You should create your own css file for your content (configuration seting content_css) and add the desired class(es) to the formats configuration parameter. If you use the style plugin users are able to select the class from the style-drop-down and everything should be fine.


text:
Q: Passing multiple values on 'IN' where clause I am tyring to figure out a solution for an issue in where a concurrent program passes in multiple values from a free text field parameter. We are on RDBMS : 11.2.0.3.0 and Oracle Applications : 12.1.3 .The concurrent program calls a custom plsql procedure that produces XML output based on the parameters passed in. I've tried to create the where clause dynamically in efforts to make the sys_refcursor work as shown below. I've also tried regexp_substr to basically create a list of values once the parameter string is passed in and it did not work either. Everything I've tried fails with the error below. Can someone take a look and let me know how can I make this work?
This is the error I am receiving: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275.
Here is an example of the problem.
DECLARE
ctx dbms_xmlgen.ctxhandle;
ref_cur   sys_refcursor;
xmldoc  clob;
v_company varchar2(25);
v_major_acct varchar2(150);
v_major_acct_free varchar2(150);
l_length number;
l_offset number := 1;
l_amount number:=16383;
l_rpt_data varchar2(32767);
v_where varchar(32000);

BEGIN

dbms_lob.createtemporary(xmldoc,TRUE);
v_company := '00110';--p_company;
v_major_acct:=('310;765');--p_major_acct; -----> When I pass only one value it works but fails with two values.

IF v_major_acct IS NOT NULL
   THEN
      v_major_acct_free := '';

      SELECT   REPLACE (v_major_acct, ';', ''',''')
        INTO   v_major_acct_free
        FROM   DUAL;

      v_major_acct_free := '(''' || v_major_acct_free || ''')';

      v_where:=v_where||'and major_acct in' || v_major_acct_free;
END IF;

open ref_cur for '
select * from VIEW
WHERE company =nvl(:v_company, company)'||v_where ---v_where contains AND major_acct in ('310','765') but it fails.
using v_company;
ctx := dbms_xmlgen.newcontext(ref_cur);
xmldoc := dbms_xmlgen.getxml(ctx);
l_length := nvl(dbms_lob.getlength(xmldoc),0);
fnd_file.put_line (fnd_file.log, l_length);
    if (nvl(l_length,0) > 0) then
      loop
         exit when l_length <= 0;
         dbms_lob.read (xmldoc, l_amount, l_offset, l_rpt_data);
         fnd_file.put (fnd_file.output, l_rpt_data);
         -- dbms_output.put_line(l_rpt_data);
         l_length := l_length - l_amount;
         l_offset := l_offset + l_amount;
      end loop;
   end if;
   dbms_lob.freetemporary(xmldoc);
   close ref_cur;
   dbms_xmlgen.closecontext(ctx);

exception

   when others then
      dbms_xmlgen.closecontext(ctx);
      fnd_file.put (fnd_file.output, v_major_acct);
      --errbuf := 'Process failed with the following error: '||sqlerrm;
      --retcode := 2;
      --raise_application_error (-20000,'Process Failed'||SQLCODE||' -ERROR- '||SQLERRM);
end;
/

Thanks in advance for your feedback.


text:
Q: How to determine JS bottlenecks in React Native code? I am adding a React Native Slider component to an existing app, and prefer to utilize its onValueChange prop so that as the user slides the knob left and right, a couple of Text components have their values updated in response to the Slider's current value.
On a first attempt this causes a significant amount of lag after letting go of the slider knob. StackOverflow isn't letting me embed the gif here so I'll leave the link instead: http://imgur.com/sEowpZt
When I comment out onValueChange and use onSlidingComplete instead, there is no lag at all, but the two text components will not have their values updated until the sliding stops, which reduces the effect. My suspicion is that the setState calls inside onValueChange are piling up at a faster rate than than at which they are being processed/completed and it has something to do with other parts of my app. To confirm this, I created a new react native app via react-native init, added that same _renderNameYourPriceModal() to the code, included a button on the screen to open it, and discovered there is no lag at all: http://imgur.com/iZnvDML
How can I determine what is slowing down the setState calls for my existing app? I discovered the React Perf tool and am using it like this to print in the Chrome dev console a summary table.
import Perf from 'react-native/Libraries/Renderer/shims/ReactPerf'
...
  componentDidMount() {
    setTimeout(() => {
      Perf.start()
      setTimeout(() => {
        Perf.stop()
        const measurements = Perf.getLastMeasurements()
        Perf.printWasted(measurements)
      }, 7000)
    }, 1000)
  }

According to the Perf docs for printWasted:

printWasted()
Perf.printWasted(measurements)
The most useful part of the profiler.
"Wasted" time is spent on components that didn't actually render
  anything, e.g. the render stayed the same, so the DOM wasn't touched.

But I'm not sure how to interpret the results to make the necessary changes. For example, the first four rows of that table when running my app (which has 24 rows in total) looks like this:

I don't know which View the first line, "ItemDetailsScreen > View" inside the Owner > Component column, is referring to because there are 20+ Views on that screen alone. For further context, I'm using React-Navigation and this is a nested screen inside a StackNavigator, although I don't see how updates to this screen's state could cause re-renders in screens further up the hierarchy. Is it necessary to break this screen down further into more custom sub-components so that I override shouldComponentUpdate, or so that the printWasted results tell exactly which areas are at fault?
Here is the function I have for returning the Modal with the Slider inside:
  _renderNameYourPriceModal() {
    var likelihood = 'Possible'
    var lowestVal = 5
    var highestVal = 15
    if (this.state.nypValue < 6) {
      likelihood = 'Nearly Impossible'
    } else if (this.state.nypValue < 8) {
      likelihood = 'Highly Unlikely'
    } else if (this.state.nypValue < 10) {
      likelihood = 'Unlikely'
    }
    return (
      <Modal
        onRequestClose={() => { this.setState({nypModalVisible: false})}}
        animationType={"fade"}
        transparent={true}
        visible={this.state.nypModalVisible}>
        <View style={{paddingTop: 22, height: Dimensions.get('window').height, backgroundColor: 'rgba(252,84,102,0.9)', alignItems: 'center', justifyContent: 'center'}}>
          <View
            style={{
              height: Dimensions.get('window').height * 0.5,
              width: Dimensions.get('window').width * 0.9,
              backgroundColor: 'white',
              borderRadius: 10,
              alignItems: 'center'
            }}>
            <View
              style={{flex: 0.8, alignItems: 'center', justifyContent: 'center'}}>
              <View style={{flex: 0.25, flexDirection: 'row', width: Dimensions.get('window').width * 0.97, top: -10, alignItems: 'flex-start', justifyContent: 'center'}}>
                <View style={{flex: 0.1}}></View>
                <View style={{flex: 0.8, alignSelf: 'center', alignItems: 'center', justifyContent: 'center'}}>
                  <Text style={{fontSize: 23}}>Name Your Price</Text>
                </View>
                <View style={{flex: 0.1, top: -5, height: 40, alignItems: 'flex-end', justifyContent: 'flex-end'}}>
                  <TouchableHighlight
                    underlayColor={'gray'}
                    style={{height: 40, width: 40, backgroundColor: 'gray', borderRadius: 20, alignItems: 'center', justifyContent: 'center'}}
                    onPress={() => {
                      // close
                      this.setState({nypModalVisible: false})
                    }}>
                    <Text style={{fontSize: 25, color: 'white'}}>X</Text>
                  </TouchableHighlight>
                </View>
              </View>
              <View style={{flex: 0.25, width: Dimensions.get('window').width * 0.8, alignItems: 'center', justifyContent: 'flex-start'}}>
                <View style={{flex: 0.5, flexDirection: 'row', alignItems: 'center', justifyContent: 'center'}}>
                  <View style={{flex: 0.2, alignItems: 'center', justifyContent: 'center'}}>
                    <Text style={{fontSize: 19}}>${lowestVal.toFixed(2)}</Text>
                  </View>
                  <View style={{flex: 0.6, alignItems: 'center', justifyContent: 'center'}}>
                    <Slider
                      style={{width: Dimensions.get('window').width * 0.5}}
                      maximumValue={15}
                      minimumValue={5}
                      step={0.5}
                      value={this.state.nypValue}
                      // onSlidingComplete={(val) => {
                      //   this.setState({nypValue: val})
                      // }}
                      onValueChange={(val) => {
                        // change value here
                        this.setState({nypValue: val})
                      }}
                      />
                  </View>
                  <View style={{flex: 0.2, alignItems: 'center', justifyContent: 'center'}}>
                    <Text style={{fontSize: 19}}>${highestVal.toFixed(2)}</Text>
                  </View>
                </View>
                <Text>${this.state.nypValue.toFixed(2)}</Text>
                <Text>Likelihood: {likelihood}</Text>
              </View>
              <View style={{flex: 0.5, paddingTop: 20, alignItems: 'center', justifyContent: 'flex-start', paddingHorizontal: 10}}>

                <Text style={{textAlign: 'center', top: 25, fontSize: 18}}>Let us know the price you'd like to see this item drop to, and we'll let YOU know when it does!</Text>
              </View>
            </View>
            <View style={{flex: 0.2, alignItems: 'center', justifyContent: 'center'}}>
              <TouchableHighlight
                style={{height: 50, width: Dimensions.get('window').width * 0.8, alignItems: 'center', justifyContent: 'center', backgroundColor: '#70a8ff', borderRadius: 5}}
                underlayColor={'#70a8ff'}
                onPress={() => { }}>
                <Text style={{fontSize: 20, color: 'white'}}>Set Price Alert</Text>
             </TouchableHighlight>
            </View>
          </View>
        </View>
      </Modal>
    )
  }


text:
Q: Collapsible Column table We want to create the collapsible column table using bootstrap and angularjs.
This collapsing shouldn't be like toggle but rather like vertical accordion.
If any reference of this type of table is available then please provide.

A: You can use ng-repeat to create tables with single column.

To see a demo of the collapsible table visit : https://codepen.io/Midhun1993/pen/mRVGjq/


text:
Q: how to check where datetime is in between two datetimes in pandas I have first pandas dataframe like following
 trans_df
 code     price       date           time        product
 12023    71.23       01-01-2018     06:23:00    MS
 12023    61          01-01-2018     07:56:00    HS
 12023    71.23       01-01-2018     08:34:00    MS
 12023    71.30       01-01-2018     06:03:00    MS
 12023    61          01-01-2018     11:43:00    HS
 12023    71.23       01-01-2018     10:11:00    MS
 12023    71.23       01-01-2018     04:23:00    MS
 12023    72.23       02-01-2018     10:11:00    MS
 12023    72.23       02-01-2018     04:23:00    MS

Now, I have master price dataframe from where I am checking whether the price set in trans_df is correct or not basis the transaction date and time is between effective_date_from and effective_date_to in master_price for that particular product
master_price
code  price  effective_date_from    effective_date_to  time_from   time_to  product
12023 71.23  01-01-2018             02-01-2018         06:00:00    05:59:00  MS
12023 61     01-01-2018             02-01-2018         06:00:00    05:59:00  HS
12023 72.23  02-01-2018             03-01-2018         06:00:00    05:59:00  MS

Desired dataframe would be
 trans_df

 code     price       date           time        product  flag      actual_price
 12023    71.23       01-01-2018     06:23:00    MS       match     71.23
 12023    61          01-01-2018     07:56:00    HS       match     61
 12023    71.23       01-01-2018     08:34:00    MS       match     71.23
 12023    71.30       01-01-2018     06:03:00    MS       mismatch  71.23
 12023    61          01-01-2018     11:43:00    HS       match     61
 12023    71.23       01-01-2018     10:11:00    MS       match     71.23
 12023    71.23       01-01-2018     04:23:00    MS       nan       nan
 12023    72.23       02-01-2018     10:11:00    MS       match     72.23
 12023    72.23       02-01-2018     04:23:00    MS       match     72.23

A: Use:
#convert dates with times to datetimes
master_price['effective_date_from'] = (pd.to_datetime(master_price['effective_date_from'],
                                       format='%d-%m-%Y') +
                                      pd.to_timedelta(master_price['time_from']))
master_price['effective_date_to'] = (pd.to_datetime(master_price['effective_date_to'],
                                     format='%d-%m-%Y') +
                                     pd.to_timedelta(master_price['time_to']))
trans_df['date'] = (pd.to_datetime(trans_df['date'], format='%d-%m-%Y') +
                    pd.to_timedelta(trans_df['time']))

#join together and filter between
df = trans_df.merge(master_price, on=['code','product'], how='left')
df = df[df.date.between(df.effective_date_from, df.effective_date_to)]

#add only filterd rows to original
df = trans_df.merge(df, on=['code','product','date','time'], how='left')
cols = ['effective_date_from', 'effective_date_to', 'time_to','time_from','price_x']
df = df.drop(cols, axis=1)
#first test missing values then match.mismatch
df['flag'] = np.select([df['price_y'].isnull(),
                        df['price_y'] == df['price']],
                       [np.nan, 'match'], default='mismatch')
df = df.rename(columns={'price_y':'actual_price'})
print (df)
    code  price                date      time product  actual_price      flag
0  12023  71.23 2018-01-01 06:23:00  06:23:00      MS         71.23     match
1  12023  61.00 2018-01-01 07:56:00  07:56:00      HS         61.00     match
2  12023  71.23 2018-01-01 08:34:00  08:34:00      MS         71.23     match
3  12023  71.30 2018-01-01 06:03:00  06:03:00      MS         71.23  mismatch
4  12023  61.00 2018-01-01 11:43:00  11:43:00      HS         61.00     match
5  12023  71.23 2018-01-01 10:11:00  10:11:00      MS         71.23     match
6  12023  71.23 2018-01-01 04:23:00  04:23:00      MS           NaN       nan
7  12023  72.23 2018-01-02 10:11:00  10:11:00      MS         72.23     match
8  12023  72.23 2018-01-02 04:23:00  04:23:00      MS         71.23  mismatch


text:
Q: How to Update CSV file not to Insert new Items using vb.net I want to Update row of CSV file I tried but I only found append which adds new row. where as I need to update row not to insert new row.
Here is data in my csv file
EnjoyBaseHid=hid://002AB1E3,MinID=1,MaxID=900
EnjoyBaseHid=hid://005AC1D4,MinID=1,MaxID=600
I want to update according to EnjoyBaseHid
While Not sr.EndOfStream
                            Dim line = sr.ReadLine()
                            Dim values() As String = line.Split(",")
                            If values(0).Equals("EnjoyBaseHid=" & portAddress) Then
                                Nobasefound = False
                                line = line.Replace(values(1), "MinID=" & minID)
                                line = line.Replace(values(2), "MaxID=" & maxID)
                                sr.Close()
                                Dim strWrite As New IO.StreamWriter(ExportListPathString, False)
                                strWrite.WriteLine(line)
                                strWrite.Close()
                                Exit While
                            End If
End While

This overwrites all file and the result is
EnjoyBaseHid=hid://005AC1D4,MinID=1,MaxID=1000
When I change following line
Dim strWrite As New IO.StreamWriter(ExportListPathString, False)

To this
Dim strWrite As New IO.StreamWriter(ExportListPathString, True)

It appends new line and result is following
EnjoyBaseHid=hid://002AB1E3,MinID=1,MaxID=900
EnjoyBaseHid=hid://005AC1D4,MinID=1,MaxID=600
EnjoyBaseHid=hid://005AC1D4,MinID=1,MaxID=1000

But I need this
EnjoyBaseHid=hid://002AB1E3,MinID=1,MaxID=900
EnjoyBaseHid=hid://005AC1D4,MinID=1,MaxID=1000

A: This is the idea I had in mind.
Private Sub fileHandler(sourceFile As String, portAddress As String, newMin As String, newMax As String)

    Dim tempOutFileName As String = String.Concat(sourceFile, "_tmp")
    Dim oldFileName As String = String.Concat(sourceFile, "_old")

    'clear away temp file
    If File.Exists(tempOutFileName) Then
        File.Delete(tempOutFileName)
    End If

    'clear away old file
    If File.Exists(oldFileName) Then
        File.Delete(oldFileName)
    End If

    'open writer for new temp file
    Using sw As StreamWriter = New StreamWriter(tempOutFileName, True)
        'open reader for source file
        Using sr As StreamReader = New StreamReader(sourceFile)
            Do While sr.Peek <> -1
                Dim line As String = sr.ReadLine
                'check if the line read is the one you want to change
                If line.Contains(portAddress) Then
                    'write your NEW line
                    sw.WriteLine(String.Concat(portAddress, "-", newMin, "-", newMax))
                Else
                    'write the existing line without changes
                    sw.WriteLine(line)
                End If
            Loop
            sr.Close()
        End Using
        sw.Close()
    End Using

    'backup source to old
    File.Move(sourceFile, oldFileName)
    'move temp to source
    File.Move(tempOutFileName, sourceFile)

End Sub


text:
Q: Running custom Mysql function from php Mysqli_query returns Undefined Index error I created a custom MySQL function that generates a 15 character random string.
When I test the function in phpmyadmin it generates the code fine.
However when I run it from PHP it returns an error - "Notice: Undefined index: dex in file.php on line ###".
    $sql1 = "select GenerateRand() as dex;";
    $result1 = mysqli_query($con,$sql1);
    $row1 = mysqli_fetch_row($result1);
    echo $sql1 . "| |" . $row1['dex'];

I have tried the following

*

*using the different mysqli_fetch options but none return a different result.

*checking the query result for errors;

*mysqli_errno($con) returns 0

*mysqli_error($con) returns ""

*mysqli_num_rows($result1) returns 1

*mysqli_num_fields($result1) returns 1

SOLVED
After adding these lines to my code
    error_reporting(E_ALL);
    ini_set('display_errors', 1);
    mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);

I realized that I had not granted my database user the execute PRIVILEGES.
It was still not working so after trying the var_dump again I realized that I needed to be using mysqli_fetch_array if I wanted to use $row['dex'] to retrieve the code.
Thank You all for your ideas.
Thank you for the help everyone!


text:
Q: Syntax questions C# Html-Agility-Pack This code sums the last column in the first table contained in an html document. (It ignores the first row.)
1.) How do I sum a specified column rather than just the last one?
var sum = doc.DocumentNode.SelectSingleNode("//table")
          .Elements("tr")
          .Skip(1)
          .Sum(tr => int.Parse(tr.Elements("td").Last().InnerText));

Where this code came from...
I was given this code in reply to: (Sum colum in an html table using C# and html-agility-pack)
but I could not get any explanation of how it worked.
What I have done to try to answer my question...
I have worked for many hours trying to understand the syntax. My efforts have included; VS Object Browser, Html-Agility-Pack CHM documentation, W3Schools Tutorial on XPath and  experimentation with the code. I am still a bit lost. I want to better understand the syntax so that I can continue with my project with a degree of independence.
2.) Below is my best interpretations of the syntax. Where am I wrong? Where am I missing something?
var sum = doc.DocumentNode.SelectSingleNode("//table")

The above gets the first table. If it were //table[2] it would get the 2nd table
.Elements("tr")

Does the above specify that the sum is going to be over row-set?
.Skip(1)

The first row is excluded from the row-set (column) to be summed.
.Sum(tr => int.Parse(tr.Elements("td").Last().InnerText));

The above is a bit puzzling, but I will try...
.Sum(

Sum statement started
tr =>

What is "tr"? It is not in quotes as it appears withing parents. It is not a key word is it? Explain.
The fragment above begins the range of the rows (column) that will be summed.
int.Parse(

converts text to integers
tr.Elements("td").Last().InnerText));

Confusing???
tr

Her is that "tr" again
tr.Element(

From VS Object Browser .Elements() "Gets all first generation elements in collection". What does that mean?
tr.Elements("td")

"td" specifies that it is the data elements that are being summed
tr.Elements("td").Last()

The .Last() specifies that the range over which the "td" is summed is to occur on the last column.
Would I be right that there are alternative ways to write this?
How does one specify anything other than the "last" column? How would one specify the 3rd column?
.InnerText

Why is .InnerText necessary? Doesn't int.Parse() take its contents as a string and convert it to int? What am I missing?
3.) Can you recommend any learning resources for html-agility-pack? I have just taken the W3Schools tutorial for XPath. I see remote syntax similarity but nothing that appears to be very helpful for working with tables.
Sample html that the code above can run against:

    Product Group A
    Mat'l
    Weight
    Size

    ELL
    Plastic1
    5
    11

    TEE
    Plastic2
    8
    23

    Straight
    Plastic3
    21
    71

    Product Group B
    Mat'l
    Weight
    Size

    Plumb Bob
    Bronze1
    8
    3

    Hammer
    Bronze2
    12
    8

    Sleeve Bearing
    Bronze3
    18
    7

Thank you so much!


text:
Q: MySql combining two columns from 2 tables using UNION I would like to take 2 tables from a MySql database and output  2 specific column's from each table and combine the values of the columns into a regular table of 4 columns using the UNION statement to weed through the duplicates.
I have 2 tables one is called (tblproducts) and the other (tblpricing)
There are 2 columns in each of the tables i want to display their values into a regular table.
(tbleproducts)
->name         <-this is a column of product names
->description  <- this is a column of descriptions of each product
(tblpricing)
->monlthy      <--this is the monthly price
->annually     <--this is the yearly price
You can see the tables displaying here
MY only problem is this code below, the Yearly and monthly does not display, just the name and description.
I have  renamed the JOINS to opposite of each other and they will display the values of YEARLY and MONTHLY but in the wrong columns, so i know it is not the echo table code that is the problem. Its the order of wi
if ($result = $conn->query("SELECT tblproducts.description, tblproducts.name
FROM `tblpricing` RIGHT JOIN `tblproducts` on annually = tblproducts.id
UNION SELECT tblpricing.monthly, tblpricing.annually
FROM `tblproducts` LEFT JOIN `tblpricing` on monthly = tblpricing.id; "))

echo "
";
echo "" . $row->name . "	";
echo "
";

(tbleproducts)
    name
    description
(tblpricing)
    monthly
    yearly
below are some links to pictures to help you.
Picture of both databases and oy complete code


text:
Q: Why InfoGainAttributeEval in Weka in not available for some data sets I can clearly see the InfoGainAttributeEval attribute evaluator for the weka data sets. But for a dataset i got externally InfoGainAttributeEval option is not activated.
Can someone explain to me why this must be happening. I want to rank my features.

A: When selected (in the scenario that you are able to select "InfoGainAttributeEval"), if you double click the white space containing the text "InfoGainAttributeEval", then select capabilities, the following is presented:

CAPABILITIES
Class -- Missing class values, Nominal class,
Binary class

Attributes -- Empty nominal attributes, Nominal attributes,
Numeric attributes, Unary
attributes, Date attributes, Missing values,
Binary attributes

Additional
min # of instances: 1

When "InfoGainAttribueEval" is unavailable, I suspect that your class is not Nominal or Binary, but rather numerical.


text:
Q: Remote assistance for Macs What is currently the best remote assistance/remote desktop application for Macs?  I think unattended access (no remote user needed) and file transfer would be useful.  Teamviewer seems to fit the bill, but I am not a Mac guy so I was wondering if there were other/better options for the Mac.

A: I use TeamViewer since years.
From Mac - to PC or Mac.
From USA to Europe.

A: Check Apple Remote Desktop.

Apple Remote Desktop is the best way to manage the Mac computers on your network. Distribute software, provide real-time online help to end users, create detailed software and hardware reports, and automate routine management tasks—all without leaving your desk. Featuring Automator actions and Remote Spotlight search, Apple Remote Desktop makes your job easier than ever.

Power Copy:
The file-copy engine in Apple Remote Desktop supports 64-bit file sizes, network bandwidth limits, and optional encryption of data streams.


text:
Q: SMTP & POP3 SSL Connection I am using libetpan-1.0 open source (mail library stuff) for SMTP & POP3 access in "C" language. I have problem with SSL connection in SMTP & POP3. When i make SSL connection & connection gets fail, my socket is stay in CLOSE_WAIT state. This results in memory leak after a long time. Here is my output of command "netstat -an". I am running this application in ARM board. Can anyone tell me, what i should do? Thanks in advance.
Here is my code that i am trying.
pSmtp = mailsmtp_new(0, NULL); (Create new object)
if (SMTP_NO_ERROR != mailsmtp_ssl_connect(pSmtp, "smtp.gmail.com", 465))
{
    mailsmtp_free(pSmtp);
}
else
{
    // Send Mail
}
So doesn't my work is over after i call function "mailsmtp_free(pSmtp)" or
i have do other stuff to close connection.

    ~#netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:23              0.0.0.0:*               LISTEN
tcp        1      0 192.168.51.151:4928     98.139.211.125:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4934     98.139.211.125:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:2883     98.139.211.125:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4139     98.138.105.21:465       CLOSE_WAIT
tcp        1      0 192.168.51.151:4140     98.138.105.21:465       CLOSE_WAIT
tcp        0      0 192.168.51.151:80       192.168.151.101:2745    TIME_WAIT
tcp        1      0 192.168.51.151:4142     98.138.105.21:465       CLOSE_WAIT
tcp        1      0 192.168.51.151:4143     98.138.105.21:465       CLOSE_WAIT
tcp        1      0 192.168.51.151:3132     98.138.105.21:465       CLOSE_WAIT
tcp        1      0 192.168.51.151:3133     98.138.105.21:465       CLOSE_WAIT
tcp        1      0 192.168.51.151:3134     98.138.105.21:465       CLOSE_WAIT
tcp        1      0 192.168.51.151:3135     98.138.105.21:465       CLOSE_WAIT
tcp        1      0 192.168.51.151:3131     98.138.105.21:465       CLOSE_WAIT
tcp        1      0 192.168.51.151:2115     98.138.105.21:465       CLOSE_WAIT
tcp        1      0 192.168.51.151:3136     98.138.105.21:465       CLOSE_WAIT
tcp        1      0 192.168.51.151:3137     98.138.105.21:465       CLOSE_WAIT
tcp        0      0 192.168.51.151:80       192.168.151.101:2761    TIME_WAIT
tcp        0      0 192.168.51.151:80       192.168.151.101:2757    TIME_WAIT
tcp        0      0 192.168.51.151:80       192.168.151.101:2753    TIME_WAIT
tcp        1      0 192.168.51.151:4083     63.250.193.228:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4082     63.250.193.228:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4081     63.250.193.228:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4080     63.250.193.228:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4085     63.250.193.228:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4084     63.250.193.228:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4075     63.250.193.228:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4074     63.250.193.228:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4073     63.250.193.228:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4072     63.250.193.228:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4079     63.250.193.228:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4078     63.250.193.228:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4077     63.250.193.228:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:4076     63.250.193.228:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:2493     98.138.105.21:465       CLOSE_WAIT
tcp        1      0 192.168.51.151:2492     98.138.105.21:465       CLOSE_WAIT
tcp        1      0 192.168.51.151:2495     98.138.105.21:465       CLOSE_WAIT
tcp        1      0 192.168.51.151:2496     98.138.105.21:465       CLOSE_WAIT
tcp        0      0 192.168.51.151:80       192.168.51.40:52577     TIME_WAIT
tcp        0      0 192.168.51.151:80       192.168.51.40:52581     TIME_WAIT
tcp        0      0 192.168.51.151:80       192.168.51.40:52585     TIME_WAIT
tcp        0      0 192.168.51.151:80       192.168.51.40:52565     TIME_WAIT
tcp        1      0 192.168.51.151:3978     63.250.193.228:465      CLOSE_WAIT
tcp        0      0 192.168.51.151:80       192.168.51.40:52569     TIME_WAIT
tcp        0      0 192.168.51.151:80       192.168.51.40:52573     TIME_WAIT
tcp        0      0 192.168.51.151:80       192.168.51.40:52609     TIME_WAIT
tcp        0      0 192.168.51.151:80       192.168.151.101:2748    TIME_WAIT
tcp        1      0 192.168.51.151:2743     98.139.211.125:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:2742     98.139.211.125:465      CLOSE_WAIT
tcp        1      0 192.168.51.151:2744     98.139.211.125:465      CLOSE_WAIT
tcp       94      0 192.168.51.151:3650     74.125.129.108:587      CLOSE_WAIT
tcp       95      0 192.168.51.151:3655     74.125.129.108:587      CLOSE_WAIT
tcp        1      0 192.168.51.151:2250     63.250.193.228:465      CLOSE_WAIT
tcp        0      0 192.168.51.151:80       192.168.51.40:52578     TIME_WAIT
tcp        0      0 192.168.51.151:80       192.168.51.40:52582     TIME_WAIT
tcp       95      0 192.168.51.151:4618     74.125.129.108:587      CLOSE_WAIT
tcp        0      0 192.168.51.151:80       192.168.51.40:52586     TIME_WAIT
tcp       95      0 192.168.51.151:4615     74.125.129.108:587      CLOSE_WAIT
tcp        1      0 192.168.51.151:4353     98.139.211.125:465      CLOSE_WAIT
tcp        0      0 192.168.51.151:80       192.168.51.40:52590     TIME_WAIT
tcp        0      0 192.168.51.151:80       192.168.51.40:52594     TIME_WAIT
tcp        1      0 192.168.51.151:2769     98.138.105.21:465       CLOSE_WAIT
tcp        0      0 192.168.51.151:80       192.168.51.40:52598     TIME_WAIT
udp        0      0 0.0.0.0:2048            0.0.0.0:*
udp        0      0 0.0.0.0:2049            0.0.0.0:*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node Path
unix  6      [ ]         DGRAM                    1262   /dev/log
unix  2      [ ]         DGRAM                    1993
unix  2      [ ]         DGRAM                    1513
unix  2      [ ]         DGRAM                    1511
unix  2      [ ]         DGRAM                    1492

A: You need to close them on your side.
CLOSE_WAIT means the remote side has closed the connection, but your side hasn't.
See accepted answer here