How to get the response on webhook URL after user sign the doc in docusign

Question: I am redirecting user to a page where they can sign the doc and after sign I have set the return URL where it redirects the user.
Now how can I get the response sent from docusign.
 I have tried $_REQUEST and $data = file_get_contents('php://input'); but didn't get the response. Is there any other way to get the response.
Comment: Are you got the solution of this problem?
If yes, Can you share?
Answer: Once the user signs the embedded URL. The status of the envelop is changed. In your webApp you have to hook an eventNotification Object to the EnvelopDefinition Object which is used while envelope creation. In that particular eventNotification object you can specify the various statuses of the envelope on which you want a notification, you have to specify a call back endpoint. The call back end point can be configured on the url parameter present on the eventNotification Object.
Following is a java example of that eventConfiguration Object
EventNotification eventNotification = new EventNotification();
    eventNotification.setUrl("https://exampleapp.com/api/envelope/status");
    eventNotification.setIncludeCertificateOfCompletion(FALSE);
    eventNotification.setIncludeDocuments(FALSE);
    eventNotification.setRequireAcknowledgment(TRUE);
    eventNotification.setUseSoapInterface(FALSE);
    eventNotification.setLoggingEnabled(TRUE);
    eventNotification.setEnvelopeEvents(getEnvelopeEvents());
    return eventNotification;

Following is the configuration where you can specify to which state of envelope you want notification for. You can configure multiple states of the envelope.
private List<EnvelopeEvent> getEnvelopeEvents() {
    List<EnvelopeEvent> envelopeEvents = new ArrayList<>();
    EnvelopeEvent sentEnvelopeEvent = new EnvelopeEvent();
    sentEnvelopeEvent.setEnvelopeEventStatusCode("sent");
    sentEnvelopeEvent.setIncludeDocuments(FALSE);
    envelopeEvents.add(sentEnvelopeEvent);

    EnvelopeEvent completedEnvelopeEvent = new EnvelopeEvent();
    completedEnvelopeEvent.setEnvelopeEventStatusCode("completed");
    completedEnvelopeEvent.setIncludeDocuments(FALSE);
    envelopeEvents.add(completedEnvelopeEvent);
    return envelopeEvents;
}

And while creating envelope, just hook this object to the eventDefiniton Object which in turn will be passed to the createEnvelope method of EnvelopesApi Object.
EnvelopeDefinition envelopeDef = new EnvelopeDefinition();
envelopeDef.setEventNotification(eventNotification);
envelopesApi.createEnvelope(accountId, envelopeDef);

Once you get notification from docusign, you can update your contract status on database, or you can notify your ui about the envelope state change.


NGINx - 301 HTTP error in access log

Question: This question may be related to this: https://stackoverflow.com/questions/39097554/how-do-i-prevent-code-injection-attack-on-nginx - though my problem is slightly different.
Also this question seems similar though asking different thing: Strange URL requests via Nginx on Ubuntu 14.04, what is the malicious user trying to do?
I came accross weird log line in my nginx access.log:
xxx.xxx.xxx.xxx - - [24/Aug/2016:05:49:59 +0100] "POST //%63%67%69%2D%62%69%6E/%70%68%70?%2D%64+%61%6C%6C%6F%77%5F%75%72%6C%5F%69%6E%63%6C%75%64%65%3D%6F%6E+%2D%64+%73%61%66%65%5F%6D%6F%64%65%3D%6F%66%66+%2D%64+%73%75%68%6F%73%69%6E%2E%73%69%6D%75%6C%61%74%69%6F%6E%3D%6F%6E+%2D%64+%64%69%73%61%62%6C%65%5F%66%75%6E%63%74%69%6F%6E%73%3D%22%22+%2D%64+%6F%70%65%6E%5F%62%61%73%65%64%69%72%3D%6E%6F%6E%65+%2D%64+%61%75%74%6F%5F%70%72%65%70%65%6E%64%5F%66%69%6C%65%3D%70%68%70%3A%2F%2F%69%6E%70%75%74+%2D%64+%63%67%69%2E%66%6F%72%63%65%5F%72%65%64%69%72%65%63%74%3D%30+%2D%64+%63%67%69%2E%72%65%64%69%72%65%63%74%5F%73%74%61%74%75%73%5F%65%6E%76%3D%30+%2D%64+%61%75%74%6F%5F%70%72%65%70%65%6E%64%5F%66%69%6C%65%3D%70%68%70%3A%2F%2F%69%6E%70%75%74+%2D%6E HTTP/1.1" 301 178 "-" "-"

So if I take whole this URL and decode it I get this:
//cgi-bin/php?-d allow_url_include=on -d safe_mode=off -d suhosin.simulation=on -d disable_functions="" -d open_basedir=none -d auto_prepend_file=php://input -d cgi.force_redirect=0 -d cgi.redirect_status_env=0 -d auto_prepend_file=php://input -n

So somebody is clearly trying something dodgy here which I don't quite understand because I'm running python, not php application. I would love to understand what is happening here.
If I try to test it on one of my deployments like this:
curl -X POST http://my.site.example.com//%63%67%69%2D%62%69%6E/%70%68%70?%2D%64+%61%6C%6C%6F%77%5F%75%72%6C%5F%69%6E%63%6C%75%64%65%3D%6F%6E+%2D%64+%73%61%66%65%5F%6D%6F%64%65%3D%6F%66%66+%2D%64+%73%75%68%6F%73%69%6E%2E%73%69%6D%75%6C%61%74%69%6F%6E%3D%6F%6E+%64%69%73%61%62%6C%65%5F%66%75%6E%63%74%69%6F%6E%73%3D%22%22+%2D%64+%6F%70%65%6E%5F%62%61%73%65%64%69%72%3D%6E%6F%6E%65+%2D%64+%61%75%74%6F%5F%70%72%65%70%65%6E%64%5F%66%69%6C%65%3D%70%68%70%3A%2F%2F%69%6E%70%75%74+%2D%64+%63%67%69%2E%66%6F%72%63%65%5F%72%65%64%69%72%65%63%74%3D%30+%2D%64+%63%67%69%2E%72%65%64%69%72%65%63%74%5F%73%74%61%74%75%73%5F%65%6E%76%3D%30+%2D%64+%61%75%74%6F%5F%70%72%65%70%65%6E%64%5F%66%69%6C%65%3D%70%68%70%3A%2F%2F%69%6E%70%75%74+%2D%6E

I get:
The resource could not be found.
/cgi-bin/php

Though access log is a bit different:
xxx.xxx.xxx.xxx - - [24/Aug/2016:15:05:11 +0100] "POST //%63%67%69%2D%62%69%6E/%70%68%70?%2D%64+%61%6C%6C%6F%77%5F%75%72%6C%5F%69%6E%63%6C%75%64%65%3D%6F%6E+%2D%64+%73%61%66%65%5F%6D%6F%64%65%3D%6F%66%66+%2D%64+%73%75%68%6F%73%69%6E%2E%73%69%6D%75%6C%61%74%69%6F%6E%3D%6F%6E+%2D%64+%64%69%73%61%62%6C%65%5F%66%75%6E%63%74%69%6F%6E%73%3D%22%22+%2D%64+%6F%70%65%6E%5F%62%61%73%65%64%69%72%3D%6E%6F%6E%65+%2D%64+%61%75%74%6F%5F%70%72%65%70%65%6E%64%5F%66%69%6C%65%3D%70%68%70%3A%2F%2F%69%6E%70%75%74+%2D%64+%63%67%69%2E%66%6F%72%63%65%5F%72%65%64%69%72%65%63%74%3D%30+%2D%64+%63%67%69%2E%72%65%64%69%72%65%63%74%5F%73%74%61%74%75%73%5F%65%6E%76%3D%30+%2D%64+%61%75%74%6F%5F%70%72%65%70%65%6E%64%5F%66%69%6C%65%3D%70%68%70%3A%2F%2F%69%6E%70%75%74+%2D%6E HTTP/1.1" 404 164 "-" "curl/7.50.1"

The error code is 404 - not 301.
I cannot find out how attacker managed to get 301 instead of 404?
Comment: evidence of the PHP-CGI attack vector: see https://www.trustwave.com/Resources/SpiderLabs-Blog/-Honeypot-Alert--More-PHP-CGI-Scanning-(apache-magika-c)/ ...people are recommending (to upgrade PHP if installed) or deploy Web Application firewall(WAF).
Answer: This is only a guess, since there is no information on your nginx configuration.
You are making the CURL request to http://my.site.example.com. However, the attacker could have made the request to http://ip.address.
Therefore the requests might have hit different virtual servers in nginx configuration, and therefore the responses are different.
In order to give more accurate answer, we need to see the complete nginx configuration.
Comment: That was it, attacker tired IP rather than domain. When I use IP within curl I get the same 301 HTTP error code. Thanks.

NGINx - 301 HTTP error in access log


Yii jui.CJuiAutoComplete with JS function as source

Question: i'm using zii.widgets.jui.CJuiAutoComplete widget from the Yii framework, where autocompletion works fine, as log as there is an URL as source for the suggestions.
        $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
                        'model'=>$model,
                        'source'=>$this->createUrl('ajax/autoComplete'),
[...]

But now I need the suggestions coming from an javascript function, like this:
'source'=>'js: autoCompleteTags();'

But it seems not to be working.
Is it possible to use an function as source? How should the javascript function be designed?
I tried something like this:
function autoCompleteTags{

    var Tags= [
        "ActionScript",
        "AppleScript",
        "Asp",
        "BASIC",
        "C",
        "C++",
    ];
    return Tags;
    }

(This is just an simple example. The JS function code will be replaced by some more complex code. But the situation will be the same)
Thank you for any kind of help!
Answer: var Tags = [
        {
            value: "jquery",
            label: "jQuery",
        },
        {
            value: "jquery-ui",
            label: "jQuery UI",
        },
        {
            value: "sizzlejs",
            label: "Sizzle JS",
        }
    ];

Answer: widget code is
<?php
                        $ingredients = Ingredient::getingredients();
                        $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
                            'name' => 'ingredient[]',
                            //'source' => $ingredients,
                            'options' => array(
                                'change' => 'js:function() {
                                 var context=$(this);
                                 var childingredient = $(this).val();
                                 alert(childingredient); return false;
                                 $.ajax({
                                 type:"post",
                                 url : "' . Yii::app()->createAbsoluteUrl('recipe/getgramweight') . '",
                                 data: "parentingredient=" + parentingredient,
                                 success : function (response){
                               context.parent().next().find("select").html(response);
                                 },
                                 });
                                }',
                                'minLength' => '1',
                            ),
                            'htmlOptions' => array(
                                'style' => 'height:35px;',
                                'class' => 'ingredientname'
                            ),
                        ));
                        ?>

pass values from database to widget
<?php
    $criteria = new CDbCriteria();
    $criteria->select = "ingredient";
    $criteria->condition = 'ingredient!=""';
    $ingredients = Mymodel::model()->findAll($criteria);
    $ings = "[";
    foreach ($ingredients as $value)
    {
        $ings.='"' . $value->ingredient . '"' . ',';
    }
    $ings.="]";
    $ingredients_array = explode(",]", $ings);
    $ingredients_array[0] . "];";
    ?>

            });
        });
    </script>


Short Five Lemma for Fibrations

