Data Factory Custom Activity, connect to onPremise data source via gateway

Question: I will start directly with my question: Is it possible to connect to an on Premise Dataset in a Azure Data Factory Custom Activity via Data Management Gateway?
The usecase:
I have a local FTP Server, with multiple files on it, which should be regulary copied to an Azure Blob Storage. The decision which files have to be uploaded should be based on a custom trigger. Therefore I am building a Data Factory custom activity, instead of a normal copy activity. The server should only be accessed via the data management gateway
I created an FTPServer typed linked service, and a FileShare Dataset. This I used inside my CustomActivity Pipeline as Input.
Inside my custom activity, I now want to connect to the input dataset and get the content of a folder inside the ftp server. And here I am not getting forward. I don´t get how to connect to the ftp server. Here is the code element I am stuck at:
public IDictionary<string, string> Execute(IEnumerable<LinkedService> linkedServices,IEnumerable<Dataset> datasets,
                                           Activity activity,IActivityLogger logger)
{
    Dataset inputDataset = datasets.Single(dataset => dataset.Name == activity.Inputs.Single().Name);

    FileShareDataset inputTypeProperties = inputDataset.Properties.TypeProperties as FileShareDataset;

    FtpServerLinkedService inputLinkedService = linkedServices.First(linkedService =>
    linkedService.Name ==
    inputDataset.Properties.LinkedServiceName).Properties.TypeProperties
    as FtpServerLinkedService;

    ***//HERE CONNECTION TO FTPSERVER VIA GATEWAY***
}

There are multiple Gateway classes in Microsoft.Azure.Management.DataFactories.Models but i can´t find a way to work with them. For me it looks like that the data management gateway is maybe not supported for a custom activity? If that is correct, are there some other ways to go, like creating a copy activity inside the custom activity or things like that? Or is the only possible solution a direct connection to the FTP-Server via WebRequest?
Answer: To start directly with an answer: no :-)
The problem you'll have is the context in which the custom activity code is executed. Once you've created your class to do some amount of work the compiled DLL's are placed in blob storage (and zipped). Remember ADF is only an orchestration tool to invoke other Azure services, it has none of its own compute. Therefore it instructs the Azure Batch Service to take the DLL's from blob storage and execute the code. This means that the application actually runs on a virtual machine(s) within the Batch Service compute pool. As a result the execution is basically disconnected from ADF and not aware of things like a Data Management Gateway (DMG).
That said, I understand the confusion here because the custom activity can inspect and use values from the configuration of the ADF linked services (your code above). But not a DMG. What you really want is a the custom activity class to programmatically establish a VPN connection between it (the batch service VM) and your local network, then execute some code via the tunnel. Again, disconnected from ADF. This of course would never be allowed within Azure. Setting up a VPN for a standard VM and virtual private network is bad enough!
So, what to do? My suggestion would be to use a normal ADF copy activity with the DMG to land everything in blob storage first. Call it your IN folder. Once there have a second ADF pipeline and use a the custom activity to inspect/sort the data. Call it your CLEAN folder. Finally pass it on to a downstream service.
Or, get the custom activity to hit the FTP site directly and not dilute the data flow with the DMG.
Hope this helps.
Comment: Hi thanks for your answer. It helped alot. Unfortunately none of your suggested solutions are going to be allowed, because of IT security issues. I will now handle the whole decision making which files should be uploaded locally, and let the data factory just access a folder, in which only the files which should be uploaded  are included.


Handle null values in a logic app with JSON table and compose object

Question: Azure Alert triggers an Logic App for output to for example Microsoft Teams
Common Alert Schema
JSON input to the logic app.
The JSON table has columns and rows
Its easy enough to compose an object with fixed value in the array see example below.
However this fails when any value is null. Which brings me to the crux.
I should be able to dynamically create the table with the information available. I feel limited in what i can do with a logic app. With powershell i would've probably solved this with a hashtable.
I've tried iterating through both row and column and appending to an array. However the data gets goes all over the place which is logical.
I suppose I need to iterate through and compose and object somehow but then I just overwrite the object with each iteration
Working example with fixed values
Variable Math
item()[2]

Variable Number
if(contains('56789', substring(string(variables('math')),4,1)),substring(string(add(variables('math'),0.01)),0,4),substring(string(variables('math')),0,4))

Compose Object
{

"AggregatedValue": @{variables('Number')},

"Computer": "@{item()[0]}    ",

"TimeGenerated": "@{item()[1]}"

}

I get the following table to work with

[
  {
    "name": "PrimaryResult",
    "columns": [
      {
        "name": "Computer",
        "type": "string"
      },
      {
        "name": "TimeGenerated",
        "type": "datetime"
      },
      {
        "name": "AggregatedValue",
        "type": "real"
      }
    ],
    "rows": [
      [
        "server.example.org",
        "2019-10-30T08:44:48Z",
        2.409970182797006
      ]
    ]
  }
]