Question: Is there a short five lemma for fibrations in algebraic topology (in whatever category where it would be suitable -- the topological category, the homotopy category, whatever).
By short five lemma I mean as follows.  Let $E \to B$ is a fibration, with fiber $F$, and $E' \to B$ be another fibration with fiber $F'$.  Suppose there are maps from $F \to F'$, $E \to E'$, and $B \to B'$ that all satisfy the obvious commutative diagram.  Suppose all of the spaces are connected.  If the maps from $F$ and $B$ are isomorphisms in the appropriate category, is the map from $E$ an isomorphism?
Answer: Associated to a fibration tere is always a long exact sequence in homotopy groups. So if all spaces have the homotopy type of CW complexes the usual 5 Lemma tells you that if two of the three maps are (weak) homotopy equivalences, then so is the third.
Comment: Succinct, and obviously correct.  I can't ask for much more from an answer.
Comment: Strictly speaking, you need a bit more than the usual algebraic 5-lemma because $\pi_1$ can be non-abelian and $\pi_0$ is just a set.  But it still works, with some care.
Comment: Glad I could help :)
Comment: @DanRamras : You are right. Sorry for not pointing out the subtleties concerning the low homotopy groups.
Answer: What do you mean by the map between the fibres $F \to F'$ ?  The projections $E \to B$ and $E' \to B'$ have lots of fibres.  Do you mean that the map $\phi \colon E \to E'$ sends every fibre of $E \to B$ to a fibre of $E' \to B'$ and on each one is an isomorphism or do you just mean it sends one fibre in that way ?
If the former and you are interested in manifolds and isomorphisms are diffeomorphisms the result is true. A proof would be to notice that the map $E \to E'$ is a bijection because it is a bijection on fibres and the map on the base is a bijection.  Hence there is a set-theoretic inverse. If $e \in E$ then the condition of being a diffeomorphism on the fibre through $e$ and on the base will be enough to show that the derivative of this map is a bijection.  Hence the inverse function theorem shows there is a smooth local inverse which must coincide with the global set-theoretic inverse.
Not sure about the topological category with homeomorphisms as isomorphisms.  Does that follow from mland's answer ?  Is a weak homotopy inverse which is a bijection a homeomorphism ?
Comment: Sorry, I probably should have put in more detail.  I was thinking of spaces with a base point.  The fiber there is just the inverse image of the base point.
Comment: OK I understand.  Thanks.  In that case I think you can do $E  = E' = \mathbb{R}^2$, $B = B' = \mathbb{R}$ and $F = F' = \mathbb{R}$ with the projections to $B$ being the projection on the first factor and the basepoint being $1$.  Define $E \to E'$ to be $(x, y) \mapsto (x, xy)$. This is identity map on the fibre and the base but not invertible.

Short Five Lemma for Fibrations


Caratheodory continuation theorem: existence of the sequence for the definition of the extended measure

Question: I was trying to understand the proof for the Caratheodory's continuation theorem: any measure on an algebra $R$ has a unique continuation to a measure on $\sigma(R)$.
The proof suggested an extension of a measure $\mu$ defined on $R$ as $\lambda(A) = \inf \left( \sum_{n \in \mathbb{N}} \mu(A_n)\right)$ defined on $P(\Omega)$, which is the power set of $\Omega$, the set of outcomes, and $A_n$ is a sequence in $R$ satisfying $A \subset (\cup A_n)$.
I failed to understand why such sequence of $A_n$ exists, because $A_n$ is supposed to be elements of $R$ while $P(\Omega)$ is the power set of $\Omega$. For example, if $\Omega$ is the outcome of dice roll: $\Omega = {1,2,3,4,5,6}$, and I take $R = \{ \emptyset, \{1, 3,5\}, \{2,4,6\}, \Omega \}$, then $A = \{1,3\}$ is a valid subset of $P(\Omega)$ but $A$ cannot be constructed by taking unions of sets in $R$.
Maybe I have misunderstood something but it is unclear for me why most proofs work with power sets, not with e.g., $\sigma(R)$.
Grateful for your input.
Answer: By definition any algebra on $\Omega$ contans $\Omega$. So $A_n=\Omega$ for each $n$ gives one such choice.
Answer:
In the case where $\mathcal{R}$ is an algebra, for any $A\subset \Omega$ there is always sequence $\{A_n:n\in\mathbb{N}\}\subset\mathcal{R}\}$ covering $A$  as $\Omega\in\mathcal{R}$.

The situation that arises in your posting may appear when $\mathcal{R}$ is a ring or a semiring, and $\mu$ is a finitely additive and countably semi additive function on $\mathcal{R}$ . If there is no sequence $\{A_n:n\in\mathbb{N}\}\subset\mathcal{R}$ that covers $A$, then recall that $\inf\emptyset:=\infty$, in which case, $$\lambda(A)=\inf\{\sum_n\mu(A_n):\,A_n\in\mathcal{R},\,A\subset\bigcup_nA_n\}=\infty$$

Here, additive means that if $A,B\in\mathcal{R}$, $A\cap B=\emptyset$, and $A\cup B\in\mathcal{R}$, then $\mu(A\cup B)=\mu(A)+\mu(B)$; countably sub additivity means that if $(A_n:n\in\mathbb{N})\subset\mathcal{R}$, $A_n\cap A_m=\emptyset$ if $n\neq m$, and $\bigcup_nA_n\in\mathcal{R}$, then $\mu(\bigcup_nA_n)\leq \sum_n\mu(A_n)$; $\mathcal{R}$ is a semiring if $I,J\in\mathcal{R}$ implies that $I\cap J\in\mathcal{R}$, and $I\setminus J$ is the finite union of elements in $\mathcal{R}$. A careful study of the  outer measure
$$\mu^*(A)= \inf\{\sum_n\mu(A_n):\,A_n\in\mathcal{R},\,A\subset\bigcup_nA_n\}$$
shows that $\mu$ can be extended to a measure $\mu'$  defined on  a $\sigma$-algebra that contains $\sigma(\mathcal{R})$. In fact, any other extension $\nu$ of $\mu$ satisfies $\nu\leq \mu'$ on $\sigma(\mathcal{R})$. But this is a matter for other discussions.

Rings and semiring appear naturally in applications. For example, in the construction of the Lebesgue integral, consider $\mathcal{R}$ to be the collection of finite union of intervals $\{(a,b]:a,b\in\mathbb{R}, a\leq b\}$, $\mu((a,b])=b-a$. Here $\mathcal{R}$ is neither an algebra not a ring but a semiring. The method of Cartheodory produces the Lebesgue Measure here.

One last example: Suppose $\Omega=\{1,2,3,4,5,6,7\}$,  $\mathcal{R}=\{\emptyset,\{1,3,5\},\{2,4,6\}\}$, and $\mu(\emptyset)=0$, $\mu(\{2,4,6\})=\frac12=\mu(\{1,3,5\}). $ $\mathcal{R}$ is a semiring and generates the $\sigma$-algebra
$\sigma(\mathcal{R})=\{\emptyset,\{1,3,5\},\{2,4,6\},\{1,3,5,7\},\{2,4,6,7\},\{1,2,3,4,5,6\},\{7\},\Omega\}$.
The function $\mu$  is of course additive and countably subadditive on $\mathcal{R}$. The extension $\mu'$ of $\mu$ using Caratheodory's construction gives $\mu'(A)=\infty$ for any set $A\in\sigma(\mathcal{R})$ that contains $7$.
The extension $\nu$ of $\mu$ that assigned $\nu(\{7\})=0$ yields a probability measure on $\sigma(\mathcal{R})$
The measure provided by Charatheodory is unique in the sense that is maximal: If extension $\nu$ of $\mu$ from $\mathcal{R}$ to $\sigma(\mathcal{R})$ satisfies $\nu\leq \mu'$ on $\sigma(\mathcal{R})$. But this is a matter for other discussions
Comment: Super! I didn't expect that the measurement will be $\infty$ for sets that cannot be "constructed" from the union of sets in the algebra $\mathcal{R}$
Comment: That is what you get from the Caratheodory construction, which gives you a maximal measure (any other extension $\nu$ of $\mu$ satisfies $\nu\leq\mu'$. notice that in the last example, there are uncountably many ways to extend $\mu$ to a measure: $\nu_a(\{7\})=a$ with $0\leq a\leq\infty$. $\nu_{\infty}$ is the one that Caratheidory gives.


Group actions on manifolds - exponential map

Question: Let $M$ be a smooth manifold. Suppose $K$ is a Lie group (with Lie algebra $\mathfrak{k}$) acting EDIT: TRANSITIVELY on $M$ from the left and $G$ is a Lie group (with Lie algebra $\mathfrak{g}$) acting on $M$ from the right. Suppose further these actions commute - ie $k(pg)=(kp)g=kpg$. Fix a point $x\in M$. Suppose $\phi(t)$ is some smooth curve in $M$ such that $\phi(0)=x$.
Is it possible to find $X\in \mathfrak{k}$ and $A\in\mathfrak{g}$ such that
\begin{align*}
\frac{d}{dt}\bigg|_{t=0}\exp(tX)x\exp(tA)=\phi^{\prime}(0)??
\end{align*}
And if so, how could you prove such a fact?
Answer: Yes, it is always possible. In fact, you can always take $A=0\in\mathfrak g$.
Fix $x\in M$, and consider the smooth map $F\colon K\to M$ given by $F(k) = kx$. Because $K$ acts transitively, $F$ is surjective. Moreover, $F$ is equivariant with respect to the (transitive) left actions of $K$ on $K$ and $M$: For all $k,k'\in K$,
$$
k'F(k) = k'(kx) = (k'k)x = F(k'k).
$$
The equivariant rank theorem (Theorem 7.25 in my Introduction to Smooth Manifolds) shows that $F$ has constant rank, and because it's surjective, the global rank theorem (Theorem 4.14 in ISM) shows that it's a smooth submersion. This means that $dF_e\colon T_eK \to T_xM$ is surjective (where $e$ is the identity of $K$). Identifying $T_eK$ with $\mathfrak k$, we can choose $X\in \mathfrak k$ such that $dF_e(X) = \phi'(0)$. With $A=0\in \mathfrak g$, it then follows that
\begin{align*}
\left.\frac d {dt}\right|_{t=0}\exp(tX)x\exp(tA) &=
\left.\frac d {dt}\right|_{t=0}F(\exp(tX))
=
dF_e (d(\exp)_e(X)) =
dF_e (X) = \phi'(0).
\end{align*}
(In the second-to-last equation, I used the fact that $d(\exp)_e$ is the identity map on $\mathfrak k$.)
Comment: Thank you! In fact, I managed to prove my question last night using that exact theorem from your book!
Answer: What if the action of $G$ and $K$ are both trivial? E.g. $k\cdot x=x=x\cdot g$ for all $k$ and $g$? Then your expression $\mathrm{exp}(tX)\,x\, \mathrm{exp}(tA)$ is identically $x$, and so has trivial derivative. Hence you can't hit $\phi'(0)$ in general.
Comment: Of course. See my edit above.
Comment: @beedge89: ah well, that changes things. I'll leave my answer to the original question here, even though it does not address the edited quiestion.


Finding the/a point within an irregular polygon which is furthest from polygon's line segments?

Question: I'd like to determine which point(s) within an irregular polygon are furthest from the edges.
Is there an existing algorithm to determine this?
Also, if it's already out there, I'd like to do a similar thing, but for a rectangle of known size (fit the rectangle within the polygon maximizing it's distance from the edges).
Thanks
Comment: Is the polygon convex?
Comment: @TonyK - Possibly. It should handle both convex and concave polys.
Answer: The point that maximizes the distance from the polygon will be one of the vertices of the polygon's medial axis. There are algorithms for finding the medial axis, and they should also give the distance of each axis vertex from the original polygon; then you just pick the farthest one of them.
If you want to do this for a rectangle with fixed orientation, you can compute the Minkowski sum of the polygon with the rectangle (oriented so that the polygon is reduced rather than expanded) and then do the same procedure as above.
(Sorry for not providing links; I'm typing this on a mobile device. But these are all fairly standard terms you can look up on Google.)
Comment: Here is a [medial axis algorithms link](http://www.cs.sunysb.edu/~algorith/files/thinning.shtml). Warning: The algorithms are easy for convex polygons, difficult for nonconvex.
Answer: You need to define "furthest from the edges".  In following, it is taken to mean:  Point $C$ within polygon $P$ is "furthest from edges" if for any other point $D$ within $P$, the minimum distance from $D$ to any point on $P$ is not less than the like amount for point $C$.
Answers to this maximum-circle-in-polygon question (which was recently duplicated) give two methods for finding "furthest point" in a polygon.
Note that it's easy to find examples (non-convex, but connected and non-intersecting) where the first method (per paper of Garcia-Castellanos) in that reference does not come close to finding a neighborhood of the correct answer, because of no initial point falling into the region of the polygon containing the "furthest point".  The Voronoi method does not have that problem.
Regarding the rectangle-fitting part of your question, if we presume orientation and aspect ratio of the rectangle are fixed and given, it is easy to find examples where placing the rectangle center at the "furthest point" give an infeasible solution while other points are feasible.  This might be a problem harder to solve.  Update 1 The
Minkowski sum method previously mentioned by Rahul properly addresses this issue, although computing the boundary of the sum polygon can be tricky.  (As noted in cgal manual with code examples, it is straightforward for convex shapes, more involved for non-convex.)


Why would you use Xen as opposed to OpenVZ for trusted Linux-only host/guests?

Question: Every time I need to create VPSs out of one of our machines, I (re)think the virtualization technologies, and seem to end up with OpenVZ being the most suitable for performance reasons when all I want is clean separation between VPSs. All running GNU/Linux.
The question I have is, for a scenario with the following facts, when is it ever more advisable to go for Xen? Here goes the situational facts:

I trust everyone who will be using the VPSs, the issue of virtualization security is not a concern
The host and guests will all be running GNU/Linux
Me and my team manage all the VPSs ourselves

Normally I would be comfortable with my decision to go with OpenVZ, but I keep reading about reputable engineers using Xen in scenarios that I imagine are very similar to mine, Github being one example.
Comment: I think about virtualization technology, but I have _never_ found OpenVZ to be suitable for anything.
Comment: I'd probably be using [Linux LXC containers](http://lxc.sourceforge.net) for this application. Xen would never come to mind for this.
Answer: OpenVZ containers have very low overhead and are easy to manage from the host.  However, the main drawbacks of OpenVZ are fault tolerance and flexibility.
Code running inside an OpenVZ container could trigger a kernel panic that crashes the entire node.  If you allow containers to act as NFS clients, an NFS hang could stall the whole system.
OpenVZ containers have to run the same kernel version as the host.  They cannot insert kernel modules.  Furthermore, they can only use Linux features that have been OpenVZ-virtualized, so you can't use autofs, for example (as of 2013).
If you know that you can live with these limitations, then by all means try OpenVZ.  If it doesn't work out, it's not that difficult to switch to a full virtualization solution.  (The outline of the process is: create a disk image, loopback-mount it, install a kernel, re-enable some inittab entries.)
Comment: I didn't know that code running in user-land could trigger a kernel panic. Is that really possible?
Comment: @AmrMostafa It's not supposed to be possible, but kernel bugs happen, and system administrators have to take that possibility into account like any other eventuality.
Answer: You may trust the people who will be administering and using the VPSs, but can you trust the software? If a guest system panics, it may crash the entire node. If a guest system is vulnerable, then the entire node is at risk.
Of course, any hypervisor is also a piece of software, thus susceptible to bugs and vulnerabilities, but with smaller attack surface and stronger isolation than a container technology.


Optimizing over a sphere

Question: Let $f(x,y,z)=\frac12(x-x_0)^2+\frac12(y-y_0)^2+\frac12(z-z_0)^2$ for some $(x_0,y_0,z_0)\in\mathbb R^3$ and $X=\{(x,y,z)\in\mathbb R^3, (x-1)^2+(y-1)^2+z^2\le 9\}$. We wish to find the minimum of $f$ over $X$.
Firstly, it is easy to see by Heine's theorem that there is a unique solution to this problem since $X$ is compact and $f$ is continuous and strictly convex. Furthermore, if we let $h(x,y,z)=(x-1)^2+(y-1)^2+z^2-9$, we can rewrite the problem as : Minimize $f(x,y,z)$ for $h(x,y,z)\le0$. Since the problem is convex, we can apply the KKT conditions to the unique minimizer $(x',y',z')$ of $f$ over $X$ which gives :
$$\nabla f(x',y',z')+\mu\nabla h(x',y',z')=0$$
with $\mu\ge0$ and $\mu h(x',y',z')=0$.
From there, I feel like we should distinguish the cases $\mu=0$ and $\mu\ne0$, but I'm not sure how to make progress. I tried $\mu=0$ which gave $(x',y',z')=(x_0,y_0,z_0)$ and then $f(x',y',z')=0$ which would obviously qualify as a minimum since $f\ge0$. But then why should $(x_0,y_0,z_0)$ belong to $X$? I think I am a little confused, thank you very much for any help.
Comment: If $(x_0, y_0, z_0)$ does not belong to $X$ then the minimum occurs on the line segment connecting $(x_0, y_0, z_0)$  and $(1, 1, 0)$
Answer: The KKT conditions for this problem are,
\begin{align}
0 &= \nabla f(x,y,z)+\mu\nabla h(x,y,z) \\
0 &\geq h(x,y,z) \\
0 &\leq \mu \\
0 &= \mu h(x,y,z)
\end{align}
You correctly stated that if $\mu = 0$ then $0 = \nabla f(x,y,z) \implies (x',y',z') = (x_0,y_0,z_0)$. But notice that one of the KKT conditions is $0 \geq h(x,y,z)$. So if it is also the case that $0 \geq h(x_0,y_0,z_0)$ then $(x_0,y_0,z_0)$ is an optimal solution, i.e., if $(x_0,y_0,z_0)\in X$ then it is optimal. However, it doesn't have to be the case that $(x_0,y_0,z_0)\in X$, as you pointed out, and therefore the KKT condition $0 \geq h(x,y,z)$ will not be satisfied. This implies that our assumption that $\mu = 0$ was wrong and you have to check the case when $\mu > 0$ which implies that $0 = h(x,y,z)$.

Optimizing over a sphere


Using Linearity Of Inner Product

Question: Let assume we are looking at the euclidian inner product above $\mathbb{R}^3$ namely $$\langle u, v  \rangle=\sum_{i=1}^{3}u_i\cdot v_i=u_1v_1+u_2v_2+u_3v_3$$
Now looking if we have:
$$u=(cosb-a^2cos(3b),sinb+a^2sin(3b),2a\cdot cos(2b))$$
and
$$v=(-asinb+a^3sin(3b),acosb+a^3cos(3b),-2a^2sin(2b))$$
How would we take $$\langle u, v  \rangle$$ Can we use linearity?
Answer: yes you can expand with the ordinary rules for inner product

Using Linearity Of Inner Product


Privacy of Hyperledger composer rest server

Question: In Hyperledger composer rest api (composer-rest-server) are secure with Enabling authentication for the REST server. but in http://localhost:3000/explorer, All sensitive data is not encryption. Could i use cryptography or other approach to encrypt and decrypt like Zero Knowledge Proof to prevent data privacy (sensitive data)?
And I see Securing the REST server using HTTPS and TLS, when i run command composer-rest-server -c alice1@my-network -t and then open browser https://localhost:3000/explorer, but I don't know how to use it?
Thank you in advance!
Answer: Firstly, you would use TLS between the REST client and REST server - see https://hyperledger.github.io/composer/latest/integrating/securing-the-rest-server and general/useful info on TLS with diagrams here
You would really need to set up authentication (known user identities that are using it) with TLS like discussed here then connect to the authentication path for your application to authenticate the user using the REST APIs https://localhost:3000/auth/github: ((or whatever the authPath is for your implemented strategy)) and then interactions/ data in transit between client and server will be encrypted.
Once the REST server is up and running and TLS enabled - you will authenticate at your REST client as the user in question: once authenticated, that user gets an access token or similar. In terms of Composer and the deployed business network / smart contract - that user will (already) have been issued a business network card - that includes the user's blockchain identity (key/cert) and contain connection info/metadata (ie how to connect to the deployed/runtime business network out on the Fabric network). This access may be programmatically, from an application client that's using REST APIs (ie the app user that's logged in to the app, has been assigned this business network card) or indeed - a user is using the REST API client in a browser for example (eg.  he/she would import it into their Wallet in the REST client then that would be the default identity in the REST API session, and which interacts / signs transactions that update the business network (create asset, update asset etc), as REST API operations to the REST Server (over TLS) that interacts with the Fabric network (over TLS).
Comment: I've noticed that the userId value which is used for identifying the user throughout the code is the same value as set in the userId cookie. Does it mean that, knowing that value for some other user, I can signin as that user, just setting that cookie value manually?
Comment: a user that's authenticated gets a token intended for 'him'. He then uses a business network card (which contains a blockchain identity (certificate/key) to interact as a blockchain participant on that business network (deployed smart contract). If another user - from the browser or client - then you would normally authenticate that user (however the Google OAUTH2 example is using 'client' authentication, as opposed to 'user' authentication - you shouldn't confuse the two).


Is the following space finite-dimensional?

Question: Is the following space finite-dimensional?
$$V=\left\{f(t):[0,1]\to\mathbb{R}\mid f(0)=f'(0)=0, \int_0^1 \left(f''(u)\right)^2 \,du < \infty \right\}$$
This question is largely related to my previous question. After much thought, I tried to show the space $V$ is finite-dimensional with basis $1,t,t^2,t^3$  (even though it just does not look like one).
I considered that
$$f(t) = f(0) + f'(0)t + \int_0^t (t-u) f''(u) \,du$$
and failed to recognize the coefficients for $t^2$ and $t^3$. Any help is appreciated.
Comment: $1$ and $t$ are not even in your space. (But all $t^n$ for $n\ge2$ are).
Comment: @HenningMakholm Typo, meant to exclude those
Answer: No. The functions $t^2, t^3, t^4, \dots$ all belong to $V$ and are linearly independent.
Comment: Also, when defining $V$ you should specify what regularity properties elements of $V$ must satisfy - i.e do you assume $f$ is twice continuously differentiable? smooth?
Answer: No.
For $\lambda \in \mathbb{R}$ define $f_\lambda : [0,1]\to\mathbb{R}$ as $f_\lambda(x) = e^{\lambda x} - \lambda x  - 1$, $x \in [0,1]$.
You can check that $\Big\{f_\lambda : \lambda \in \mathbb{R}\setminus\{0\}\Big\} \subseteq V$ and that it is linearly independent.


Debian Server Keeps Restarting Unexpectedly

Question: My laboratory' server with Debian-Wheezy-7.8-Stable keeps restarting few times after some hours of uptime without any notification. This server is set up for considerably high load numerical computation as well as parallel computation. I have printed log from var/log/messages and last reboot but I found it hard to understand this log messages. I have tried to look into entry right before the reboot time took place and look into the same time in var/log/messages but it seems that entries from var/log/messages only show log/messages after the reboot happened.
I have surfed around and found that that some people get the same problem but it seems the cause is different from one another and /var/log/messages appears to be the key to look into the problem. What does my var/log/messages actually describe in regard of this unwanted rebooting event? and how to start learning on how to read this log for beginner? I mean is there any important keyword to look for or something?
Thank you for any help you can provide.
last reboot
reboot   system boot  3.2.0-4-amd64    Wed May 20 03:29 - 12:43  (09:14)
reboot   system boot  3.2.0-4-amd64    Tue May 19 16:01 - 12:43  (20:42)

var/log/messages
May 18 07:35:01 labserver rsyslogd: [origin software="rsyslogd" swVersion="5.8.11" x-pid="2400" x-info="http://www.rsyslog.com"] rsyslogd was HUPed
May 19 07:35:01 labserver rsyslogd: [origin software="rsyslogd" swVersion="5.8.11" x-pid="2400" x-info="http://www.rsyslog.com"] rsyslogd was HUPed
May 19 16:01:19 labserver kernel: imklog 5.8.11, log source = /proc/kmsg started.
May 19 16:01:19 labserver rsyslogd: [origin software="rsyslogd" swVersion="5.8.11" x-pid="2401" x-info="http://www.rsyslog.com"] start
May 19 16:01:19 labserver kernel: [    0.000000] Initializing cgroup subsys cpuset
May 19 16:01:19 labserver kernel: [    0.000000] Initializing cgroup subsys cpu
May 19 16:01:19 labserver kernel: [    0.000000] Linux version 3.2.0-4-amd64 (email@example.com) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.65-1+deb7u2
May 19 16:01:19 labserver kernel: [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.2.0-4-amd64 root=UUID=1fc245ac-9058-4208-862a-7f4e8e1b20b2 ro text
May 19 16:01:19 labserver kernel: [    0.000000] BIOS-provided physical RAM map:
May 19 16:01:19 labserver kernel: [    0.000000]  BIOS-e820: 0000000000000000 - 000000000009ac00 (usable)
May 19 16:01:19 labserver kernel: [    0.000000]  BIOS-e820: 000000000009ac00 - 00000000000a0000 (reserved)
May 19 16:01:19 labserver kernel: [    0.000000]  BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
May 19 16:01:19 labserver kernel: [    0.000000]  BIOS-e820: 0000000000100000 - 000000007df71000 (usable)
May 19 16:01:19 labserver kernel: [    0.000000]  BIOS-e820: 000000007df71000 - 000000007e0f1000 (reserved)
May 19 16:01:19 labserver kernel: [    0.000000]  BIOS-e820: 000000007e0f1000 - 000000007e2ec000 (ACPI NVS)
May 19 16:01:19 labserver kernel: [    0.000000]  BIOS-e820: 000000007e2ec000 - 000000007f367000 (reserved)
May 19 16:01:19 labserver kernel: [    0.000000]  BIOS-e820: 000000007f367000 - 000000007f800000 (ACPI NVS)
May 19 16:01:19 labserver kernel: [    0.000000]  BIOS-e820: 0000000080000000 - 0000000090000000 (reserved)
May 19 16:01:19 labserver kernel: [    0.000000]  BIOS-e820: 00000000fed1c000 - 00000000fed40000 (reserved)
May 19 16:01:19 labserver kernel: [    0.000000]  BIOS-e820: 00000000ff000000 - 0000000100000000 (reserved)
May 19 16:01:19 labserver kernel: [    0.000000]  BIOS-e820: 0000000100000000 - 0000000880000000 (usable)
May 19 16:01:19 labserver kernel: [    0.000000] NX (Execute Disable) protection: active
May 19 16:01:19 labserver kernel: [    0.000000] SMBIOS 2.7 present.
May 19 16:01:19 labserver kernel: [    0.000000] No AGP bridge found
May 19 16:01:19 labserver kernel: [    0.000000] last_pfn = 0x880000 max_arch_pfn = 0x400000000
May 19 16:01:19 labserver kernel: [    0.000000] x86 PAT enabled: cpu 0, old 0x7040600070406, new 0x7010600070106
May 19 16:01:19 labserver kernel: [    0.000000] last_pfn = 0x7df71 max_arch_pfn = 0x400000000
May 19 16:01:19 labserver kernel: [    0.000000] found SMP MP-table at [ffff8800000fd900] fd900
May 19 16:01:19 labserver kernel: [    0.000000] Using GB pages for direct mapping
May 19 16:01:19 labserver kernel: [    0.000000] init_memory_mapping: 0000000000000000-000000007df71000
May 19 16:01:19 labserver kernel: [    0.000000] init_memory_mapping: 0000000100000000-0000000880000000
May 19 16:01:19 labserver kernel: [    0.000000] RAMDISK: 36bea000 - 375ed000
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: RSDP 00000000000f04a0 00024 (v02 ALASKA)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: XSDT 000000007e204088 0008C (v01 ALASKA    A M I 01072009 AMI  00010013)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: FACP 000000007e211040 0010C (v05 ALASKA    A M I 01072009 AMI  00010013)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI Warning: FADT (revision 5) is longer than ACPI 2.0 version, truncating length 268 to 244 (20110623/tbfadt-288)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: DSDT 000000007e2041a8 0CE96 (v02 ALASKA    A M I 00000015 INTL 20051117)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: FACS 000000007e2e3080 00040
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: APIC 000000007e211150 00100 (v03 ALASKA    A M I 01072009 AMI  00010013)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: FPDT 000000007e211250 00044 (v01 ALASKA    A M I 01072009 AMI  00010013)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: MCFG 000000007e211298 0003C (v01 ALASKA OEMMCFG. 01072009 MSFT 00000097)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: HPET 000000007e2112d8 00038 (v01 ALASKA    A M I 01072009 AMI. 00000005)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: PRAD 000000007e211310 000BE (v02 PRADID  PRADTID 00000001 MSFT 03000001)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: SPMI 000000007e2113d0 00040 (v05 A M I   OEMSPMI 00000000 AMI. 00000000)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: SSDT 000000007e211410 D0CB0 (v02  INTEL    CpuPm 00004000 INTL 20051117)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: EINJ 000000007e2e20c0 00130 (v01    AMI AMI EINJ 00000000      00000000)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: ERST 000000007e2e21f0 00230 (v01  AMIER AMI ERST 00000000      00000000)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: HEST 000000007e2e2420 000A8 (v01    AMI AMI HEST 00000000      00000000)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: BERT 000000007e2e24c8 00030 (v01    AMI AMI BERT 00000000      00000000)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: DMAR 000000007e2e24f8 000C4 (v01 A M I   OEMDMAR 00000001 INTL 00000001)
May 19 16:01:19 labserver kernel: [    0.000000] No NUMA configuration found
May 19 16:01:19 labserver kernel: [    0.000000] Faking a node at 0000000000000000-0000000880000000
May 19 16:01:19 labserver kernel: [    0.000000] Initmem setup node 0 0000000000000000-0000000880000000
May 19 16:01:19 labserver kernel: [    0.000000]   NODE_DATA [000000087fffb000 - 000000087fffffff]
May 19 16:01:19 labserver kernel: [    0.000000] Zone PFN ranges:
May 19 16:01:19 labserver kernel: [    0.000000]   DMA      0x00000010 -> 0x00001000
May 19 16:01:19 labserver kernel: [    0.000000]   DMA32    0x00001000 -> 0x00100000
May 19 16:01:19 labserver kernel: [    0.000000]   Normal   0x00100000 -> 0x00880000
May 19 16:01:19 labserver kernel: [    0.000000] Movable zone start PFN for each node
May 19 16:01:19 labserver kernel: [    0.000000] early_node_map[3] active PFN ranges
May 19 16:01:19 labserver kernel: [    0.000000]     0: 0x00000010 -> 0x0000009a
May 19 16:01:19 labserver kernel: [    0.000000]     0: 0x00000100 -> 0x0007df71
May 19 16:01:19 labserver kernel: [    0.000000]     0: 0x00100000 -> 0x00880000
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: PM-Timer IO Port: 0x408
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC (acpi_id[0x02] lapic_id[0x02] enabled)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC (acpi_id[0x04] lapic_id[0x04] enabled)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC (acpi_id[0x06] lapic_id[0x06] enabled)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC (acpi_id[0x08] lapic_id[0x08] enabled)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC (acpi_id[0x0a] lapic_id[0x0a] enabled)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x01] enabled)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC (acpi_id[0x03] lapic_id[0x03] enabled)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC (acpi_id[0x05] lapic_id[0x05] enabled)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC (acpi_id[0x07] lapic_id[0x07] enabled)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC (acpi_id[0x09] lapic_id[0x09] enabled)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC (acpi_id[0x0b] lapic_id[0x0b] enabled)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1])
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC_NMI (acpi_id[0x02] high edge lint[0x1])
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC_NMI (acpi_id[0x04] high edge lint[0x1])
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC_NMI (acpi_id[0x06] high edge lint[0x1])
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC_NMI (acpi_id[0x08] high edge lint[0x1])
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC_NMI (acpi_id[0x0a] high edge lint[0x1])
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC_NMI (acpi_id[0x03] high edge lint[0x1])
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC_NMI (acpi_id[0x05] high edge lint[0x1])
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC_NMI (acpi_id[0x07] high edge lint[0x1])
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC_NMI (acpi_id[0x09] high edge lint[0x1])
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: LAPIC_NMI (acpi_id[0x0b] high edge lint[0x1])
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: IOAPIC (id[0x00] address[0xfec00000] gsi_base[0])
May 19 16:01:19 labserver kernel: [    0.000000] IOAPIC[0]: apic_id 0, version 32, address 0xfec00000, GSI 0-23
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: IOAPIC (id[0x02] address[0xfec01000] gsi_base[24])
May 19 16:01:19 labserver kernel: [    0.000000] IOAPIC[1]: apic_id 2, version 32, address 0xfec01000, GSI 24-47
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
May 19 16:01:19 labserver kernel: [    0.000000] Using ACPI (MADT) for SMP configuration information
May 19 16:01:19 labserver kernel: [    0.000000] ACPI: HPET id: 0x8086a701 base: 0xfed00000
May 19 16:01:19 labserver kernel: [    0.000000] SMP: Allowing 12 CPUs, 0 hotplug CPUs
May 19 16:01:19 labserver kernel: [    0.000000] PM: Registered nosave memory: 000000000009a000 - 000000000009b000
May 19 16:01:19 labserver kernel: [    0.000000] PM: Registered nosave memory: 000000000009b000 - 00000000000a0000
May 19 16:01:19 labserver kernel: [    0.000000] PM: Registered nosave memory: 00000000000a0000 - 00000000000e0000
May 19 16:01:19 labserver kernel: [    0.000000] PM: Registered nosave memory: 00000000000e0000 - 0000000000100000
May 19 16:01:19 labserver kernel: [    0.000000] PM: Registered nosave memory: 000000007df71000 - 000000007e0f1000
May 19 16:01:19 labserver kernel: [    0.000000] PM: Registered nosave memory: 000000007e0f1000 - 000000007e2ec000
May 19 16:01:19 labserver kernel: [    0.000000] PM: Registered nosave memory: 000000007e2ec000 - 000000007f367000
May 19 16:01:19 labserver kernel: [    0.000000] PM: Registered nosave memory: 000000007f367000 - 000000007f800000
May 19 16:01:19 labserver kernel: [    0.000000] PM: Registered nosave memory: 000000007f800000 - 0000000080000000
May 19 16:01:19 labserver kernel: [    0.000000] PM: Registered nosave memory: 0000000080000000 - 0000000090000000
May 19 16:01:19 labserver kernel: [    0.000000] PM: Registered nosave memory: 0000000090000000 - 00000000fed1c000
May 19 16:01:19 labserver kernel: [    0.000000] PM: Registered nosave memory: 00000000fed1c000 - 00000000fed40000
May 19 16:01:19 labserver kernel: [    0.000000] PM: Registered nosave memory: 00000000fed40000 - 00000000ff000000
May 19 16:01:19 labserver kernel: [    0.000000] PM: Registered nosave memory: 00000000ff000000 - 0000000100000000
May 19 16:01:19 labserver kernel: [    0.000000] Allocating PCI resources starting at 90000000 (gap: 90000000:6ed1c000)
May 19 16:01:19 labserver kernel: [    0.000000] Booting paravirtualized kernel on bare hardware
May 19 16:01:19 labserver kernel: [    0.000000] setup_percpu: NR_CPUS:512 nr_cpumask_bits:512 nr_cpu_ids:12 nr_node_ids:1
May 19 16:01:19 labserver kernel: [    0.000000] PERCPU: Embedded 27 pages/cpu @ffff88087fc00000 s78848 r8192 d23552 u131072
May 19 16:01:19 labserver kernel: [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8258294
May 19 16:01:19 labserver kernel: [    0.000000] Policy zone: Normal
May 19 16:01:19 labserver kernel: [    0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.2.0-4-amd64 root=UUID=1fc245ac-9058-4208-862a-7f4e8e1b20b2 ro text
May 19 16:01:19 labserver kernel: [    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
May 19 16:01:19 labserver kernel: [    0.000000] xsave/xrstor: enabled xstate_bv 0x7, cntxt size 0x340
May 19 16:01:19 labserver kernel: [    0.000000] Checking aperture...
May 19 16:01:19 labserver kernel: [    0.000000] No AGP bridge found
May 19 16:01:19 labserver kernel: [    0.000000] Memory: 32975732k/35651584k available (3434k kernel code, 2130964k absent, 544888k reserved, 3305k data, 576k init)
May 19 16:01:19 labserver kernel: [    0.000000] Hierarchical RCU implementation.
May 19 16:01:19 labserver kernel: [    0.000000]    RCU dyntick-idle grace-period acceleration is enabled.
May 19 16:01:19 labserver kernel: [    0.000000] NR_IRQS:33024 nr_irqs:1184 16
May 19 16:01:19 labserver kernel: [    0.000000] Extended CMOS year: 2000
May 19 16:01:19 labserver kernel: [    0.000000] Console: colour VGA+ 80x25
May 19 16:01:19 labserver kernel: [    0.000000] console [tty0] enabled
May 19 16:01:19 labserver kernel: [    0.000000] Fast TSC calibration using PIT
May 19 16:01:19 labserver kernel: [    0.004000] Detected 2100.074 MHz processor.
May 19 16:01:19 labserver kernel: [    0.000003] Calibrating delay loop (skipped), value calculated using timer frequency.. 4200.14 BogoMIPS (lpj=8400296)
May 19 16:01:19 labserver kernel: [    0.000144] pid_max: default: 32768 minimum: 301
May 19 16:01:19 labserver kernel: [    0.000253] Security Framework initialized
May 19 16:01:19 labserver kernel: [    0.000324] AppArmor: AppArmor disabled by boot time parameter
May 19 16:01:19 labserver kernel: [    0.002355] Dentry cache hash table entries: 4194304 (order: 13, 33554432 bytes)
May 19 16:01:19 labserver kernel: [    0.011585] Inode-cache hash table entries: 2097152 (order: 12, 16777216 bytes)
May 19 16:01:19 labserver kernel: [    0.015724] Mount-cache hash table entries: 256
May 19 16:01:19 labserver kernel: [    0.015915] Initializing cgroup subsys cpuacct
May 19 16:01:19 labserver kernel: [    0.015986] Initializing cgroup subsys memory
May 19 16:01:19 labserver kernel: [    0.016063] Initializing cgroup subsys devices
May 19 16:01:19 labserver kernel: [    0.016133] Initializing cgroup subsys freezer
May 19 16:01:19 labserver kernel: [    0.016201] Initializing cgroup subsys net_cls
May 19 16:01:19 labserver kernel: [    0.016270] Initializing cgroup subsys blkio
May 19 16:01:19 labserver kernel: [    0.016344] Initializing cgroup subsys perf_event
May 19 16:01:19 labserver kernel: [    0.016441] CPU: Physical Processor ID: 0
May 19 16:01:19 labserver kernel: [    0.016509] CPU: Processor Core ID: 0
May 19 16:01:19 labserver kernel: [    0.017564] mce: CPU supports 23 MCE banks
May 19 16:01:19 labserver kernel: [    0.017670] CPU0: Thermal monitoring enabled (TM1)
May 19 16:01:19 labserver kernel: [    0.017768] using mwait in idle threads.
May 19 16:01:19 labserver kernel: [    0.018315] ACPI: Core revision 20110623
May 19 16:01:19 labserver kernel: [    0.049889] DMAR: Host address width 46
May 19 16:01:19 labserver kernel: [    0.049958] DMAR: DRHD base: 0x000000fbffc000 flags: 0x1
May 19 16:01:19 labserver kernel: [    0.050034] IOMMU 0: reg_base_addr fbffc000 ver 1:0 cap d2078c106f0466 ecap f020de
May 19 16:01:19 labserver kernel: [    0.050122] DMAR: RMRR base: 0x0000007f239000 end: 0x0000007f247fff
May 19 16:01:19 labserver kernel: [    0.050195] DMAR: ATSR flags: 0x0
May 19 16:01:19 labserver kernel: [    0.050261] DMAR: RHSA base: 0x000000fbffc000 proximity domain: 0x0
May 19 16:01:19 labserver kernel: [    0.050427] IOAPIC id 0 under DRHD base  0xfbffc000 IOMMU 0
May 19 16:01:19 labserver kernel: [    0.050497] IOAPIC id 2 under DRHD base  0xfbffc000 IOMMU 0
May 19 16:01:19 labserver kernel: [    0.050568] HPET id 0 under DRHD base 0xfbffc000
May 19 16:01:19 labserver kernel: [    0.050741] Enabled IRQ remapping in x2apic mode
May 19 16:01:19 labserver kernel: [    0.050810] Enabling x2apic
May 19 16:01:19 labserver kernel: [    0.050875] Enabled x2apic
May 19 16:01:19 labserver kernel: [    0.050943] Switched APIC routing to cluster x2apic.
May 19 16:01:19 labserver kernel: [    0.051552] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
May 19 16:01:19 labserver kernel: [    0.091256] CPU0: Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz stepping 04
May 19 16:01:19 labserver kernel: [    0.195570] Performance Events: PEBS fmt1+, generic architected perfmon, Intel PMU driver.
May 19 16:01:19 labserver kernel: [    0.195802] ... version:                3
May 19 16:01:19 labserver kernel: [    0.195869] ... bit width:              48
May 19 16:01:19 labserver kernel: [    0.195936] ... generic registers:      4
May 19 16:01:19 labserver kernel: [    0.196003] ... value mask:             0000ffffffffffff
May 19 16:01:19 labserver kernel: [    0.196073] ... max period:             000000007fffffff
May 19 16:01:19 labserver kernel: [    0.196143] ... fixed-purpose events:   3
May 19 16:01:19 labserver kernel: [    0.196210] ... event mask:             000000070000000f
May 19 16:01:19 labserver kernel: [    0.196468] NMI watchdog enabled, takes one hw-pmu counter.
May 19 16:01:19 labserver kernel: [    0.196637] Booting Node   0, Processors  #1
May 19 16:01:19 labserver kernel: [    0.312587] NMI watchdog enabled, takes one hw-pmu counter.
May 19 16:01:19 labserver kernel: [    0.312765]  #2
May 19 16:01:19 labserver kernel: [    0.424400] NMI watchdog enabled, takes one hw-pmu counter.
May 19 16:01:19 labserver kernel: [    0.424578]  #3
May 19 16:01:19 labserver kernel: [    0.536316] NMI watchdog enabled, takes one hw-pmu counter.
May 19 16:01:19 labserver kernel: [    0.536489]  #4
May 19 16:01:19 labserver kernel: [    0.648124] NMI watchdog enabled, takes one hw-pmu counter.
May 19 16:01:19 labserver kernel: [    0.648303]  #5
May 19 16:01:19 labserver kernel: [    0.759941] NMI watchdog enabled, takes one hw-pmu counter.
May 19 16:01:19 labserver kernel: [    0.760115]  #6
May 19 16:01:19 labserver kernel: [    0.871864] NMI watchdog enabled, takes one hw-pmu counter.
May 19 16:01:19 labserver kernel: [    0.872050]  #7
May 19 16:01:19 labserver kernel: [    0.983690] NMI watchdog enabled, takes one hw-pmu counter.
May 19 16:01:19 labserver kernel: [    0.983866]  #8
May 19 16:01:19 labserver kernel: [    1.095600] NMI watchdog enabled, takes one hw-pmu counter.
May 19 16:01:19 labserver kernel: [    1.095774]  #9
May 19 16:01:19 labserver kernel: [    1.207414] NMI watchdog enabled, takes one hw-pmu counter.
May 19 16:01:19 labserver kernel: [    1.207589]  #10
May 19 16:01:19 labserver kernel: [    1.319223] NMI watchdog enabled, takes one hw-pmu counter.
May 19 16:01:19 labserver kernel: [    1.319400]  #11 Ok.
May 19 16:01:19 labserver kernel: [    1.431095] NMI watchdog enabled, takes one hw-pmu counter.
May 19 16:01:19 labserver kernel: [    1.431192] Brought up 12 CPUs
May 19 16:01:19 labserver kernel: [    1.431260] Total of 12 processors activated (50398.84 BogoMIPS).
May 19 16:01:19 labserver kernel: [    1.450786] devtmpfs: initialized
May 19 16:01:19 labserver kernel: [    1.455360] PM: Registering ACPI NVS region at 7e0f1000 (2076672 bytes)
May 19 16:01:19 labserver kernel: [    1.455494] PM: Registering ACPI NVS region at 7f367000 (4820992 bytes)
May 19 16:01:19 labserver kernel: [    1.455843] print_constraints: dummy:
May 19 16:01:19 labserver kernel: [    1.455977] NET: Registered protocol family 16
May 19 16:01:19 labserver kernel: [    1.456140] ACPI: bus type pci registered
May 19 16:01:19 labserver kernel: [    1.456268] PCI: MMCONFIG for domain 0000 [bus 00-ff] at [mem 0x80000000-0x8fffffff] (base 0x80000000)
May 19 16:01:19 labserver kernel: [    1.456361] PCI: MMCONFIG at [mem 0x80000000-0x8fffffff] reserved in E820
May 19 16:01:19 labserver kernel: [    1.466673] PCI: Using configuration type 1 for base access
May 19 16:01:19 labserver kernel: [    1.468173] bio: create slab <bio-0> at 0
May 19 16:01:19 labserver kernel: [    1.468353] ACPI: Added _OSI(Module Device)
May 19 16:01:19 labserver kernel: [    1.468422] ACPI: Added _OSI(Processor Device)
May 19 16:01:19 labserver kernel: [    1.468491] ACPI: Added _OSI(3.0 _SCP Extensions)
May 19 16:01:19 labserver kernel: [    1.468560] ACPI: Added _OSI(Processor Aggregator Device)
May 19 16:01:19 labserver kernel: [    1.484562] ACPI: Executed 1 blocks of module-level executable AML code
May 19 16:01:19 labserver kernel: [    1.727818] ACPI: Interpreter enabled
May 19 16:01:19 labserver kernel: [    1.727891] ACPI: (supports S0 S1 S4 S5)
May 19 16:01:19 labserver kernel: [    1.728159] ACPI: Using IOAPIC for interrupt routing
May 19 16:01:19 labserver kernel: [    1.736531] ACPI: No dock devices found.
May 19 16:01:19 labserver kernel: [    1.736630] HEST: Table parsing has been initialized.
May 19 16:01:19 labserver kernel: [    1.736704] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
May 19 16:01:19 labserver kernel: [    1.737041] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-fe])
May 19 16:01:19 labserver kernel: [    1.737361] pci_root PNP0A08:00: host bridge window [io  0x0000-0x03af]
May 19 16:01:19 labserver kernel: [    1.737435] pci_root PNP0A08:00: host bridge window [io  0x03e0-0x0cf7]
May 19 16:01:19 labserver kernel: [    1.737508] pci_root PNP0A08:00: host bridge window [io  0x03b0-0x03df]
May 19 16:01:19 labserver kernel: [    1.737586] pci_root PNP0A08:00: host bridge window [io  0x0d00-0xffff]
May 19 16:01:19 labserver kernel: [    1.737659] pci_root PNP0A08:00: host bridge window [mem 0x000a0000-0x000bffff]
May 19 16:01:19 labserver kernel: [    1.737747] pci_root PNP0A08:00: host bridge window [mem 0x000c0000-0x000dffff]
May 19 16:01:19 labserver kernel: [    1.737834] pci_root PNP0A08:00: host bridge window [mem 0xfed0e000-0xfed0ffff]
May 19 16:01:19 labserver kernel: [    1.737922] pci_root PNP0A08:00: host bridge window [mem 0x80000000-0xfbffffff]
May 19 16:01:19 labserver kernel: [    1.740791] pci 0000:00:01.0: PCI bridge to [bus 01-01]
May 19 16:01:19 labserver kernel: [    1.745575] pci 0000:00:01.1: PCI bridge to [bus 02-03]
May 19 16:01:19 labserver kernel: [    1.745700] pci 0000:00:02.0: PCI bridge to [bus 04-04]
May 19 16:01:19 labserver kernel: [    1.745816] pci 0000:00:03.0: PCI bridge to [bus 05-05]
May 19 16:01:19 labserver kernel: [    1.745933] pci 0000:00:03.2: PCI bridge to [bus 06-06]
May 19 16:01:19 labserver kernel: [    1.746285] pci 0000:00:11.0: PCI bridge to [bus 07-07]
May 19 16:01:19 labserver kernel: [    1.746541] pci 0000:00:1e.0: PCI bridge to [bus 08-08] (subtractive decode)
May 19 16:01:19 labserver kernel: [    1.747170]  pci0000:00: Requesting ACPI _OSC control (0x1d)
May 19 16:01:19 labserver kernel: [    1.747465]  pci0000:00: ACPI _OSC control (0x15) granted
May 19 16:01:19 labserver kernel: [    1.756901] ACPI: PCI Root Bridge [UNC0] (domain 0000 [bus ff])
May 19 16:01:19 labserver kernel: [    1.758443]  pci0000:ff: Requesting ACPI _OSC control (0x1d)
May 19 16:01:19 labserver kernel: [    1.758528]  pci0000:ff: ACPI _OSC control (0x1d) granted
May 19 16:01:19 labserver kernel: [    1.759439] ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 7 10 *11 12 14 15)
May 19 16:01:19 labserver kernel: [    1.760105] ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 6 7 *10 11 12 14 15)
May 19 16:01:19 labserver kernel: [    1.760768] ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 *5 6 10 11 12 14 15)
May 19 16:01:19 labserver kernel: [    1.761383] ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 10 *11 12 14 15)
May 19 16:01:19 labserver kernel: [    1.762006] ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 6 7 10 11 12 14 15) *0
May 19 16:01:19 labserver kernel: [    1.762729] ACPI: PCI Interrupt Link [LNKF] (IRQs 3 4 5 6 7 10 11 12 14 15) *0
May 19 16:01:19 labserver kernel: [    1.763450] ACPI: PCI Interrupt Link [LNKG] (IRQs 3 4 5 6 7 10 11 12 14 15) *0
May 19 16:01:19 labserver kernel: [    1.764170] ACPI: PCI Interrupt Link [LNKH] (IRQs 3 4 5 6 *7 10 11 12 14 15)