JSON Schema
{
  "properties": {
    "data": {
      "properties": {
        "alertContext": {
          "properties": {
            "AffectedConfigurationItems": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "AlertType": {
              "type": "string"
            },
            "IncludedSearchResults": {
              "type": "string"
            },
            "LinkToSearchResults": {
              "type": "string"
            },
            "Operator": {
              "type": "string"
            },
            "ResultCount": {
              "type": "integer"
            },
            "SearchIntervalDurationMin": {
              "type": "string"
            },
            "SearchIntervalEndtimeUtc": {
              "type": "string"
            },
            "SearchIntervalInMinutes": {
              "type": "string"
            },
            "SearchIntervalStartTimeUtc": {
              "type": "string"
            },
            "SearchQuery": {
              "type": "string"
            },
            "SearchResults": {
              "properties": {
                "dataSources": {
                  "items": {
                    "properties": {
                      "resourceId": {
                        "type": "string"
                      },
                      "tables": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      }
                    },
                    "required": [
                      "resourceId",
                      "tables"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "tables": {
                  "items": {
                    "properties": {
                      "columns": {
                        "items": {
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "type": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "name",
                            "type"
                          ],
                          "type": "object"
                        },
                        "type": "array"
                      },
                      "name": {
                        "type": "string"
                      },
                      "rows": {
                        "items": {
                          "type": "array"
                        },
                        "type": "array"
                      }
                    },
                    "required": [
                      "name",
                      "columns",
                      "rows"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                }
              },
              "type": "object"
            },
            "SeverityDescription": {
              "type": "string"
            },
            "Threshold": {
              "type": "integer"
            },
            "WorkspaceId": {
              "type": "string"
            }
          },
          "type": "object"
        },
        "essentials": {
          "properties": {
            "alertContextVersion": {
              "type": "string"
            },
            "alertId": {
              "type": "string"
            },
            "alertRule": {
              "type": "string"
            },
            "alertTargetIDs": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "description": {
              "type": "string"
            },
            "essentialsVersion": {
              "type": "string"
            },
            "firedDateTime": {
              "type": "string"
            },
            "monitorCondition": {
              "type": "string"
            },
            "monitoringService": {
              "type": "string"
            },
            "originAlertId": {
              "type": "string"
            },
            "severity": {
              "type": "string"
            },
            "signalType": {
              "type": "string"
            }
          },
          "type": "object"
        }
      },
      "type": "object"
    },
    "schemaId": {
      "type": "string"
    }
  },
  "type": "object"
}

Expected Output
All values not null
computer        Timegenerated       AggregatedValue
server.example.org  2019-10-30T08:44:48Z    2.41

Two values null
computer        Timegenerated       AggregatedValue
server.example.org

Comment: I'm sorry but I'm not so clear about what you want ? Could you please tell us your requirements and I will help you solve it ? Currently, per my understanding, if you don't want the null value in the result, do you mind add a "If" condition in you logic app to judge if the value is null. For example if variables['Number'] not null, then do the compose, otherwise variables[Number] = "0.00" and do the compose.
Answer: If you want to use logic app to handle this data, you have to add some actions to handle the errors. I use Parse JSON to mock receiving table data.
I init the variable Timegenerated and set it with the value in the table and set it with space while the last action failed.

And then init the math same as the Timegenerated. One more step is init the variable Number with if(contains('56789', substring(string(variables('math')),4,1)),substring(string(add(float(variables('math')),0.01)),0,4),substring(string(variables('math')),0,4)) and set it run after last action is skipped.

At last, do the compose action, one with variable math run after init variable Number is skipped and one with variable Number.

And if you think that this is too cumbersome, you could choose to use azure function to handle this data. The azure function support powershell, also you could call Azure Function in the logic app to process your table data to function, in the powershell function handle it then return it to logic app, then you will be able to get the data you want in the logic app.
Comment: Thanks for this. However doesn't this method assume that the values are static?
I mean item[1] might be TimeGenerated but no necessary. I think I'll explore the azure function route to see if I can make that work better.

Thanks :)
Comment: No, it doesn't. cause it's an array if it's not static and change the property every time it will return an error cause the index could be out of range. If that, maybe the function is the best, you also could use c# or other language .
Comment: @a.pof, if this could help you, please accept it as the answer. Thanks!


Is there a function, continuous on the irrationals, with rational values, nowhere locally constant?

Question: Question. Let $\mathbb A=\mathbb R\!\smallsetminus\!\mathbb Q$ be the irrational numbers. Is there a continuous function $\,f:\mathbb A\to\mathbb Q$, which is nowhere locally constant? – i.e., for every $a<b$, the restriction $f\,\big|_{\,(a,b)\cap\mathbb A}$ is not constant.
Clearly, there exist many non-constant such functions, which are continuous, but fail to be nowhere locally constant.
One failed attempt: Let $\mathbb Q=\{q_n\}_{n\in\mathbb N}$, and set
$$
f(x)=\sum_{n\in\mathbb N} a_n\mathrm{sgn}(x-q_n),\tag{1}
$$
where $\{a_n\}_{n\in\mathbb N}\subset\mathbb Q^+$, with $\sum_{n\in\mathbb N}a_n<\infty$.
Clearly $f$ is continuous in $\mathbb A$, and it does not take necessarily only rational values.
EDIT. If there exists a sequence $\{a_n\}_{n\in\mathbb N}\subset\mathbb Q^+$, such that $\sum_{n\in S}a_n\in\mathbb Q$, for every $S\subset\mathbb N$, then the function $f$, defined by $(1)$ possesses the sought for properties.
Comment: I would say no because you'd have to distribute an uncountably infinite number of irrationals among a countably infinite number of rationals within every interval of $x\pm\delta$; I may be wrong though, because this is only my first thought and I haven't made it rigorous at all.
Comment: Wouldn't the restriction of $f(x) = x$ to the irrationals have this property, or am I missing something?
Comment: @DaveL.Renfro $f:\mathbb A\to\mathbb Q$, so $f(x)\in\mathbb Q$, for all $x$.
Comment: Oh, I see ... you want the Range to be a subset of the rational numbers. I'll leave my comments up in case someone else misses this aspect.
Answer: There is no such function and one way to show this makes use of the Baire category theorem.
Assume that $f:{\mathbb A} \rightarrow {\mathbb Q}$ is continuous. For each $r \in {\mathbb Q},$ let $E_r = f^{-1}(r)$ be the inverse image of the set $\{x\}$ under $f.$ Note that ${\mathbb A} = \cup \{E_r: r \in {\mathbb Q}\}.$ Because $\mathbb A$ cannot be written as a countable union of nowhere-dense-in-${\mathbb A}$ sets (by the Baire category theorem; recall that $\mathbb A$ is completely metrizable), at least one of the "$E_r$ sets" is not nowhere-dense-in-${\mathbb A},$ which means that at least one of the "$E_r$ sets", say $E_{r_0},$ is somewhere dense in ${\mathbb A}.$ Also, since $f$ is continuous, each $E_r$ is a closed set in ${\mathbb A}.$ In particular, $E_{r_0}$ is closed in ${\mathbb A}.$ It follows that $E_{r_0}$ contains an ${\mathbb A}$-interval, and because $f$ takes only the value $r_0$ on this interval, it follows that $f$ is constant on this interval.


Como deixar uma div 'fixed' limitada por uma div principal?

Question: Estou tentando fazer algo parecido a isto: https://www.chipart.com.br/computadores/monte_seu_pc
onde a div contendo os valores da compra fica fixa somente enquanto as opções de customização estão visíveis, porém creio que não seja possível fazer isto com 'fixed', a única coisa que consegui fazer até o momento é deixar esta 'caixa' com os valores fixa em toda a página.
Alguém saberia me indicar alguma solução?
Comment: Dê uma olhada nisto... http://getbootstrap.com/javascript/#affix
Answer: Pode usar o plugin jquery Sticky-Kit.

Sticky-kit fixa os elementos na página quando o usuário faz scroll de maneira que esse elemento fica sempre visível.

Com ele basta selecionar um elemento e aplicar uma função:
$("#sidebar").stick_in_parent();

Exemplo prático:
http://jsfiddle.net/jomar/w4Lu98nd/1/
Comment: Desculpa @mdma, eu queria responder sugerindo o mesmo `plugin`, mas para não "duplicar" acresci apenas um exemplo da utilização no `fiddle`. :D
Answer: Você pode tentar usando jQuery:
$(window).bind('scroll', function() {
     if ($(window).scrollTop() > POSIÇÃO_Y) {
         $('.sua_div').addClass('fixed');
     }
     else {
         $('.sua_div').removeClass('fixed');
     }
});

Assim, sempre que o scroll da página passar do POSIÇÃO_Y, a div terá a classe .fixed, aí no CSS você declara essa classe pra div ficar com position: fixed
Answer: Basta criar uma div fixada que aparece e desaparece utilizando o display:none. Isso acontece também em pc gamer.
Comment: Tem como aprofundar sua resposta? Dá para fazer um exemplo executável usando os snippets aqui do Stack Overfllow


Normal curve 1.5 standard deviations

Question: For a normal curve, how much of the area lies within 1.5 standard deviations of the mean? I already know about the 68–95–99.7 rule, and see that it should be between 68% and 95%. I also know that it should be closer to 95%, so I estimate it to be around 80%. Can someone give me a hint on how to find the answer?
Comment: Look it up in a table or use a programming solution.  For example [this table](https://freakonometrics.hypotheses.org/9404) gives $P(X \le 1.5) \approx 0.9332$ though you want $P(-1.5 \le X \le 1.5)$
Answer: You're close. It's about 87%. And see: probit.
Comment: Combining henry's comment and rulnick's answer, I wanted to figure out how to get this answer using R, to compute $P(-1.5 < X < 1.5)$:

`> pnorm(1.5) - pnorm(-1.5) => [1] 0.8663856`

`> 1 - 2 * pnorm(-1.5) => [1] 0.8663856`

[This page](https://socratic.org/questions/what-percentage-of-the-population-values-fall-under-1-5-standard-deviations-in-a) has an interesting simplification, $1 - 2 * P(X < -1.5)$, as well.
Comment: Could you show your work or explain further, please?
Comment: For a random variable with density $f$, mean $\mu$, standard deviation $\sigma$, the area under $f$ within $k$ standard deviations of the mean is $\int_{\mu-k\sigma}^{\mu+k\sigma} f(u)\,du$, or $F(\mu+k\sigma)-F(\mu-k\sigma)$, where $F$ is its distribution. For a normal r.v., $F(u)=\Phi((u-\mu)/\sigma)$, where $\Phi$ is the standard normal distribution, so the area of interest is $\Phi(k)-\Phi(-k)$, or $1-2\Phi(-k)$ since, due to $f$'s symmetry, $\Phi(k)=1-\Phi(-k)$. Here, $k=1.5$.

Normal curve 1.5 standard deviations


Multivariate Quantiles

Question: I am interested whether a concept for the multivariate equivalent to quantiles exists.
In the univariate case, a $p$-quantile can be computed via the inverse of the cumulative density function, however, this cannot easily be translated into the multivariate setting.
Whereas in the univariate setting we are able to denote the $\alpha$ quantile $p\in\mathbb{R}$ such that $F(p)=\alpha$. Given we have a $N$-variate distribution, isn't it possible to define an $N-1$ dimensional subspace (for example an ellipse) if we are talking about bivariate distribution) such that a similar statement can be made?
Answer: Since the question was asked (and answered) a lot of interesting work has been done. In particular the concept "center-outward quantile function" was introduced as an extension of the quantile function to $\mathbb{R}^n$ and even some promienent matematishans such as Figalli recently worked on the topic. (See for example https://arxiv.org/pdf/1805.04946.pdf and references therein.)
While I am not familiar enough with this concept to go into details I believe that one of its most attractive features is the following: If $B_1$ is the unitary ball centered in zero and $U$ is (some sort of) uniformly distributed random variable on $B_1$ then $Q:B_1\rightarrow \mathbb{R}^n$ is the center outward quantile function of $P$ if and only if $Q(U)\sim P$. Moreover it is possible to recover the quantile contours (isolines), obtained as the images under $Q$ of the nested hyperspheres $\{\partial B_r\}_{ 0<r<1}$.
Answer: Answer to this question can be found in this post  in the CrossValidated stackexchange forum.
Answer: i find it quite funny, but K-NN (k-nearest neighbors) and SOM (Kohonen's Self-organizing maps) and "vector quantization" are all about the same. They all give you "Multivariate Quantiles" (or "multidimensional quantiles").

Multivariate Quantiles


Barra superior VS Code

Question: É possivel remover ou esconder essa barra que fica com o nome do projeto do VS Code? Utilizo Ubuntu 19.04
Comment: Mas se vc esconder essa barra para onde vão ir os btns de Minimizar, Fechar, Etc?
Comment: Eles ficavam flutuando perto da barra de atividade mas não me lembro como fazer isso
Answer: Vc tem que mudar o window title bar para custom, para isso siga os passos da imagem abaixo

Barra superior VS Code


Definition of limit as $x\rightarrow \infty$

Question: Every time i get confused with the definition of $\lim_{x\rightarrow \infty}f(x)=L$. I could not find a reference that will give the definition.
I am trying to write what i understood. See if this is correct.

By $\lim_{x\rightarrow \infty}f(x)=L$ we mean the following : Given $\epsilon >0$ there exists $R>0$ such that $|f(x)-L|<\epsilon$ for all $x>R$.
By $\lim_{x\rightarrow -\infty}f(x)=L$ we mean the following : Given $\epsilon >0$ there exists $R<0$ such that $|f(x)-L|<\epsilon$ for all $x<R$.
By $\lim_{x\rightarrow \infty}f(x)=\infty$ we mean the following: Given $R>0$ there exists $L>0$ such that $|f(x)|>R$ for all $x>L$
By $\lim_{x\rightarrow \infty}f(x)=-\infty$ we mean the following: Given $R<0$ there exists $L>0$ such that $f(x)<R$ for all $x>L$
By $\lim_{x\rightarrow -\infty}f(x)=\infty$ we mean the following: Given $R>0$ there exists $L<0$ such that $|f(x)|>R$ for all $x<L$
By $\lim_{x\rightarrow \infty}f(x)=-\infty$ we mean the following: Given $R<0$ there exists $L<0$ such that $f(x)<R$ for all $x<L$.

Let me know if i understood somethings wrongly.
Comment: @topgeomj No, because one definition uses $x>R$ and the other $x0$. for the first two. It can be any $R$. It's the "for all $x>R$" and "for all $xR$, not $|f(x)|>R$ in your $\lim_{x\to\infty} f(x)=\infty$ and $\lim_{x\to-\infty} f(x)=\infty$.
Comment: I would advise being careful about the placement of your quantifiers. The quantifier should always be placed **before** the statement that it quantifies. So, for example, don't write "Given $\epsilon >0$ there exists $R>0$ such that $|f(x)-L|<\epsilon$ for all $x>R$" because the $x$-quantifer "for all $x>R$" comes after $x$ is used. Instead write "Given $\epsilon >0$ there exists $R>0$ such that for all $x>R$ we have $|f(x)-L|<\epsilon$", thus placing the $x$-quantifer before the place where it is used.
Comment: And your last one is wrong - $\lim_{x\to\infty} f(x)=-\infty$ if given $R$ there exists $L$ so that $f(x)L$.
Comment: @ThomasAndrews : As i am already saying $x>R$ and $x0$ or $R<0$.. fine... i do not get your comment about $\lim_{x\rightarrow \infty}f(x)=-\infty$
Comment: @LeeMosher : Yes Yes.. I am very bad with quantifiers.. Will try to learn...
Comment: @topgeo mj: There's no need to specify the sign just because 'he who can do the more can do the least'.
Comment: @Bernard : Nice quote... some user was saying something is wrong with one of the limits.. now he is not responding.. please see if you can help...
Comment: @topgeo mj: I guess you mean definitions 3 and 5. Thomas Andrews is right: for infinite limits,  you must not use absolute values: for instance the function $(-1)^{\lfloor x\rfloor}x$ has not limit at $\infty$, but its absolute value tends to $\infty$.
Comment: Oh, I see, you have a typo. You mean the last definition to be $\lim_{x\to-\infty} = -\infty$, and you have $\lim_{x\to\infty} = -\infty$.
Comment: @Bernard : Oh yes.. that seems to be natural.. thanks :)
Answer: One also does not need the absolute values on
$|f(x)| > R$.
If f is going to infinity, then $f(x) > R$ is accurate.
Comment: For $f(x) = (-1)^{[x]}e^x$, $f(x) \to \infty | x \to +\infty$, but not $f(x) \to +\infty | x \to +\infty$.
Comment: Ok.. Can you say something about other definitions as well..
Comment: @Abstraction Some people distinguish between $+\infty$ and $\infty$, but quite often they are used interchangably.
Comment: @ThomasAndrews Seeing as third and fifth examples in the initial post clearly distinguish between $f(x) \to +\infty$ and $f(x) \to \infty$ (using absolute value of $f(x)$), I think here the distinction is important.
Comment: Well, the main indication that the OP is using $\infty$ to mean a single point at infinity is the absolute values, but in the $x\to\infty$ examples, the definitions do not use $|x|>L$. So the clarity is not there in the question. @Abstraction
Answer: I will use $+\infty$ in this answer to avoid ambiguity.
I would start with two definitions:

$\lim_{x\to +\infty} f(x) = L$ means for all $\epsilon>0$ there exists $M$ such that for all $x>M,$ $|f(x)-L|<\epsilon$ .
$\lim_{x\to+\infty} f(x)=+\infty$ means for all $R$ there exists $M$ such that for all $x>M$, $f(x)>R$.

Those two definitions let you define the other limits by symmetry:
$$\begin{align}
\lim_{x\to+\infty} f(x) = -\infty&\iff \lim_{x\to+\infty} -f(x)=+\infty\\
\lim_{x\to-\infty} f(x) = M &\iff \lim_{x\to+\infty} f(-x)=M
\end{align}$$
Where the $M$ in the second case can be any of either a real value, or $+\infty,-\infty$.
So $\lim_{x\to-\infty} f(x)= -\infty$ means $\lim_{x\to +\infty} -f(-x)=+\infty$, which means:

For any $R$ there is an $M$ so that for all $x>M$, $-f(-x)>R$.

Now, given any $R'$, you can set $R=-R'$ and find $M$ with this condition, and set $M'=-M$. Then if $x<M'$, $-x>M$, and thus $-f(x)>R$ or $f(x)<R'=-R$. So we get back the definition that we want.

The reason to distinguish $+\infty$ from $\infty$ is that some books use $\infty$ means a single point at infinity, in both directions - essentially, merging the two values $+\infty,-\infty$ into a single point at infinity.
Then:
$$\lim_{x\to\infty} f(x)= L \iff \lim_{x\to+\infty} f(x)=\lim_{x\to-\infty} f(x)=L$$
where $L$ can be any real or $+\infty,-\infty$.
$$\lim_{x\to W} f(x) = \infty\iff \lim_{x\to W} |f(x)|=+\infty$$
Where $W$ can be any real, or $+\infty$ or $-\infty$, or $\infty$.
Your question is somehwat confused, because you seem to distingush $\infty$ from $+\infty$ with absolute values when $\infty$ is the limit, but not when $x\to\infty$.
Comment: Thanks... I understand this clearly... :)
Answer:
Let me know if i understood somethings wrongly.

You did. When you write $x \to \infty$ (as opposed to $x \to +\infty$), for $x \in \mathbb{R}$ it roughly means "when absolute value of $x$ is arbitrarily large" ($|x| > R$, not $x > R$)
There is a universal definition of limit using filters. A filter $\mathcal{F}$ is a collection of sets such that it doesn't contain an empty set and $\forall f_1, f_2 \in \mathcal{F}, \exists f_3 \in \mathcal{F} : f_3 \subseteq f_1 \cap f_2$. For example, a set of neighbourhoods of a real point $x$ is a filter ($\{(x-\epsilon, x+\epsilon) | \epsilon \in \mathbb{R}^+\}$, called neighbourhoods filter); a set of intervals with infinite endpoint ($\{(a,+\infty) | a \in \mathbb{R}\}$) is a filter; a set of segment complements ($\{(-\infty,a)\cup(b,+\infty) | a,b \in \mathbb{R}\}$) is a filter.
Now, let's take function $h \in \{X \to Y\}$ and there is a filter $\mathcal{F}$ on $X$ and a concept of "neighbourhoods" on $Y$ (called topology). Then let's take this sentence: "there is such $y \in Y$ that for any $y$ neighbourhood $O_y$, there is a filter element $f \in \mathcal{F}$ so that $h(f) \subseteq O_y$" and write it for short as $\lim_{\mathcal{F}}h(x) = y$.
Lets write filter $\{(a,+\infty) | a \in \mathbb{R}\}$ as $x \to +\infty$, filter $\{(-\infty,a) | a \in \mathbb{R}\}$ as $x \to -\infty$ and filter $\{(-\infty,a) \cup (a,+\infty) | a \in \mathbb{R}\}$ as $x \to \infty$.
Finally, let's call set $\{(L-\epsilon,L+\epsilon) | \epsilon \in \mathbb{R}\}$ a set of neighbourhoods of $L$, set $\{(b,+\infty) | b \in \mathbb{R}\}$ a set of neighbourhoods of $+\infty$, set $\{(-\infty,b) | b \in \mathbb{R}\}$ a set of neighbourhoods of $-\infty$ and set $\{(-\infty,b) \cup (b,+\infty) | b \in \mathbb{R}\}$ a set of neighbourhoods of $\infty$.
Now from these rules we can derive any definition. Take $\lim_{x \to -\infty}f(x) = +\infty$. It comes to "for any $+\infty$ neighbourhood $(b,+\infty), b \in \mathbb{R}$, there is a filter element $(-\infty,a), a \in \mathbb{R}$ so that $f((-\infty,a)) \subseteq (b,+\infty)$". Or, in more traditional notation,
$$\forall b \in \mathbb{R}, \exists a \in \mathbb{R} : \forall x \in (-\infty,a), f(x) \in (b,+\infty)$$
Comment: May be you are complication the question by saying more advanced things as **filter, topology**...
Comment: @cello Maybe. But memorizing definitions for all cases of $x \to \pm\infty$ is actually hard, filters help to see some logic in all this. "Topology" here is simply a proper naming for a system of neighbourhoods; as you can see, it's properties aren't used.


Prove: If $X$ and $Y$ are infinite, then $X\cup Y$ is infinite.

Question: Proof:
Suppose $X$ and $Y$ are any infinite sets.
Then
$$ \exists f:X \rightarrow X \text{ such that}\; f \;\text{ is injective }\;\land\; f(X) \neq X,\;\;\text{and}$$
$$\exists g:Y \rightarrow Y \text{ such that}\;\; g \text{ is injective}\;\;\land\;\;g(Y) \neq Y.$$
I'm sure that it's simple, but I don't see what I should do after this.
Comment: Don't be afraid to use more words to make your argument; if you need to have a proof in mostly symbolic notation, you can translate to logical notation once you tackle the proof in words expressing what you need to express.
Answer: Since $X \subset X \cup Y$, the same injection $f$ demonstrating that $X$ is infinite can also be made to demonstrate that $X \cup Y$ is infinite.
For ease of notation, suppose $X$ and $Y$ are disjoint. (We won't count duplicates in the union, so this is a fair assumption.) Define $h : X \cup Y \rightarrow X \cup Y$ by
$$
h(z) =
\begin{cases}
f(z) & \text{ if } z \in X\\
z & \text { if } z \in Y
\end{cases}
$$
Since $f$ is an injection, so is $h$. Now,
$$
h(X \cup Y) = h(X) \cup h(Y) = f(X) \cup Y \neq X \cup Y,$$
where the inequality comes from the fact that $f(X) \neq X$.

If the assumption that $X$ and $Y$ are disjoint makes you uncomfortable, you can do without it by replacing $Y$ with $Y \setminus X$ in the definition of $h$ and throughout the proof.
Comment: If the definition of A infinite is the existence of a nonsurjective injection from A to A, then we need an injection from $X \cup Y$ to itself, which is not surjective. A map from $X$ to $X \cup Y$ diesn't precisely fit the definition, at least as cited above, that A be infinite.
Comment: Yes I was actually questioning exactly what coffeemath has said. Don't I need to show a map from $X \cup Y$ to $X \cup Y$ to prove that it is infinite?
Comment: You are both correct. Let me answer it a little more carefully.
Comment: Thanks for your answer, it's very helpful. I guess the only problem I'm having with this proof is that I don't understand why you defined h(z) like you did. This is the main thing that is holding me back from understanding infinite set proofs. Also, why do we know that h is an injection because f is an injection?
Comment: In the case where X and Y overlap, it may happen that the only x0 missed by f happens to be hit by g, and also the only y0 missed by g happens to be hit by f. even if you work with Y-X for the map g, there may yet be some y in Y-X which maps to x0 under g, thus making it all depend on y0 missed by g, but it still seems this y0 might be hit by f, since in case one splits X versus Y-X, one still uses f on all of X. (This snag led me to delete my too easy answer, maybe I'm missing something...
Comment: @Bill I defined $h$ in that way because I really just wanted to work with $f$ and didn't care much about $g$. So, I made a function that behaves as though it were $f$ for elements of $X$ and is just the identity for elements of $Y$. The only thing to be careful about is that $h$ is still an injection.
Comment: @coffeemath I don't make use of the function $g$ at all. In fact, my proof would work equally well if $Y$ was any set (even empty). Elements of $X$ get mapped back into $X$ (since that's how $f$ is defined) and elements of $Y$ get mapped to themselves (so they also stay in $Y$). Have I addressed your complaint?
Comment: @coffeemath If $X$ and $Y$ overlap, then I would have defined $h$ to be the identity only on $Y \setminus X$ and subsequently written $Y \setminus X$ in place of $Y$ throughout the proof.
Comment: AHA now I see your point. I was confused, in that first you assumed X,Y disjoint, and later added "replace Y by Y-X". So the map h is the identity only on Y-X, and your proof is, now that I get it, a lot simpler than the way I ended up doing it in my answer. +1.
Answer: Assume it is not true. Then there is a bijection with $(1, 2, ...., n)$ for some $n$ that counts all elements of the union. Then it (over-)counts all elements of, say, $X$. Then, for some $m<n$, $(1, 2, ..., m)$ counts $X$, which is a contradiction.
Comment: You are right, thanks. I edited what you rightly remarked out.
Comment: This is fine, but doesn't use the definition of infinite suggested in the OP, namely that A is infinite iff there is an injection from A to A which is not onto (not surjective). These are two equivalent definitions of finite/infinite distinction, namely finite iff bijection with 1...n and infinite iff injective map as above.
Comment: Sure, but why do it complicated if it doesn't have to be? I would be surprised if as part of his class (or earlier in the book he learns this from, whatever it is) it was not proved that 'finite means not infinite,' so this is a complete answer. There is nothing in his question demanding to use a particular definition; just his solution attempt which I still find unnecessarily abstract and complicated.


How to theme markers bubble with Gmap module?

Question: I've installed Gmap and location modules. I have a view with gmap display and i'd like to be able to display more than one field in the marker bubble, but the module doesn't allow more than one field in the bubble. How do i achieve that ? Is there a template or a theme function that'll allow me to do that?
Thanks.
Answer: There's a actually a way to do this in Views UI.

Add all your fields in Views as per usual
On the bottom most field (ideally the one that's the bubble), edit it and click on "Rewrite results".  (Note you can drag / reorder fields to get the right one at the bottom.)
Check the box, "Rewrite the output of this field"
Below that once expanded, you will see "Replacement patterns"
Now add in all the tokens into the rewrite text box. e.g. [title] == Content: Title, [some_other-field] == Content: Some other field, etc...
Click apply.
Now go in and edit the other fields that you added in to the bottom field and check the box "Exclude from display"
Now go to "Format" probably something like "Gmap" and click on "settings". You will see a "grouping setting
select to group on that bottom most field that you added in all the tokens to.
Save this and now all those fields should be in the bubble.

Obviously without seeing your view, I was guessing at some of this so you will have to try to make sense of it as it in terms of your view.
Answer: Sorry, but I didn't got what are you trying to achieve, if you are asking for this kind of map http://www.hospitalsreview.com/smile-care?qt-tabs=3#qt-tabs then its possible since it is created in Drupal 7 with Gmap and location module, only thing you have to do is to make some changes in fields of your views and and there is a css bug of GMap module, that you have to clear it up manually. If you need some more help then you're welcome :)


WooCommerce doesn't show custom fee in email sent to the customer

Question: I have built a plugin which adds a fee to an order from WooCommerce. I add this fee to the order with the wc_add_order_item method with order_item_type 'fee'. The problem i'm having is that the fee doesn't show up in the email that is sent to the customer when that customer placed an order. If i understand it correctly WooCommerce is normally adding al the fees and shipping costs in
 from email-order-details.php with $order->get_order_item_totals(); and loops trough them.
The weird thing is that while i tried to look for a solution i came across the 'woocommerce_order_status_pending_to_processing_notification' hook, this hook (if again i understand correctly) triggers right before the email is sent to the user. In the callback of this hook you will have an order ID at your disposal and i called this hook in my functions.php from my theme. In the callback i searched for the correct order and used this to check what was in $order->get_order_item_totals(). I expected there was only the basic stuff and my added fee wouldn't show up, except it did.
How is it possible that while my fee is visible in $order->get_order_item_totals() before the email is sent to the customer but WooCommerce won't loop trough it in email-order-details.php? Or am i missing something? Any thoughts?
The ultimate goal is to have my custom fee in the email sent to the customer.
For reference this is the loop in email-order-details.php:
$totals = $order->get_order_item_totals();

if ( $totals ) {
    $i = 0;
    foreach ( $totals as $total ) {
        $i++;
        ?>

            <th class="td" scope="row" colspan="2" style="text-align:<?php echo esc_attr( $text_align ); ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo wp_kses_post( $total['label'] ); ?>
            <td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo wp_kses_post( $total['value'] ); ?>

        <?php
    }
}

Answer: I don't know which code you have used to add the fee to your order, But I have added a service fee to my woocommerce order, and it also shows in the woocommerce email notifications.
Try adding this code to your functions.php or make a plugin out of it. You can edit the fee amount according to your needs. Here is the code
/**
 * Add a standard $ value service fee to all transactions in cart / checkout
 */
add_action( 'woocommerce_cart_calculate_fees','wc_add_svc_fee' );
function wc_add_svc_fee() {
global $woocommerce;

if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;

// change the $fee to set the Service Fee to a value to suit
$fee = 1.00;

    $woocommerce->cart->add_fee( 'Service Fee', $fee, true, 'standard' );

}

If you want the fee or surchage to be a percentage of the order total, use the following code
/**
 * Add a 1% surcharge to your cart / checkout
 * change the $percentage to set the surcharge to a value to suit
 */
add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' );
function woocommerce_custom_surcharge() {
  global $woocommerce;

    if ( is_admin() && ! defined( 'DOING_AJAX' ) )
        return;

    $percentage = 0.01;
    $surcharge = ( $woocommerce->cart->cart_contents_total + $woocommerce->cart->shipping_total ) * $percentage;
    $woocommerce->cart->add_fee( 'Surcharge', $surcharge, true, '' );

}

Using any of the above code the Fee or Surcharge will appear in the email notifications.
Comment: Shahid, Thank you for this.  I want to show this surcharge fee (custom duty) only when select one particular shipping method. Do you know how to display your code when selecting a shipping method with AJAX i guess ?
Thx !
Comment: Do you know how to display a custom fee as a column in order table?


Making message content a variable discord.py

Question: @client.command()
async def makereactionrole(ctx):
    await ctx.send('What would you like the title to be?')
    title = ''
    def check(msg):
        return msg.author == ctx.author and mesg.channel == ctx.channel
        title = msg.content
    await ctx.send(title)

Error: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message
Trying to make the response of 'What would you like the title to be?' a varible which will send back as a test. Please help.
Comment: Can you format code with right indent?
Comment: Yup your indentation is incorrect
Comment: @mundanehassan What is supposed to be changed? I have never ran into a error with my indenting.
Answer: You need to use wait_for here is an example.
import asyncio

@bot.command()
async def makereactionrole(ctx):
    def author_and_channel(msg):
        return msg.author == ctx.author and msg.channel == ctx.channel

    await ctx.send("Please enter a title")

    #timeout is in sec
    try:
        title_msg = await bot.wait_for('message',
                                       check=author_and_channel,
                                       timeout=5.0)
    except asyncio.TimeoutError:
        return await ctx.channel.send(f'Sorry, you took too long to respond')

    title = title_msg.content
    print(title)

Docs:
Bot.wait_for
Comment: The goal with the function is to make it ask all of the questions and get individual responses then bring it all together in a reaction role. All i need to do is figure out how to get the first question to work before I add more.
Comment: You looking for `wait_for` I will add it
Comment: Have you added it anywhere?
Comment: Now you can see it above :)
Answer: In the last line of your shared code
await ctx.send(title)

it sends the title variable as message but since title variable on your third line of your shared code is empty.
title = ''

that is why the problem occured


How to find public IP of your android device

Question: As the question says I would like to know how to find public IP address of my android device programatically in code.
I have seen some old outdated answers with getting local IP address, but I need a public one
Comment: Your Android device only has a public ip address if it is on mobile connection. Not on wifi. What would you do with such an ip address if you knew it?
Comment: I think you are wrong. On wifi it also has public IP address
Comment: No. With wifi the used router has a public ip address. The phone only a local then.
Comment: Yes but you can still get the public ip address of router. Now ther router's public IP is equal to android device's public IP since It represents device's public IP
Comment: use HTTP GET api.ipify.org
Answer: Allows you to obtain the IP address of the device used.
<code>private String getIpAddress() {
        String ip = "";
        try {
            Enumeration<NetworkInterface> enumNetworkInterfaces = NetworkInterface
                    .getNetworkInterfaces();
            while (enumNetworkInterfaces.hasMoreElements()) {
                NetworkInterface networkInterface = enumNetworkInterfaces
                        .nextElement();
                Enumeration<InetAddress> enumInetAddress = networkInterface
                        .getInetAddresses();
                while (enumInetAddress.hasMoreElements()) {
                    InetAddress inetAddress = enumInetAddress.nextElement();

                    if (inetAddress.isSiteLocalAddress()) {
                        ip += inetAddress.getHostAddress();
                    }

                }

            }

        } catch (SocketException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            ip += "Something Wrong! " + e.toString() + "\n";
        }

        return ip;
    }
</code>
Comment: No sir, this is not PUBLIC IP address. you are getting my local IP address.
I need a public IP
Answer: The only reliable way to determine public ip address of the used router is to connect to someone on the internet.
For instance to https://www.whatismyip.com
You will get a html page where you can parse that ip out.
There exists sites which only return an ip so that would be enough and easier.
At the moment i have no further urls.
Comment: Thanks. Now I know what to do next


How to iterate list of dict in django template?

Question: I have this dict in python django template how can i show this in select box code as value and text as name
{"operatingUnits":[{"code":"Banswara","name":"Banswara"},{"code":"Ratlam","name":"Ratlam"},{"code":"Mandsaur","name":"Mandsaur"},{"code":"ENUGU","name":"ENUGU"},{"code":"Bhubaneswar","name":"Dammam"},{"code":"GGN","name":"Gurgaon"},{"code":"SELANGOR","name":"SELANGOR"},{"code":"Bhiwandi","name":"Bhiwandi"},{"code":"GZB","name":"Ghaziabad"},{"code":"Gandhidham","name":"Gandhidham"},{"code":"Kota","name":"Kota"},{"code":"Udaipur","name":"Udaipur"},{"code":"Neemuch","name":"Neemuch"},{"code":"Jodhpur","name":"Jodhpur"},{"code":"KEDAH","name":"KEDAH"},{"code":"ANTARA","name":"ANTARA"},{"code":"ABUJA","name":"Pune"},{"code":"NASHIK","name":"nashik"},{"code":"Ind","name":"Indore"},{"code":"CHENNAI","name":"CHENNAI"},{"code":"RIYADHFRANCHISEE","name":"Chandigarh"},{"code":"123","name":"dsd"},{"code":"HARIDWAR","name":"HARIDWAR"},{"code":"PUNE","name":"Jeddah"},{"code":"VAPI","name":"vapi"},{"code":"Delhi","name":"HO Delhi"},{"code":"HYDERABAD","name":"HYDERABAD"},{"code":"ISTANBUL","name":"ISTANBUL"},{"code":"Kolkata","name":"Kolkata"},{"code":"Ahmadabad","name":"Ibadan"}]}

I am facing problem in django template
I want select
after run a loop on this i want this one and this loop i want to write down in a templage
<Select >
   <option value="code" > name</select>
 </select>

Answer: In Django you can perform all sorts of lookups (see Variables in the documentation) using only the . operator. You need to first loop over the list and then access each value using it's key in the loop:
<select>
    {% for operating_unit in operatingUnits %}
        <option value="{{ operating_unit.code }}">{{ operating_unit.name }}</option>
    {% endfor %}
</select>

Comment: it this will work then why did you i ask this question here
Comment: @Pythonlogix what are you talking about? It is you who have asked the question... Please clarify what you mean.
Comment: I have change in my question
Comment: I am sure my answer does that itself... Can you show how you are passing this list into the context?
Comment: I have already tried this one not working
Comment: yes this one is working in core but not in django templates
Comment: @Pythonlogix please add relevant parts of your view to the question.
Comment: Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/229376/discussion-between-python-logix-and-abdul-aziz-barkat).


Spring Data R2DBC master slave configuration

Question: Is there a way in Spring Data R2DBC to setup a second datasource as slave read-only ?
Comment: Here's some reading material: https://blog.pchudzik.com/201911/read-from-replica/
Answer: It is easy to configure multi R2dbc connections in the same application.
Check my example project: https://github.com/hantsy/spring-puzzles/blob/master/multi-r2dbc-connectionfactorie


Para que serve o "|>" em Elixir?

Question: Lendo alguns códigos de elixir eu vejo |> ser usado comumente. O que ele significa?
Answer: O simbolo |> é conhecido como o operador pipe. O operador pipe |> é algo de extrema utilidade e que irá certamente melhorar a legibilidade do seu código com Elixir.
Ele básicamente pega a saída da expressão da esquerda e passa como primeiro argumento de uma função à direita.
Digamos que eu não tenha conhecimento do operador pipe e queira multiplicar todos os valores de uma lista por dois, logo em seguida filtrar aqueles que são maiores que 4, nosso código ficará da seguinte maneira:
lista = [1, 2 , 3]
Enum.filter(Enum.map(lista, &(&1 * 2)), &(&1 > 4))

Caso utilizarmos o operador pipe, nosso exemplo ficará diferente:
lista = [1, 2, 3]
# A lista gerada no primeiro map será o primeiro parametro do filter
Enum.map(lista, &(&1 * 2)) |> Enum.filter(&(&1 > 4))

Ou ainda, no iex:
[1, 2, 3] |> Enum.map(&(&1 * 2))  |> Enum.filter(&(&1 > 4))

E num arquivo:
[1, 2, 3]
|> Enum.map(&(&1 * 2))
|> Enum.filter(&(&1 > 4))

Você pode ler mais sobre o operador pipe e outras caracteristicas da linguagem na documentação oficial e no elixirschool

Para que serve o “|>” em Elixir?


How to increase upload limit in PHP.ini on Google App Engine

Question: I have successfully installed Wordpress on Google App Engine and it went very smoothly.
I logged into WPAdmin, and when I try to install my theme it says "Are you sure you want to do this? Please try again.'
I have researched this error, and found that it is because the default size that PHP allows for upload is less than the size of the theme I am uploading.
I have tried to edit the PHP.INI file, but my login does not have access to edit the file. I have searched the Google help files, and other forums and it looks like Google locks this file down.
From what I can see, there are two options. a) Copy the file from my hard drive to the correct directory on the server using FTP or an upload, or b) Edit the PHP.INI file.
Does anyone know how I can do either one of these?
Thanks in advance.
Answer: The two options you mention are not mutually exclusive. You are right, you may solve your PHP size limitations by editing locally your PHP.INI file, whereby ftp transfer helps you download and upload it to the App Engine. The linked article covers the situation in which your web host does not grant you direct access the PHP.INI file.


invoke iPad native "camera" app from website

Question: Maybe anyone can help!? It is possible to "tap" a phone number on a website and that "Tap" invokes the smartphone's phone application and calls the number tapped on on the website. No need to remember or copy/paste to call that number, very user friendly.
I wonder, is it also possible to have a similar button on a website which when tapped invokes the iPads native "camera" app so that a user can take a photo with that app without having to close the browser and manually look for/open the camera app?
Interesting to hear!
Comment: Do you mean "tap" instead of "tab"?
Answer: Regarding the telephone link: You can put a link on a website starting with tel:. Example:
Call

More in the Apple documentation for iPhone URL Schemes
Regarding the camera: If you are viewing a website in a UIWebView in your own app, follow what @matt wrote.
And thanks to @Caleb: See the linked answer for accessing the camera in Safari.
In general, Apple provides a documentation for what you can do with a regular link at https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html.
Comment: You *can* present the camera interface directly in Safari -- check the suggested duplicate.
Comment: Now that you mention it.. I remember taking a photo within the browser lately. Thank you! I'll edit my answer.


How to select duplicate values from a list

Question: I have this Request class as my object -
public class Request {
      int id;
      String name;
      String address;
      String mobileNumber;
    }

And I have this list of requests (List of above Request object)-
List<Request> requests = new ArrayList();

Request1 = new Request(1, "peter", "mumbai", "9439264054");
Request2 = new Request(2, "peter", "mumbai", "9439264054");
Request3 = new Request(3, "martin", "navi mumbai", "9004415857");
Request3 = new Request(4, "parker", "nagpur", "9004415856");

requests.add(Request1);
requests.add(Request2);
requests.add(Request3);
requests.add(Request4);

Now I want to filter only the duplicate rows based on name, address and mobileNumber
Basically when I filter, my result should contain only Request1 and Request2.
What would be my ideal approach using java 8 or simple for loop?
Comment: You'll have to add the class structure for better context. when is a request duplicate, when all fields except id are equal? (You'll have to write a function that indicates duplicate/equals)
Comment: @SendhilkumarAlalasundaram Hi, I just edited my question. Hope this clears some air. Let know if you need further details.
Answer: You can implement a key method to identify objects and compare them for duplication.
See the snippet below, I use '_' as delimiter as name and phone number would not contain this character
private class Request {
    private final int id;
    private final String name;
    private final String address;
    private final String mobileNumber;