Comment: Does the reboot always happen at 12.43?
Comment: 12.43 is the time I run the command `last reboot` @jennyd. It rebooted at `03:29` and `16:01`.
Answer: You need to provide more information, especially log entries right before the system rebooted. However as far as I can see it may not provide more information. Check other logs such as syslog.
The most common causes in my experience for sudden restarts without any indication really of what went wrong is often hardware related. Otherwise the kernel mostly will have a chance of writing something in the logs to give a clue.
Some common causes of sudden restarts:

Overheating, probably the main cause, get an idea of the temperature, try to log it, does the server have a display that could show the temperature, is the room cooled properly. Perhaps replace the thermal compound on the heatsinks covering the CPU(s).
Bad hardware or drivers, get a list of it using "lspci" for example, a bad dimm can cause a system to suddenly hang and/or reboot (re-seat dimms, CPUs and cards). I remember a server which rebooted occasionally due to an issue with the intel ethernet card. Sometimes a bad disk can cause such problems as well, although normally it would just cause it to hang rather than restart.
A bad UPS, I remember a battery backed UPS going bad slowly and one of the indicators it did so was a regular weekly power cycle of servers connected to it. You could just have a mis-configured power cycle schedule.
Comment: Thanks for the answer @aseq. I have tried to find important entries from `var/log/messages` right before the reboot happens but I got no clue whatsoever because the entries seems to skip the moment when it rebooted and show stuff only after it turns back on.  I will take look on 'syslog', hoping it gives me more information.

I am actually not sure about the hardware since it is just bought few weeks ago. I guess it is probably the overheating because the server room does not have any external cooling yet while most of the time the computation uses most of the core of processor.
Comment: In that case overheating seems the most likely scenario. And I wouldn't expect other logs to have any useful information either, but it doesn't hurt checking.


System.console() gives a NullPointerException in NetBeans

Question: I have the following problem: method readLine() or nextLine(), nextInt(), etc. throw an exception: NullPointerException.
I use the NetBeans IDE (if it matters).
public static void Reading()
{
    String qq;
    qq = System.console().readLine();
    System.console().printf(qq);
}

Answer: Some IDEs don't provide a console. Note that System.console() returns null in these cases.
From the documentanion

Returns:
     The system console, if any, otherwise null.

You can always use System.in and System.out instead, as follows:
String qq;
Scanner scanner = new Scanner(System.in);
qq = scanner.nextLine();
System.out.println(qq);

Answer: Two things:

The standard way of printing things is System.out.println("Thing to print");
The standard way of reading input off the console is: Scanner s = new Scanner(System.in); String input = s.nextLine();

So with these in mind, your code should be
public static void Reading() {
    String qq;
    Scanner s = new Scanner(System.in);
    qq = s.nextLine();
    System.out.println(qq);
    s.close();
}