    public Request(final int id, final String name, final String address, final String mobileNumber) {
        this.id = id;
        this.name = name;
        this.address = address;
        this.mobileNumber = mobileNumber;
    }

    public String getKey() {
        return name + "_" + address+ "_" + mobileNumber;
    }
    @Override
    public String toString() {
        return "Request{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", address='" + address + '\'' +
                ", mobileNumber='" + mobileNumber + '\'' +
                '}';
    }
}

The list can be grouped by the key function, i.e, all requests with the same key will be grouped together. Now, we can retrieve the lists with more than one element in it to find the duplicates. See the snippet below that can be used for your example.
    requests.add(Request1); requests.add(Request2); requests.add(Request3); requests.add(Request4);
    final List<Request> duplicateRequests = requests.stream()
            .collect(Collectors.groupingBy(Request::getKey)) // group requests by key
            .entrySet()
            .stream()
            .filter(e -> e.getValue().size() > 1) // If duplicates exist
            .map(Map.Entry::getValue) // get the duplicate values
            .flatMap(List::stream) // collect the duplicates in a new list
            .collect(Collectors.toList());

You can then print the duplicates' list with the below snippet:
    duplicateRequests.stream().forEach(System.out::println);

And the printed output is:
Request{id=1, name='peter', address='mumbai', mobileNumber='9439264054'}
Request{id=2, name='peter', address='mumbai', mobileNumber='9439264054'}

Comment: Yeah, you can replace the findFirst().get with the snippet below:

                .flatMap(List::stream)
                .collect(Collectors.toList());
Comment: Hey Man. This solution really worked. I am able to find out duplicates now. You are a savior :)
Comment: However I saw one issue with this approach.
take a look at below example
Request1 = new Request(1, "peter", "mumbai", "9439264054");
Request2 = new Request(2, "peter", "mumbai", "9439264054");
Request3 = new Request(3, "martin", "navi mumbai", "9004415857");
Request4 = new Request(4, "martin", "navi mumbai", "9004415857");

This won't return Request1, Request2, Request3, Request4. It will only return Request1 and Request2