or
public static void Reading() {
    String qq;
    try (Scanner s = new Scanner(System.in)) {
        qq = s.nextLine();
        System.out.println(qq);
    }
}


Dificuldade para remover item de uma lista invertida no Vue

Question: Estou apanhando na hora de usar lista no Vue. Exibo na tela uma lista invertida por uma computed. Preciso se exibir ela invertida para quando adicionar um item ele aparecer na parte de cima. Só que da forma que fiz o Vue se perde na hora de remover o item correto da lista.
Veja meu código: https://jsbin.com/jutuyenubi/edit?html,js,console,output
Fiz um botão para adicionar, que funciona corretamente. Já no "remover" eu utilizo o index do item na lista para fazer um splice(), só que o Vue usa esse index na lista invertida, eu imaginei que ele usaria na lista original e depois inverteria.
Answer: Olá
As mudanças que eu faria no código seriam adição de propriedade key no html e utilizar próprio item como referencia para remoção:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>

    <button @click="add">button</button>

        {{ item.name }} - remover

E no JS:
new Vue({
  el: '#box',
  data: {
    list: [
      {id: 1, name: 'item 1'},
      {id: 2, name: 'item 2'},
      {id: 3, name: 'item 3'}
    ]
  },
  methods: {
    add: function(){
      this.list.push({id: 100, name: 'novo item'})
    },
    del: function(item){
      alert(item.id)
      this.list.splice(this.list.indexOf(item), 1)
    }
  },
  computed: {
    reverse: function(){
      return this.list.slice().reverse()
    }
  }
})

Comment: Valeu cara, resolveu meu problema.
Comment: Cara a sua resposta funciona, mas é como o Sergio comentou, dá problema com objetos imutáveis. Comecei a ter problemas que foram resolvidos usando a solução do Sergio.
Answer: Tens de usar o index revertido também no argumento dessa função assim:
reverse.length - 1 - index

Outra maneira seria passar o id e depois fazer
this.list = this.list.filter(obj => obj.id !== id)

ou passar o proprio item:
this.list = this.list.filter(obj => obj !== item)

Exemplo com o index revertido:

new Vue({
  el: '#box',
  data: {
    list: [{
        id: 1,
        name: 'item 1'
      },
      {
        id: 2,
        name: 'item 2'
      },
      {
        id: 3,
        name: 'item 3'
      }
    ]
  },
  methods: {
    add: function() {
      this.list.push({
        id: 100,
        name: 'novo item'
      })
    },
    del: function(index) {
      alert(index)
      this.list.splice(index, 1)
    }
  },
  computed: {
    reverse: function() {
      return this.list.slice().reverse()
    }
  }
})

  <button @click="add">button</button>

      {{ item.name }} - remover

Comment: @FelipeCoelho ótimo, é uma questão de preferência, eu não gosto do `.splice` porque não se aplica a lógica de imutáveis que eu prefiro. Mas a outra resposta é boa  e dei `+1` também :)
Comment: A sua resposta foi excelente, legal a ideia de usar o filter mas a resposta do @Jozimar Back foi mais simples.
Comment: Vc tem razão quanto a questão dos objetos imutaveis, minha aplicação ficou 100% correta utilizando a sua opção.


Neo4j - funcionamento do cluster

Question: Alguem sabe informar como o cluster Neo4j faz o "keep alive" entre os nós?
Sei que tem os parametros ha.tx_push_factor (quantidade de slaves que o master força o commit) e o ha.pull_interval (intervalo que o master puxa as transações do master).
Mas como o cluster sabe que um nó não está mais ativo (tanto faz se for master ou slave), por exemplo, em caso de falhas de conectividade entre os nós?
Answer: O cluster Neo4j utiliza o protocolo de "heartbeats" para monitorar o estado dos nós do cluster. Cada nó do cluster envia periodicamente "heartbeats" para os outros nós do cluster, indicando que está ativo e disponível. Se um nó não receber um "heartbeat" de outro nó por um determinado período de tempo, ele considera que o nó está inativo e toma medidas para substituí-lo no cluster.
O intervalo entre os "heartbeats" é configurável através do parâmetro ha.heartbeat_interval, que especifica o intervalo em segundos entre os "heartbeats" enviados pelos nós do cluster. O valor padrão é 1 segundo.
Além disso, o cluster também utiliza o protocolo de "election" para escolher o novo master em caso de falha do atual master. Quando um nó detecta que o master atual está inativo, ele inicia o processo de "election" para escolher um novo master entre os nós do cluster. Os nós do cluster votam entre si e o nó com o maior número de votos é eleito o novo master. O intervalo entre as eleições é configurável através do parâmetro ha.election_timeout, que especifica o intervalo em segundos entre as eleições. O valor padrão é 5 segundos.
Comment: Como está escrito atualmente, sua resposta não é clara. Por favor, pode [edit] para adicionar mais detalhes, que ajudarão outras pessoas a entender como isso resolve a pergunta feita. Você pode encontrar mais informações sobre como escrever boas respostas [na Central de Ajuda](/help/how-to-answer).

Neo4j - funcionamento do cluster


How to disable progress bar in Nuxt?

Question: I am making HTTP communications with Axios in my Nuxt JS Project. When I send a request, a bar appears at the top of the page. How can I turn this off?
Also: How can I do if I want to edit this instead of closing it? (Color, Thickness)
Comment: This is a quality of life feature for your end users on slow connection devices. I do recommend not disabling it.
Comment: I put this manually where requests are made. (Progressbar). My client wants it like this ¯|_(**)_| ¯
Answer: You can disable the progress bar with this, in nuxt.config.js
export default {
  loading: false
}

For any more info, check this link: https://nuxtjs.org/docs/configuration-glossary/configuration-loading#disable-the-progress-bar
You could also override it with your own CSS if you need it, inspect the element.

How to disable progress bar in Nuxt?


A 10 digit positive number and ordered triplets

Question: A 10 digit positive number is said to be a "LearnHub"number if its digits are all distinct and it is a multiple of 11111. How many "LearnHub" numbers are there?
Find the number of ordered triplets (a, b, c) of positive integers for which LCM (a, b) =1000, LCM (b, c) = 2000 and LCM (c, a) = 2000.
How do i do this ? I have worked a lot on them.
Comment: Where did you find this problem? Let me guess — a website called "LearnHub"?
Answer: Note that $1000=2^35^3$ and $2000=2^45^3$. What does this tell you about the prime factors of $a$, $b$, and $c$? Do you know what the LCM is of, say, $p^rq^s$ and $p^tq^u$, if $p$ and $q$ are primes?
Can you see why any number with all 10 digits must be a multiple of 9? Can you see why any number that's a multiple of 9 and a multiple of 11111 must be a multiple of 99999? Now, $99999=100000-1$, so if you mutiply it by the 5-digit number abcde, you get abcde00000-abcde. From this you should be able to work out the possibilities for abcde to make the result contain all 10 digits.
EDIT: Of course, there's always the computer programmer's solution, where you just ask your computer to look at all the 10-digit multiples of 11111 and count up how many have all 10 digits.
Answer: $1000 = 2^3 * 5^3$
$2000 = 2^4 * 5^3$
Since LCM of $a$ and $b$ is $1000$, they at the most contain $2$ three times and $5$ three times.
Also the LCM of terms containing $C$ is $2000$, the term $c$ should contain $2$ four times, as $a$ and $b$ can contain $2$ only three times.
so $c$ should either be
$2^4 = 16$
$2^4 * 5^1 = 80$
$2^4 * 5^2 = 400$
or $2^4 * 5^3 = 2000$.
Either $a$ or $b$ should have $2^3$. Hence fixing one as $2^3$ other can take values from $2^0$ to $2^3$.
Hence total combination= $2*4 - 1$ (the one combination is $2^3,2^3$ which we took twice)$= 7$
2 of the three should have power of $5$ as $5^3$, whereas the third can take 4 values in terms of powers of $5$ $(5^0$ to $5^3)$. Hence total no of such arrangement = $(3!/2! *4) -2$(this is for $5^3,5^3,5^3$ which we took thrice) = $12 -2 =10$
Hence ordered triplets will be $10*7 = 70$


I need help to start this exercise of propositional logic

Question: I have the definition of this function
\begin{equation*}
\begin{aligned}
Subf : PROP & \rightarrow \mathcal{P}(PROP) \\
F & \mapsto Subf(F)
\end{aligned}
\end{equation*}with,
$Subf(F) = \{F\}$, $Subf(\neg F) =  \{ \neg F\} \cup Subf(F)$ and $Subf(F \circ G) =  \{F \circ G\} \cup Subf(F) \cup Subf(G)$
this function determines the set of sub-formulas of a given a propositional formula but i must show that if $F$ has $n$ connectives then $Subf(F)$ has at most $2n + 1$ propositional formulas.
I have no idea that how to start proof it. Any idea or hint?. Thanks.
Comment: Have you tried using induction?
Comment: yes, but I have no idea because I should apply the definition of the Subf function
Answer: By induction on the number of connectives in $F$.
If $F$ has $0$ connectives, then $F$ must be an atomic formula, so $Subf(F)=\{F\}$ by definition, which has $1=2(0)+1$ propositional formulas.
Suppose that for some $n$, for all propositional formulas $H$, that if $H$ has $n_0 \leq n$ connectives, then $|Subf(H)|\leq 2n_0+1$. Suppose $F$ has $n+1$ connectives. Then, since $n+1 \geq 1$, $F$ must be of the form $\neg F'$ for some $F'$, or of the form $F' \circ G$ for some $F'$ and $G$.
In the first case, since $F'$ has $n$ connectives, we can apply the induction hypothesis to arrive at $|Subf(F')| \leq 2n+1$, from which $Subf(F)=Subf(\neg F')=\{\neg F'\}\cup Subf(F')$ must have at most $1+(2n+1)=2n+2=2(n+1)<2(n+1)+1$ elements.
In the second case, suppose $F'$ has $m$ connectives and $G$ has $k$ connectives, with $m+k=n$. Then $F'$ has $m\leq n$ connectives and $G$ has $k\leq n$ connectives, so we can apply the induction hypothesis to arrive at $|Subf(F')|\leq 2m+1$ and $|Subf(G)| \leq 2k+1$, from which we have that $Subf(F)=Subf(F' \circ G) = \{F' \circ G\} \cup Subf(F') \cup Subf(G)$, so $|Subf(F)| \leq 1+(2m+1)+(2k+1) = 1+2(m+k+1)=2(n+1)+1$.
In both cases, we have shown that $F$ having $n+1$ connectives implies that $|Subf(F)|\leq 2(n+1)+1$, so by induction, it is true for all $n$.


Protecting my website content from being downloaded through cURL

Question: I heard about external access of a website using curl by the following code:
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://example.com');
$buffer=curl_exec($curl_handle);
curl_close($curl_handle);

I want to protect my website from this external access. I am using PHP. How can I protect my web site?
Answer: This is no more dangerous than anyone accessing through your website with a browser; in fact, this is what curl is as far as your question is concerned: a web browser and nothing more.
If you have security vulnerabilities, they will be broken. If not, they won't. curl, however, does not amplify or diminish any vulnerabilities whatsoever; it is merely a way for a PHP script to access another website (typically through HTTP).
If you want to prevent content from being downloaded, you can block incoming HTTP requests, but this defeats the purpose of a web site, since web browsers make identical requests (and can also download content).
Answer: If you mean "how do I protect my website against being accessed by a program other than a browser", the answer is pretty much "you can't." A browser is just a program that sends HTTP requests. You can play the game of trying to reject HTTP requests that look like they don't come from a browser, but it's trivially easy for an arbitrary program (one using curl, or Perl/Python/Ruby libraries) to mimic the headers that a "real" browser sends.
Answer: I agree with waiwai, however, if you really want to 'protect' yourself against basic non-browser access, consider encrypting your content and decrypting it using, say, JavaScript when the site is accessed. Any browser that understands JavaScript (and has it enabled) will be able to display the content properly. But even encrypting the content can be worked around easily.
The setbacks are 1) it's not 'secure', 2) search engines may index your website incorrectly (afterall, they use cURL-like calls), 3) users who have JavaScript disabled are unable to access your content.
Overall, I'd say it's not worth it.
Answer: You can't, if you want your users to be able to see it.
You could set up some system so that it won't serve up some content unless another related piece of content was very recently requested by the same user, but even that will not stop someone who really wants to get it...
Answer: Another thing you can do is protect your site with a Captcha. This will prevent access via curl but will allow your users access.
Be aware that doing this will stop search engines from visiting your site.


If a Concert instrument plays an F double sharp scale, what is the first note they play

Question: plz help...If a Concert instrument plays an F double sharp scale, what is the first note they play
I was confused on this question and need more clarification because I play a Concert Bb instrument.
Comment: Your question seems really too close to [the one you just posted](https://music.stackexchange.com/questions/109583/when-an-eb-instrument-plays-the-concert-f-scale-what-note-do-they-start-on), maybe you should consider editing that question instead of creating a new one, or at least add a comment clarifying what you need if the provided answers are not satisfying.
Comment: What do you mean by "F double sharp scale"? You certainly haven't seen an example in real music.
Comment: This question sounds like a music theory student looking up an answer to an obtuse test question.
Comment: Does this answer your question? [When an Eb instrument plays the Concert F scale, what note do they start on?](https://music.stackexchange.com/questions/109583/when-an-eb-instrument-plays-the-concert-f-scale-what-note-do-they-start-on)
Comment: Why would you as a Bb player be confused? We're all confused by the question - where did it come from?
Answer:
If a Concert instrument plays an F double sharp scale, what is the first note they play?

A concert instrument should never play such a scale.  No composer should ever write such a scale for any instrument, regardless of transposition.

I play a Concert Bb instrument.

If you have a written F double sharp scale, then a concert instrument would have a written E sharp scale, which is equally improper.  Conversely, if you are looking at an F double sharp scale written for a concert-pitch instrument, and you want to play it on your B-flat instrument, you would play a G double sharp scale.
All of these are pure insanity.  Instead, they should be written as F, G, or A scales.
Unless the composer (or arranger) of the piece you're playing is sadistic, or trying to make some sort of intellectual point, you should also consider the possibility that you have misunderstood the composer's intentions.
Answer: Firstly, whilst there might be an Fx scale, it's extremely unusual  for it to be used anywhere. Fx is enharmonic in most cases, certainly in 12tet to G♮, so that scale and its notes would be preferrable.
But, in answer to the actual question, the first note would have to be , as is the case in any scale, the root or tonic note. Here Fx. It may well sound like G, but the note will be Fx.
Comment: "it's extremely unusual for it to be used anywhere": that's a mild way of looking at it.  I would say "it's an error for it to be used anywhere."
Comment: It **may** be used in a piece starting in key F# that has a keychange up a semitone - if anyone would be daft enough to write like that...
Answer: The F## Major scale is: F## G## A## B♯ C## D## E##
It is considered a theoretical scale, so it would surprise me if you were playing in the key of F## Major.


EXCEL VBA: get data from range

Question: I have report that contains 500 thousand cells of data (from A to M).
I need to summarize this data.
example FROM:
no. date    action  time
112256  07/Jul/2014 Done    1:00:00 AM
112256  07/Jul/2014 Done    1:15:00 AM
112256  07/Jul/2014 Done    1:18:00 AM
112256  07/Jul/2014 Adjusted    1:35:00 AM
112256  07/Jul/2014 Adjusted    1:39:00 AM
112256  07/Jul/2014 Finished    1:57:00 AM
112387  07/Jul/2014 Done    3:01:00 AM
112387  07/Jul/2014 Adjusted    3:33:00 AM
112387  07/Jul/2014 Adjusted    3:45:00 AM
112387  07/Jul/2014 Finished    4:57:00 AM

no: date    done    adjusted    finished
112256  07/Jul/2014 1:00:00 AM  1:39:00 AM  1:57:00 AM
112387  07/Jul/2014 3:01:00 AM  3:45:00 AM  4:57:00 AM

Problem:
as you see "no." is ascending, and every "no." can have from 1 up to 50 values (actions taken).
When sumarizing I need only 1 "no." (identifying the part been made), 1 "date" (when), and 3 actions times "the first when it was done, the last when it was adjusted, and - the one and only - finished"
I got caught up on this, I was thinking how to select range with the same "no." and then search in that range for first done, last adjusted and finished, but I was not able to work properly in one range. I have nothing at the moment, and this is only the little part, but a proper start I believe is a way to great success.
Thank you for your answers.
Comment: Stack Overflow is not the right place to "request" code..
Comment: What do you want to summarize? I know the data, but do you want, say, a count of the done, adjusted, or finished? I'm not sure what you are trying to do.

Also, you haven't included any code that you may or may not have tried? Have you tried writing the code at all yourself?
Comment: @tannman357 hello, as with every action an additional line adds up to the report, I need to summarize it, by getting the time only of the first done, last adjusted, and finished action.
Lets say it was adjusted 34 times, same no. part, so I need when summarizing get only last adjusted (that saves 34 lines!) as every line contains same data, just a different time when i tas adjusted.

In the end:
no. - one details number
date - date when done
done - time when first done
adjusted - time when last adjusted
finished - when finished
Comment: For i = 3 To n

    If report.Range("A" & i) = report.Range("A" & b) Then
    b = b + 1
    Else

     For a = i To b

       reps = Data.Range("A" & Rows.Count).End(xlUp).Row + 1
       no = report.Range("A" & a).Value
       Data.Range("A" & reps).Value = no

     Next a

    b = b + 1
    End If

Next i
Comment: Oh that makes sense. You really just need some loops. Btw, I can't read code in the comments at all...
Comment: @tanman357 what I have is not working.
What I need is to find when the detail now shows first and last, and then put another for to work in that range and export needed data to other worksheet.
Answer: Pivot table is the answer, but you'll need to add a helper column first.
Assuming your data above is in columns A:D, in E2 enter the following formula and copy down (down-side to this method is recalculation could be very slow). I put Combined as the column header in E1. You can rename as needed.
=IF($C2="Finished","Keep",IF(AND($C2="Done",$D2=MIN(IF(A:A=$A2,IF(C:C=$C2,D:D)))),"Keep",IF(AND($C2="Adjusted",$D2=MAX(IF(A:A=$A2,IF(C:C=$C2,D:D)))),"Keep","No")))

This is array formula so you'll need to press CTRL + SHIFT + ENTER to get it to work properly.
What this does is show keep for all Finished items, all the first Done items, and all the last Adjusted items for each No.
Then create a pivot table, and you'll put the following items in the Pivot Table areas:

Report Filter: New Combined column
Column Labels: Action column
Row Labels: No. column, followed by Date column
Values: Time column

Now to format the pivot table.

In the values area of the pivot table, change the Value Field Settings to Sum
Filter the Combined report filter to only include items that have Keep
In the Pivot Table Design tab of the ribbon select Subtotals and Do Not Show Subtotals
In the Pivot Table Design tab of the ribbon select Grand Totals and
Off for Rows and Columns
In the Pivot Table Design tab of the ribbon select Report Layout and Show in Tabular Form
In the Pivot Table Design tab of the ribbon select Report Layout and Repeat All Item Labels

Your end result should look like this:
Comment: Hello!
Summarizing this data is just first step out of ten! I will be able to act on myself after this step - I will need to check how many items where made not on time, and what is the reason, I have not pasted the full excel data, because there is really a lot (A to M columns).
I need to understand how I need to get the range for data, for example - I find the same detail number, and i need to get range for it for example detail no 157722 range 19457 - 19467 (data contains more than 500k rows) - so okey there are 10 rows and actions made with this detail.
Comment: So for i = 1 to n, I would need to find the row when first this number showed and last, then I would add another for, which I would run through these 10 rows, finding the first done, last adjusted and finished and exporting them in one row to other sheet.
Comment: Hey that's great, but to help others, I would parse your steps into different questions. If you know your starting point and your end point, figure out what you need to do then post different questions where you get stuck. Expanding on your question in the comments won't help you or others get to your solution.

EXCEL VBA: get data from range


Proving that multiplication of convex function is convex

Question: Here's a homework question I'm struggling with:

Prove/disprove the next statement:
Let $f,g$ two convex functions, then $h(x)=f(x) \cdot g(x)$ is
also convex

So, we know that $h'(x)=f'(x) \cdot g(x) + f(x) \cdot g'(x)$. We also know that $f'(x),g'(x)$ are monotonically increasing because they are convex. If I can show that $h'(x)$ is also monotonically increasin I'm done, but I'm not sure how to do it. Any hints?
Thanks!
Comment: It would be nice to find some sufficient conditions under this statement is true. For example, maybe it's true when $f,g$ are non negative functions.
Comment: Ok ... $x \mapsto (x-a)^2$ is convex for any $a$, right :)
Comment: Necessary and sufficient conditions are given here: https://www.ima.umn.edu/sites/default/files/2204.pdf (despite the title it also covers the case of convex functions)
Answer: Hint: You can write the function defined by $x\mapsto-x^2$ as the product of two very simple linear and hence convex functions.
Comment: @roni It is false. Take the two functions $x\mapsto x$ and $x\mapsto -x$.
Comment: So the statement is not even true. I assumed it is. Thanks!
Comment: I am sorry but I am new to convex functions. Is the statement "the product of convex functions is convex" true or false ? Could you please clarify and give more details. For example if $f(x)=-x^2$ and $g(x)=-x^2$ then  $fg$ is a convex function whereas $f$ and $g$ are not.
Answer: The functions $f(x)=1-x$ and $g(x)=1+x$ are convex. However, their product $(f*g)(x)=1-x^2$ is not. So it hoes not hold.
Answer: False
Proof:
Let $h(x) = f(x)\cdot g(x)$, or in short: $h = fg$, then:
$h' = gf' + fg'$
and: $h'' = gf'' + 2f'g'+ fg''$
A necessary and sufficient condition for convexity is :
$~h''= gf'' +  2f'g'+ fg'' \ge 0$   $\quad (1)$
A quick test is to check if $f$ and $g$ are both "$\ge 0$", and $f'$ and $g'$ have the same sign ("$\,\ge 0\,$": convex increasing; "$\,\le0\,$": convex decreasing). Otherwise, check condition $(1)$.
Note that if $f = g$, then $h= f^2$ and condition $(1)$ becomes:
$$h'' = 2ff'' + 2(f')^2$$
Since $f$ and $g$ are convex, $f''\ge  0$ and $g'' \ge 0$,
then the only condition to check is $f \ge 0$.


Is it a good technique or a bad technique to shuffle while batting?

Question: I want to know from coaching perspective, is it good to shuffle after the ball lands on the pitch?
For right hand batsman - it's moving the right leg to reach the ball and for left hand batsman it's left leg. I was told that it's not a good technique. I have found that one could reach the pitch of the ball by shuffling keeping the head still than fishing the ball. It also depends on the reach of the batsman.
Answer: I'm not sure what you mean by "shuffling", but it's standard technique to move according to where the ball is delivered to. Keeping the head still is vital to pick up the line of the ball, then movement to get into that line and allow you play the most appropriate shot.
The standard coaching manual will suggest that the first movement should be with the back foot, and this should be across the stumps and backwards. This is used by a lot of batsmen, but by no means all. Even in international cricket there are a huge range of styles.
Comment: There is a school of thought which says, for medium pace and spinners it's a bad practise to shuffle. I honestly, didn't see the reason behind that.


Fatal error: Call to a member function find() on a non-object in /home4/msaraiva/public_html/test.php on line 8

Question: I have this simple parser that i'm trying to make it work. But i get Fatal error: Call to a member function find() on a non-object in /home4/msaraiva/public_html/test.php on line 8 error , that's on the 1st for each. But: on this url http://jantes.rupteur.com/jantes-alu/Alfa-Romeo-145 ( only 78 records) it works nice, but when i go to http://jantes.rupteur.com/jantes-alu/Alfa-Romeo-159 that has 399 records, the parser takes me to a fatal error, i tried everything and it's not working. PS: All Pages have the same html structure
Thanks you all
<?php
 include_once('simple_html_dom.php');

    $html=file_get_html("http://jantes.rupteur.com/jantes-alu/Alfa-Romeo-145");

 foreach ($html ->find('td[valign=top]') as $t){
       foreach ($t ->find('h1') as $k)
          foreach ($t ->find('strong') as $g)
            echo $k;
            echo $g .'
';
       foreach ($html ->find('td[valign=top]') as $f)
           $num = explode('/>',$f);
           echo strip_tags($num[1]);
 }
 echo '
';
 ?>

Comment: Also you variable naming sucks...
Comment: Also you indentation is... weird
Comment: It isn't something to "forget". You're having problems debugging your poorly conceived code -- that's why you should use better variable names, standard indentation, and braces. It makes your code readable and debugable.
Comment: I believe you forgot some braces...
Comment: no, i guess not, because on the Alfa-Romeo-145 it works 100% correct
but on Alfa-Romeo-159 (that has a lot more records) it gives me the error, and i checked all the html and it's all the same
Comment: Use braces and variable names that mean something so your code is readible. Then, use `is_object` to make sure that, before you call the `find` method of an object, that you actually have an object. The error message tells you exactly what the problem is.
Comment: forget all the "weird and naming of variables" , but th code is working to some urls, but not to the ones that has more records
Answer: Probably it happens because by default file_get_html function returns false if the html code lenght that you are parsing is bigger than 600000. Your second page is very large, so increase the MAX_FILE_SIZE constant in the simple_html_dom.php file.
define('MAX_FILE_SIZE', 9999999);

And listen to @PeeHaa and @Chris comments: there is nothing that can be just "forgotten"
Answer: Just in case anyone comes across this
function get_data($url)
{
  $ch = curl_init();
  $timeout = 5;
  curl_setopt($ch,CURLOPT_URL,$url);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
  $data = curl_exec($ch);
  curl_close($ch);
  return $data;
}

$url = "your url";

$htmlraw = "";
// this is the important bit (curl function is irrelevant)
$htmlraw = get_data($url);
// use the str_get_html function instead.
$html = str_get_html($htmlraw);

hope that helps someone!


Histogram question: How do we choose a perfect histogram?

Question: 20 students from a school were randomly selected to study the dollar
amount that they spend on purchasing soft drink in a typical week. The data
collected (in dollars):
<code>$24, $35, $17, $21, $24, $37, $26, $46, $58, $30,
$32, $13, $12, $38, $41, $43, $44, $27, $53, $27
</code>
Some graphical representations are created based on the above data
Figures 1 to 4 are shown below.
Which do you consider an appropriate histogram? You can choose more then 1.

This is an actual quiz question but I find it to be so poorly worded I cannot understand a single bit. Can anyone help?
Comment: You may have to wait a bit, questions aren't usually answered in the first hour. What is it that confuses you about the question? Is this an essay question?
Comment: The histograms in the lower row are incorrectly drawn: they do not depict all the data, no matter how you interpret the vertical axis.
Answer: I wouldnt say the question is poorly worded.  It's just that the differences of the histograms are subtle, and can be missed.
The problem asks:
<code> Which do you consider an appropriate histogram? You can choose more then 1.
</code>
If you look at Figure 1 and Figure 2, at first glance they look identical.  However, they have a major difference. Can you spot it?  (Hint: Read the labels carefully).
Then between Figure 3 and Figure 4, you have an analogous situation.  In each case only one is appropriate, given the data.
Can you take it from here?


Microsoft.AspNetCore DoS vulnerability, how to resolve for .Net Framework projects

Question: I have a .Net Web API project targeting .Net Framework 4.6, in this project I have Microsoft.AspNetCore 126.96.36.199 DLL.
I have read that Microsoft.AspNetCore 188.8.131.52 DLL has DoS (Denial of Service) security vulnerability.
https://github.com/aspnet/AspNetCore/issues/6488
When I look into the recommended resolution it says to upgrade to Version 2.7, now issue is I can't upgrade to 2.7 as highest I can upgraded for .Net Framework is 22.214.171.124 which I already have.
Query:

Is this security vulnerability only for apps created by targeting
.Net Core and not .Net Framework even though Microsoft.AspNetCore
188.8.131.52 library is used?
If first is true, then does it mean I don't have to do anything for this security vulnerability? If not, then what should I do to get over this security concern (given that I can't upgrade Microsoft.AspNetCore to 2.7 in a .Net Framework project)?
Answer: All our security advisories include sections describing how to detect if you're affected and how to update. The linked issue has this down in the "Advisory FAQs". In this case you need to install the latest version of the Windows Hosting Bundle. This is true even if you are using .NET Framework. That particular vulnerability is in the ASP.NET Core Module for IIS, which is the native component that allows you to host ASP.NET Core apps (on both .NET Core and .NET Framework) in IIS. If you install the hosting bundle, all your ASP.NET Core apps (including those targeting .NET Framework) should be protected from this issue. The FAQs also include instructions on how to verify you have the right version installed (using a PowerShell script to check the version number of the aspnetcore.dll file)
For packages: We don't update every single package for every patch release. Only the affected packages are updated. The Microsoft.AspNetCore package hasn't been patched at all, so it's still at 2.2.0. Other packages, like Microsoft.AspNetCore.Mvc.RazorPages have had some patches, so they're at versions like 2.2.5. You should always ensure that all your packages that start with Microsoft.AspNetCore have the latest patch version (the third component of the version number) installed in order to get all necessary security updates.


Copy some MySQL rows between two different database connection via PHP

Question: I want to copy some rows from srcdb.srctb to dstdb.dsttb that, those are in do separate servers with different user and password access. Due to in PHP we can use one connection resource in mysql_query(), how can I do run my query? for example:
$dblink_src = ($srchost, $srcuser, $srcpass);
$dblink_dst = ($dsthost, $dstuser, $dstpass);
mysql_query('insert into dstdb.dsttb select * from srcdb.srctb as mysrc where mysrc.provid=8', ????);

I don't know what should I put instead of "????" because, I can just use one database connection, but I need 2 to specify two different database connection.
Comment: SELECT INTO OUTFILE in one. LOAD DATA INFILE in the other. Don't need to write any code. Specially not code that uses mysql_*
Answer: If this is the same host, you have to replace ???? by a user who have access to the twice databases.
$dblink = mysql_connect($srchost,$userWithAccessToSrcAndDest,$pass);

mysql_query('insert into dstdb.dsttb select * from srcdb.srctb as mysrc where mysrc.provid=8',$dblink);

I this is two different host, or if there is no user with access to the source and destination databases, you have to use SELECT INTO OUTFILE in source database and LOAD DATA INFILE in the destination database like mentionned by @e4c5.
Please, think to use PDO instead of mysql_* functions
Here is another solution using federated table :
On the first server, create a view of your table :
create view test_view as
select * from srcdb.srctb as mysrc where mysrc.provid=8

On the destination server, create a federated view :
CREATE TABLE federated_table (
    //Put your description
)
ENGINE=FEDERATED
DEFAULT CHARSET=latin1
CONNECTION='mysql://src_user@src_host:3306/src_database/test_view';

You could find more explanation about the syntax on this Mysql chapter
Comment: Thank you dear for your answer and the suggestion. So, any way to do that via sql command line in one query statement without using export and import to/from file?
Comment: This isn't the same host ?
Comment: No, those are in separate hosts.
Comment: Ok, so I edited my answer with federated table. If you can't create table on source host, as far as I now, there is any other way to do that.
Comment: Thank you Alexandre, the federated table solution is helpful for me.